Sign in to follow this  
bxlbjorn

Update chart attributes BEFORE rendering

Recommended Posts

Hi,

 

I have a number of piecharts whose sources are in seperate xml files and loaded via the FusionCharts method.

 

I.e.

                                            var myChart = new FusionCharts(            
                                            {swfUrl:"Pie2D.swf",
                                                id : "FusionCharts_1",
                                                width: 450,
                                                height: 300,
                                                renderAt: "chartdiv",
                                                dataSource : "data/Overv_T1_Executed_payments_en.xml",
                                                dataFormat: 'xmlurl'                                                
                                            })

 

I also have a Javascript JSON object "piechartSettings" containing some settings that I wish to apply to each and every pie chart.

 

var piechartSettings = {
    baseFontSize : 11,
    baseFont:'Verdana',
    bgColor: 'Transparent',
    bgAlpha: 0,
    showBorder:0,
    use3dlighting: "0",
    showshadow: "0",
    manageLabelOverflow: 1,
    showLegend: 1,
    showLabels:0,
    chartType:"pie",
    chartDim:"2D"  
}

 

How can I update the chart data with this JSON object BEFORE the chart renders, so that all my charts have the same look and fell without having to resort to adding these parameters to each and every single xml file.

 

I have tried setChartAttribute method, both before and after the render() method, but this does not result in anything.

I have also tried it using the "Loaded" event, but this stilml results in a short flash rendering of the previous chart style:

 

                                             myChart.addEventListener('Loaded',function(eventObject,argumentsObject ){
                                                       myChart.setChartAttribute(piechartSettings)
                                            })

 

 

Does anyone have any experience doing this?

A simple and effective way of controlling all charts look and feels with a single object?

 

Thanks in advance,

 

Björn (Belgium)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this