AmCharts

Type class

Namespace of the framework which holds the general settings, gets automatically injected to document since the source has been included.

Example

AmCharts.useUTC = true;
AmCharts.processDelay = 100;

Inheritance

AmCharts does not extend any other symbol.

AmCharts is not extended by any other symbol.

Properties

processDelay
#

Type number

Default 0

Delay in ms at which each chart on the page should be rendered. This is very handy if you have a lot of charts on the page and do not want to overload the device CPU.

Methods

addInitHandler(
  handler,
  [types]
)

#

Returns void

handler is a method which will be called before initializing the chart. types is array of strings, specifying which chart types should call this method. If you don't set any type, all the charts will call this method. When handler method is called, chart instance is passed as an attribute. You can use this feature to preprocess chart data or do some other things you need before initializing the chart.

addPrefix(
  value,
  prefixesBig,
  prefixesSmall,
  numberFormatter
)

#

Returns void

Format the number according to rules set in prefixesBig, prefixesSmall and numberFormatter.

You can use chart instance's "prefixesOfSmallNumbers", "prefixesOfBigNumbers" as well as "precision", "decimalSeparator" and "thousandsSeparator" properties to form your request.

var formatted = AmCharts.addPrefix(
  value,
  chart.prefixesOfBigNumbers, 
  chart.prefixesOfSmallNumbers, {
    precision: chart.precision,
    decimalSeparator: chart.decimalSeparator,
    thousandsSeparator: chart.thousandsSeparator
  });

clear()

#

Returns void

Clears all the charts on page, removes listeners and intervals.

formatDate(
  date,
  format
)

#

Returns void

You can use this method to format date object into date string.

formatNumber(
  number,
  formatter,
  zeroCount
)

#

Returns void

Returns string formatter with the provided settings. Formatter is an object with precision, decimalSeparator and thousandsSeparator defined, like: {precision: 2, decimalSeparator: '.', thousandsSeparator: ','}; If you don't need to adjust precision set it to -1. zeroCount defines how many zeros should be added after comma (useful when formatting currencies).

makeChart(
  container,
  chartConfig,
  delay
)

#

Returns void

Creates chart. container can be either id or the reference to the element you want the chart to be placed in, chartConfig is JSON object with chart properties defined and delay is time in ms, in which the chart should be rendered (renders instantly if not set).

stringToDate(
  string,
  format
)

#

Returns void

You can use this method to convert date string to date object. Please note, that literal name codes such as MMM or MMMM are not supported.

Events

AmCharts does not have any events.

Adapters

AmCharts does not have any adapters.