XML Methods > Attributes by Chart Elements |
In this part, the graph attributes have been classified based on the different chart elements. We'll show you how to control and manipulate the various aspects of the graph. Setting chart background, canvas, grid background Similarly, to change the canvas color and grid background color, use
the following: Now, to hide the grid background/canvas, you could use the following: Setting graph caption, sub caption, x-axis label,
y-axis label, y-axis upper limit, y-axis lower limit, number Prefix, number
Suffix and number Formatting option Similarly, you could provide the x-axis label and y-axis label using xAxisName and yAxisName attributes. In case you don't want to show the x-axis and y-axis names, you could
use the following: To set the y-axis upper and lower limit, yAxisMinValue
and yAxisMaxValue attributes are used in
the following way: In case you don't want to show the y-Axis limit textboxes (which appear
beside the graph grid), you could use the showYLimits
attribute to hide them as below: To set the number of places of decimals for all the numbers on the chart,
you can use decimalPrecision attribute: Now, if you want to format numbers present on your graph, you can use
the formatNumber attribute in the following
way: If you want to format the scale of numbers present on your graph, you
can use the formatNumberScale attribute
in the following way: Similarly if you wanted to add some textual suffix/prefix to the numbers
present on the graph, you can use the numberPrefix
and numberSuffix attributes in the following
way: You could also use both numberPrefix and
numberSuffix at the same time to format
numbers. For example: If you want to change the decimal separator characters and thousands
separator of all the numbers on the chart, you can use decimalSeparator
and thousandSeparator attributes as under: Setting data names, data values <set name='Jan' value='21345' alpha='70' link='ShowDetails.asp?Mon=Jan' showName='1'> Here, “Jan” is the set name which would appear as the x-axis name for the data set. “70” is the x-axis value for the same. The data set would have a transparent look as it's alpha is 70. It will also support drill-down as we have specified the link as “ShowDetails.asp?Mon=Jan”. Here, we have also provided another attribute showName='1'
which sets the configuration of whether the x-axis name for this
particular data set would be shown on the graph. For example, if you have
to plot a number of data sets on the graph (let's say daily hits for a
site), then it would be wise to show only the following data set names
(daily dates) to maintain the legibility of the graph- otherwise it would
become too clustered. The image below depicts such a graph: |
And, the XML data for the above graph would be as under: |
<graph animation='0' bgcolor='ffffff' xaxisname='' yaxisname='Hits'
caption=' Daily hits of abc.com for the month of March, 2002' subcaption='
(in thousands)' yaxisminvalue='0' yaxismaxvalue='50000' showhovercap='1'
showgridbg='0' shownames='1' showvalues='0' numdivlines='4' canvasbgcolor='ACBB99'
gridbgcolor='DEDEBE' hovercapbg='DEDEBE' hovercapborder='889E6D' divlinecolor='889E6D'
showcanvas='0' bgSWF='Column2d2Skin.swf'> <set name='1' value='34334' color='123456' showName='1'/> <set name='2' value='23166' color='33FF66' showName='0'/> <set name='3' value='34375' color='FF6600' showName='0'/> <set name='4' value='32360' color='3399FF' showName='0'/> <set name='5' value='45280' color='009966' showName='1'/> <set name='6' value='23478' color='CC3399' showName='0'/> <set name='7' value='34367' color='FFCC33' showName='0'/> <set name='8' value='12481' color='6699CC' showName='0'/> <set name='9' value='3498' color='CC3366' showName='0'/> <set name='10' value='36480' color='009966' showName='1'/> <set name='11' value='7634' color='123456' showName='0'/> <set name='12' value='24566' color='33FF66' showName='0'/> <set name='13' value='34675' color='FF6600' showName='0'/> <set name='14' value='12560' color='3399FF' showName='0'/> <set name='15' value='43380' color='009966' showName='1'/> <set name='16' value='42178' color='CC3399' showName='0'/> <set name='17' value='2367' color='FFCC33' showName='0'/> <set name='18' value='43381' color='6699CC' showName='0'/> <set name='19' value='23598' color='CC3366' showName='0'/> <set name='20' value='5480' color='009966' showName='1'/> <set name='21' value='12334' color='123456' showName='0'/> <set name='22' value='34266' color='33FF66' showName='0'/> <set name='23' value='3275' color='FF6600' showName='0'/> <set name='24' value='12460' color='3399FF' showName='0'/> <set name='25' value='43280' color='009966' showName='1'/> <set name='26' value='12478' color='CC3399' showName='0'/> <set name='27' value='5467' color='FFCC33' showName='0'/> <set name='28' value='23481' color='6699CC' showName='0'/> <set name='29' value='34298' color='CC3366' showName='0'/> <set name='30' value='12480' color='009966' showName='0'/> <set name='31' value='34367' color='FFCC33' showName='1'/> </graph> |
Notice the showName attribute specified for each <set>
element. Similarly, you could opt to hide all the data values of the graph using showValues attribute of the <graph> element: <graph showValues='0' …> Similarly, showNames attribute could be used to hide all the data x-axis
name: <graph showNames='0' …> |
Setting grid divisional Lines, vertical Divisional Lines, Trend lines, zero Plane Grid divisional lines can help add context to the data points. You can use the numDivLines attribute of the <graph> element to specify how many horizontal div lines you would like to have on the graph. To change the color of horizontal div lines, divLineColor attribute has to be used and to change the thickness divLineThickness attribute is used. Example: <graph numDivLines='5' divLineThickness='2' divLineColor='FF1234' …> Similarly, in the case of line and pipe chart, you can also add vertical
divisional lines as under: Trend-lines are helpful when you want to distinguish a specific set of
data from a base value or some calculated values. For example, if you
were to plot a graph depicting the profit figures from 4 products, you
could draw a trend-line to illustrate the profit from those products in
the last financial year – thus it becomes easy to interpret the
growth/decline of product value as compared to the last year figures.
Trend-lines can be drawn using <trendlines>
element as under: You can also present a trend zone by enhancing the trend line thickness, make it transparent also by specifying alpha values. Zero planes are the planes/lines that becomes the base line of the chart
when the chart contains both positive and negative values. There are a
few parameters that you could use to control the zero plane: zeroPlaneColor
and zeroPlaneAlpha. Setting the hover Caption Box Similarly, if you wish to hide it, just set this attribute to 0. The hover caption box has a few customizable properties which you could
use to customize its appearance. The data name and the data value shown in the hover caption box is separated
by a character known as hover caption separator character. You could change
this character by assigning a new character (/set of characters) to the
hovercapSepChar attribute of the <graph> element as under: Setting the Legend Box, Navigation Buttons, Anchors In case of line chart, you could change the anchor properties as under: |