XML/JSON Attributes for Chart Border & Background | |||||||||||||||
Background refers to the entire background of the chart. |
|||||||||||||||
Customizing Background colors | |||||||||||||||
The background color of the chart is fully customizable. You can use either a solid or a gradient fill using the attributes below: |
|||||||||||||||
| |||||||||||||||
Example: <chart bgColor='999999,FFFFFF' bgAlpha='50' ...> |
|||||||||||||||
Customizing Chart Border | |||||||||||||||
You can also have a border around the chart. By default, the border is on in 2D charts and off in 3D Charts. Shown below is a chart with a border around the chart. The following attributes let you control the cosmetic properties of the chart border: |
|||||||||||||||
|
|||||||||||||||
Example: <chart ... showBorder='1' borderColor='FF0000' borderThickness='2' borderAlpha='50' ..> |
|||||||||||||||
Using gradient fill for background | |||||||||||||||
When using a gradient fill for the background, you can set the alpha and ratio in which colors are to be distributed, and the angle at which you want the gradient to be. The following attributes help you do the same: |
|||||||||||||||
|
|||||||||||||||
External Image or SWF File as Background | |||||||||||||||
You can also specify an external image (GIF,JPEG or PNG only) or a SWF file as the background of the chart, as shown below: |
|||||||||||||||
To do so, use the following attributes: |
|||||||||||||||
|
|||||||||||||||
Please note that due to security reasons Flash Player does not allow you to load cross-domain files or files having absolute path. Hence, your bgSWF files should be of the same domain as the chart and should load from relative paths. | |||||||||||||||
Setting background as transparent | |||||||||||||||
If you wish to set your chart background as transparent in the HTML page, you need to follow these steps:
<div id="chartdiv" align="center">The chart will appear within this DIV. This text will be replaced by the chart.</div> <script type="text/javascript"> var myChart = new FusionCharts("../FusionCharts/Column3D.swf", "myChartId", "900", "300", "0", "1"); myChart.setXMLUrl("Data.xml"); myChart.setTransparent(true); myChart.render("chartdiv"); </script> </div> Shown below is an example, where a 2D Column Chart has been embedded in an HTML page with background image. Also, the canvas has been made transparent to highlight the effect. |
|||||||||||||||
Applying effects to background | |||||||||||||||
You can also apply effects to background using STYLES. Shown below is an example where we've applied Bevel effect to the background: Data for this can be listed as under: <chart caption='Quarterly Sales Summary' subcaption='Figures in $' xAxisName='Quarter' yAxisName='Sales'> <set label='Quarter 1' value='420500' /> <set label='Quarter 2' value='295400' /> <set label='Quarter 3' value='523400' /> <set label='Quarter 4' value='465400' /> <styles> <definition> <style name='myBevel' type='Bevel'/> </definition> <application> <apply toObject='Background' styles='myBevel' /> </application> </styles> </chart> { "chart":{ "caption":"Quarterly Sales Summary", "subcaption":"Figures in $", "xaxisname":"Quarter", "yaxisname":"Sales" }, "data":[{ "label":"Quarter 1", "value":"420500" }, { "label":"Quarter 2", "value":"295400" }, { "label":"Quarter 3", "value":"523400" }, { "label":"Quarter 4", "value":"465400" } ], "styles":[{ "definition":[{ "style":[{ "name":"myBevel", "type":"Bevel" } ] } ], "application":[{ "apply":[{ "toobject":"Background", "styles":"myBevel" } ] } ] } ] } |
|||||||||||||||
Applying animation to background | |||||||||||||||
Using STYLES, you can also apply animation to background. For example, the data below creates a fade-in effect for the background. <chart caption='Quarterly Sales Summary' subcaption='Figures in $' xAxisName='Quarter' yAxisName='Sales'> <set label='Quarter 1' value='420500' /> <set label='Quarter 2' value='295400' /> <set label='Quarter 3' value='523400' /> <set label='Quarter 4' value='465400' /> <styles> <definition> <style name='myBgAnim' type='Animation' param='_alpha' start='0' duration='1'/> </definition> <application> <apply toObject='Background' styles='myBgAnim' /> </application> </styles> </chart> { "chart":{ "caption":"Quarterly Sales Summary", "subcaption":"Figures in $", "xaxisname":"Quarter", "yaxisname":"Sales" }, "data":[{ "label":"Quarter 1", "value":"420500" }, { "label":"Quarter 2", "value":"295400" }, { "label":"Quarter 3", "value":"523400" }, { "label":"Quarter 4", "value":"465400" } ], "styles":[{ "definition":[{ "style":[{ "name":"myBgAnim", "type":"Animation", "param":"_alpha", "start":"0", "duration":"1" } ] } ], "application":[{ "apply":[{ "toobject":"Background", "styles":"myBgAnim" } ] } ] } ] } |