Setting backgrounds for charts |
FusionCharts allows you to easily set a background image/movie for your chart. You can use this option to embed background images (GIF, JPEG or PNG), other SWF Files, or data tables (in image format) as your chart background. To embed an image, all you need to do is set bgSWF property of <chart> element as shown below. You can also dynamically change the transparency of the loaded image using bgSWFAlpha property, which accepts a value between 0 and 100. |
<chart caption='Sales Figures' labelDisplay='NONE' bgSWF='ChartBg.jpg' canvasBgAlpha='30' canvasBorderColor='333333' canvasBorderThickness='0' divLineColor='333333'> <set label='John' value='420' /> <set label='Mary' value='295' /> <set label='Tom' value='523' /> <styles> <definition> <style name='myFont' type='font' isHTML='1' bold='1' size='11' color='FFFFFF' /> <style name='myShadow' type='shadow' color='333333' angle='45' strength='3'/> </definition> <application> <apply toObject='YAxisValues' styles='myFont,myShadow' /> <apply toObject='DataLabels' styles='myFont,myShadow' /> <apply toObject='DataValues' styles='myFont,myShadow' /> <apply toObject='Caption' styles='myFont,myShadow' /> </application> </styles> </chart> |
In the above code, we're:
When you view this chart (with the background image), you'll get something as under: |
![]() |
Simple and effective - isn't it? For best results, you need to make sure that the background image and your chart have the same dimensions (width and height). Else, the loaded image would align at top left of the chart. |