kamaci
kamaci

Reputation: 75257

Dynamically Adding A Chart into A Combo Highcharts?

I have implemented that example: http://www.highcharts.com/demo/combo without pie chart. I want to add it dynamically after a time later. How can I add a chart into a combo chart dynamically at HighCharts?

Upvotes: 1

Views: 468

Answers (2)

Ruchit Rami
Ruchit Rami

Reputation: 2282

You can use charts.push as shown in this url http://calibrate.be/labs/exporting-highcharts-js-pdf-docx-tcpdf-and-phpword

Let me know if you can't have this to work.

EDIT: You will need to define charts as var charts = []; as global variable. And this has not been tested by me.

Upvotes: 0

Ricardo Lohmann
Ricardo Lohmann

Reputation: 26320

If you look the demo you will see that the pie chart isn't a chart, it's just a serie.
So, to add a serie you have to use addSeries passing thrue parameter all the pie serie, like the following.

    chart.addSeries({
        type: 'pie',
        name: 'Total consumption',
        data: [{
            name: 'Jane',
            y: 13,
            color: '#4572A7' // Jane's color
            },
        {
            name: 'John',
            y: 23,
            color: '#AA4643' // John's color
            },
        {
            name: 'Joe',
            y: 19,
            color: '#89A54E' // Joe's color
            }],
        center: [100, 80],
        size: 100,
        showInLegend: false,
        dataLabels: {
            enabled: false
        }
    });

DEMO

Upvotes: 1

Related Questions