3

I want to make my fusionchart pie chart responsive, so I follow some guide here : http://docs.fusioncharts.com/charts/contents/FirstChart/ChangeSize.html I follow the instructions in the 'Dynamic resize feature of charts' section.

But when the page loaded, my chart flatten out (no height). my chart flatten

When I resize the browser, the chart size was sucessfully responsive, but I get a very small pie chart very small pie

Why was my chart flatten when the page first load? (I have to resize the browser first to see the chart). And why I get a very small chart?

Here's my code

<body style="height:100%;">
<div class="container-fluid">
    <div class="row-fluid">
        <div class="col-md-12">
            <div id="chartContainer" style="height:100%;">
                FusionCharts XT will load here!
            </div>
        </div>
    </div>
</div>

<script type="text/javascript">
    FusionCharts.ready(function(){
        var myChart = new FusionCharts({
            "type": "pie2d",
            "dataFormat": "jsonurl",
            "dataSource": "pie.json",
            "width": "100%",
            "height": "100%"
        });
        myChart.render("chartContainer");
    });
</script>

And here's my pie.json :

{
"chart":{
    "caption":"Rasio Pendapatan Aeronautika & Non-Aeronautika",
    "subCaption":"Januari-Juni 2014",
    "paletteColors":"#008ee4,#6baa01,#f8bd19,#e44a00,#33bdda",
    "bgAlpha":"0",
    "borderAlpha":"20",
    "use3DLighting":"0",
    "showShadow":"0",
    "enableSmartLabels":"0",
    "startingAngle":"0",
    "showPercentValues":"1",
    "showPercentInTooltip":"0",
    "decimals":"3"},
    "data":
    [
            {
                "label":"Non-Aeronautika",
                "value":"534.973.345.227\r",
                "link":"newchart-jsonurl-naero.json"
            },
            {
                "label":"Aeronautika",
                "value":"960.429.586.179\r",
                "link":"newchart-jsonurl-aero.json"
            }
    ]

}

Could you point my mistake?

Thanks for your attention, your help will be much appreciated..

2 Answers 2

3

Using AngularJS and Bootstrap.

In my HTML, I changed width="300" to width="100%" This made my doughnut chart responsive:

HTML:

<div class="row" data-ng-controller="VariableInvestmentSummaryCtrl">
    <div class="col-md-4">
        <div fusioncharts
            width="100%"
            height="300"
            type="doughnut2d"
            dataSource="{{myDataSource}}" >
        </div>
    </div>
    <div class="col-md-8 datagrid-wrapper investments"></div>
</div>

JSON:

$scope.myDataSource = {
        'chart': {
            'numberPrefix': '%',
            'theme': 'fint',
            'bgColor': '#DDDDDD',
            'bgAlpha': '0'
        },
        'data':[{
            'showLabel': '0',
            'label': 'Some Name',
            'showValue': '0',
            'value': '25'
        },
        {   
            'showLabel': '0',
            'label': 'Garden Groove harbour',
            'showValue': '0',
            'value': '50'
        },
        {   
            'showLabel': '0',
            'label': 'Los Angeles Topanga',
            'showValue': '0',
            'value': '10'
        },
        {   
            'showLabel': '0',
            'label': 'Compton-Rancho Dom',
            'showValue': '0',
            'value': '10'
        },
        {   
            'showLabel': '0',
            'label': 'Daly City Serramonte',
            'showValue': '0',
            'value': '5',
            'color': '#FE0000'
        }]
    };
0

Is this issue in specific to any browser? Works in Chrome/FireFox

Please find the DropBox link: https://dl.dropboxusercontent.com/u/44972996/pie.rar

1
  • your code works perfectly, but could you please point where's my mistake?
    – caesardo
    Jun 26, 2014 at 6:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.