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;

Properties

PropertyTypeDefaultDescription
baseHrefBooleanfalseSet it to true if you have base href set in your web page header. This will fix rendering issues caused by this feature, like masks filters not working, causing graphs to protrude from plot area.
chartsArray[AmChart]This array will hold references to all instances of the charts or maps created on the same page.
dayNamesArray[String]['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday']Array of day names, used when formatting dates (if categoryAxis.parseDates is set to true)
monthNamesArray[String]['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December']Array of month names, used when formatting dates (if categoryAxis.parseDates is set to true)
processDelayNumber0Delay 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.
shortDayNamesArray[String]['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat']Array of short versions of day names, used when formatting dates (if categoryAxis.parseDates is set to true)
shortMonthNamesArray[String]['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']Array of short versions of month names, used when formatting dates (if categoryAxis.parseDates is set to true)
themeStringYou can set theme for all the charts on your page by setting: AmCharts.theme = AmCharts.themes.light; // or some other theme. If you are creating charts using JavaScript API, not JSON, then this is quite a comfortable way, as you won't need to pass theme to each object you create. Note, you should set theme before write method is called. There is no way to change theme of already created chart, you have to create chart's instance once more if you want to change theme.
useUTCBooleanfalseSet it to true if you want UTC time to be used instead of local time.

Methods

NameParametersReturnsDescription
addInitHandler(handler, [types]) 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)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()Clears all the charts on page, removes listeners and intervals.
formatDate(date, format)You can use this method to format date object into date string.
formatNumber(number, formatter, zeroCount)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)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)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 class does not have any events.