Show:

ia.BreaksCalculator Class

Calculates breaks for various types of classification.

Constructor

ia.BreaksCalculator

(
  • data
)

Parameters:

  • data Number

    The data array.

Methods

_quantileFunc

(
  • numberOfClasses
  • a
)
Number private

Classifies a set of data values into classes with an equal number of units in each class.

Parameters:

  • numberOfClasses Number

    The number of classes to use in the classification.

  • a Number

    The array of numbers to use - this.stats.sorted or this.stats.unique.

Returns:

Number: The class breaks as an array of size (numberOfClasses + 1). Returns null if unable to calculate the breaks. The lower and upper boundaries are included in the breaks.

addFunction

(
  • classifierName
  • fnc
)

Adds a function. The function receives the number of classes as a parameter and must return the calculated breaks.

Parameters:

  • classifierName String

    The name of the classifier.

  • fnc Function

    The function.

continuous

(
  • numberOfClasses
)
Number

Classifies a set of data values by continuous values.

Parameters:

  • numberOfClasses Number

    The number of classes to use in the classification which is irrelevant in this case.

Returns:

Number: The array of continuous values.

equalIntervals

(
  • numberOfClasses
)
Number

Classifies a set of data values by setting the value ranges in each class to be equal in size.

Parameters:

  • numberOfClasses Number

    The number of classes to use in the classification.

Returns:

Number: The class breaks as an array of size (numberOfClasses + 1). Returns null if unable to calculate the breaks. The lower and upper boundaries are included in the breaks.

getBreaks

(
  • numberOfClasses
  • name
)
Number

Classifies a set of data values by setting the value ranges in each class to be equal in size.

Parameters:

  • numberOfClasses Number

    The number of classes to use in the classification.

  • name String

    The name of the classification to use.

Returns:

Number: The class breaks as an array of size (numberOfClasses + 1). Returns null if unable to calculate the breaks. The lower and upper boundaries are included in the breaks.

getData

() Number

Gets the data.

Returns:

Number: The data.

getStats

() ia.Statistics

Gets the statistics.

Returns:

ia.Statistics: The statistics.

natural

(
  • numberOfClasses
)
Number

Classifies a set of data values into classes with a variable number of values in each class. Class breaks are placed where there are gaps between clusters of values using Jenks natural breaks classification. Uses the continuous array of the data object for optimization.

Further information on Jenks classification can be found in: Jenks, George F. 1967. "The Data Model Concept in Statistical Mapping", International Yearbook of Cartography 7: 186-190.

Parameters:

  • numberOfClasses Number

    The number of classes to use in the classification.

Returns:

Number: The class breaks as an array of size (numberOfClasses + 1). Returns null if unable to calculate the breaks. The lower and upper boundaries are included in the breaks.

quantiles

(
  • numberOfClasses
)
Number

Classifies a set of data values into classes with an equal number of units in each class.

Parameters:

  • numberOfClasses Number

    The number of classes to use in the classification.

Returns:

Number: The class breaks as an array of size (numberOfClasses + 1). Returns null if unable to calculate the breaks. The lower and upper boundaries are included in the breaks.

setData

(
  • value
)

Sets the data.

Parameters:

  • value Number

    The data.

standardDeviation

(
  • numberOfStandardDeviations
)
Number

Classifies a set of data values by finding the mean value, and then placing class breaks above and below the mean at intervals of generally 0.25, 0.5 or 1 standard deviation. Makes use of the sdSize property to determine the size of the standard deviation

The standard deviation classifier differs from other classifiers in that the number of standard deviations above and below the mean are specified rather than the number of classes.

Parameters:

  • numberOfStandardDeviations Number

    The number of standard deviations above and below the mean.

Returns:

Number: The class breaks as an array of size (numberOfStandardDeviations + 1). The lower and upper boundaries are included in the breaks. Returns null if unable to calculate the breaks.

Properties

errorMessage

String

The error message that appears when a calculator breaks and defaults to equal interval.

Default: "Legend error defaulting to equal interval."

sdSize

Number

The size of the interval to use for standard deviation calculators.

Default: 1