High Chart Async drilldown

前端 未结 2 1884
一生所求
一生所求 2021-02-06 18:12

I am following http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/drilldown/async/ Link for making Drilldown chart.

2条回答
  •  遇见更好的自我
    2021-02-06 18:43

    Example for you: http://jsfiddle.net/S3j35/

    Use e.point.name to determine which point is clicked and which data you need from server. When AJAX comes, just add series with new data:

                drilldown: function (e) {
                    if (!e.seriesOptions) {
                        // e.point.name is info which bar was clicked
                        chart.showLoading('Simulating Ajax ...');
                        $.get("path/to/place.html?name=" + e.point.name, function(data) {
                            /***
                            where data is this format:
                            data = {
                                name: 'Cars',
                                data: [
                                    ['Toyota', 1],
                                    ['Volkswagen', 2],
                                    ['Opel', 5]
                                ]
                            }
                            ***/
                            chart.hideLoading();
                            chart.addSeriesAsDrilldown(e.point, data);
                        });
                    }
                }
    

提交回复
热议问题