Preparing Data for Bar Chart
Data Table
As it was said in Dashboard Creation Tutorial we have the beer brands popularity chart, as follows:
Brand | Pints Sold |
---|---|
Duff Original | 279 450 |
Bud Light | 249 028 |
Budweiser | 186 467 |
Coors Light | 181 084 |
Miller Lite | 170 815 |
Busch | 109 512 |
Michelob Light | 79 234 |
Other | 67 913 |
Converting to XML
Now we need to convert this data table into XML, this format will be accepted by AnyChart. In terms of AnyChart data model we have one series of data with categories that hold beer brands names. Each point in series represents one brand and its sales amount in pints. Converted XML Data looks like:
As you can see, we've created one <series> node, specified its type="Bar", added several <point> nodes and set name attribute that defines bar category and y attribute that defines bar value.
Additional Chart Settings
All we need to do to finalize bar chart XML creation is to define plot_type="CategorizedHorizontal" in <chart> node and add axes titles. Here it is - AnyChart can now visualize data.
Look at the chart sample below and click on on it to see Live Flash Chart preview and full configured XML.
Get Back to Dashboard Creation Tutorial.