We're trying to convert our cfcharts to use ZingChart JSON styling, as we'd like to upgrade to CF11 which wrecked all our charts.
I'm currently trying to set up the legend for a bar chart. Previously we were using this xml styling code in the cfchart to include the label and the total for each bar in the legend:
<legend><![CDATA[$(rowlabel) Total:$(colTotal)]]></legend>
In my example, the bars represent years, so an example of a legend item would be "2013 Total:34".
How can I accomplish this using ZingCharts? My legend code so far looks something like this:
"legend":{
"backgroundColor":"#bdc3c7",
"alpha":1,
"borderWidth":0,
"shadow":false,
"borderRadius":10,
"header":{
"text":"Years",
"borderRadius":10
}
}
The legend text actually comes from the text
attribute in the series
object.
To get the total value of your series, you can use the %psum
token. Here's a live demo using the legend code you provided. Right-click and select "View Source" to see the JSON.
There are quite a few tokens at your disposal, and you can even make your own.
I'm on the ZingChart team and we're here to help if you have any additional questions while converting your charts!