Back to amCharts.com

Line & Area chart data

CSV

CSV data comes in the format:

series;value of the first graph;value of the second graph;…;value of the x graph

For example:

1949;2.54;20.21
1950;2.51;19.73
1951;2.53;18.43
1952;2.53;18.08
1953;2.68;19.01
1954;2.78;19.57
1955;2.77;19.58
1956;2.79;19.43
1957;3.09;20.83
1958;3.01;19.73

Each new line determines the new series and values of your graphs, separated by a special character (the semicolon ';' is used by default - you can change it in the settings (<csv_separator>).

Remember, if you are using CSV data, you must tell the software to look for that format. This is done by setting <data_type>csv</data_type> in the settings file. If you load your data from a file, you will probably need to change file name of your data file too.

XML

Here is example of XML data for line chart:

<chart>
 <series>
  <value xid="0">1950</value>
  <value xid="1">1951</value>
  <value xid="2">1952</value>
 </series>
 <graphs>
  <graph gid="1">
   <value xid="0">-0.307</value>
   <value xid="1">-0.168</value>
   <value xid="2">-0.073</value>
  </graph>
  <graph gid="2">
   <value xid="0">-0.171</value>
   <value xid="1">-0.175</value>
   <value xid="2">-0.176</value>
  </graph>
 </graphs>
</chart>

As you can see, the data comes in two parts: series and graphs. Series defines the X-axis points. Series values may be numbers or strings. The xid attribute is a unique identifier. You can have as many series as you wish.

Graphs defines the graph. Every graph has ID: gid="1". This ID is necessary if the settings for the graph are located in the settings file, and the "gid" in the data file must match the "gid" in the settings file. Each graph has values. Value tag has an xid attribute, which matches the xid from series. It is not necessary that every graph has the same number of values as series, the chart will handle missing data.

XML data attributes

XML data format allows you to apply some custom formatting for your data points, color background of some series in a different color, indicate which series values should be sown on the axis, etc. These settings are included within <value> tag, for example:

<series>
   .................
   <value xid="10" event_start="war" event_color="#000000" show="true">1980</value>
   .................
   <value xid="20" event_end="war">1990</value>
   .................
</series>

This will make background color from the year 1980 to the year 1990 to be filled with red color. The year 1980 will always be shown on the category axis.

Another example:

<graph gid="1">
   .............
   <value xid="100" bullet="round" url="http://www.amcharts.com" description="Rainfall in September">-0.307</value>
   .............

This will show round bullet on this data point. This bullet will be linked to amcharts.com web site. The discription might be showed when the user rolls-over the bullet.

Below is the full list of available attributes:

<value> of a <series> can have the following attributes:

showIf this is set to true, the X-axis values and grid lines of this series will always be visible. By default, this is set to false.
event_startThe event will start from this point. The attribute value is a unique identifier of the event.
event_endThe event will end at this point. The attribute value is a unique identifier of the event.
event_text_colorThe color of the text in the event description.
event_descriptionWhen the viewer clicks on the event background, a balloon will appear, displaying this text.
event_colorThe color of the event background (hex color code).
event_alphaThe opacity of the event background (number between 0 and 100, where 0 is completely transparent and 100 is completely solid).

You can check this example of the event usage. Noticee the darker area on the plot area. This is an event, which lasted from 1980 to 1988. YOu can click on the event to get more info about it.

<value> of a <graph> can have the following attributes:

urlThe URL that will be opened when the viewer clicks on the bullet. You can also set the URL as a Javascript command. The URL is only used if the bullet attribute is set. Because of security restrictions set by the Adobe Flash Player, the URL will not be clickable if you view the chart from a file on your hard drive. It needs to be uploaded to a web server and then viewed through a browser for the URL to work correctly.
bulletThe shape of the bullet. The following values are available: square, round, square_outlined, round_outlined, filename.swf. The filename.swf is the name of Adobe Flash file – you can use a custom Flash file as a bullet. The Flash file must be placed in the folder specified as "path" in the HTML code snippet. Outlined bullets use the plot area color for the outline.
bullet_colorThe color of the bullet. This only affects predefined bullet shapes, not custom Flash bullets.
bullet_sizeThe size of the bullet. This only affects predefined bullet shapes, not custom Flash bullets.
descriptionThe text that will be displayed in a balloon when the viewer rolls over the bullet with the mouse cursor.
Back to top