Highcharts 3.08向下钻取多个父系列 [英] Highcharts 3.08 drilldown with multiple parent series

查看:104
本文介绍了Highcharts 3.08向下钻取多个父系列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Highcharts制作我的第一个向下钻取图表,并且我刚安装了3.09版本,其中向下钻取具有内置支持。深入图表将成为已包含多个图表的页面的一部分。所有图表都有3个系列(州,地区,子区域),数据动态填充。

I am making my first drilldown charts with Highcharts, and I just installed version 3.09, in which drilldown has built-in support. The drilldown chart will be part of a page that already contains multiple charts. All charts have 3 series (State, Region, Sub-region) with data populated dynamically.

问题是下钻模块似乎不支持多个父级系列。就我而言,如果我点击某个特定系列的列(例如State),那么State系列将消失,并且其下钻将出现,但其他系列(区域,子区域)仍然显示,并且图形不会显示那么没有任何意义。看到这个jsFiddle: http://jsfiddle.net/jmunger/6bBzt/

The problem is that the drilldown module doesn't seem to support multiple parent series. In my case, if I click on a column for a specific series (say, State), then the State series will disappear and its drilldown will appear, but the other series (Region, Sub-region) are still displayed and the graphic doesn't make any sense then. See this jsFiddle: http://jsfiddle.net/jmunger/6bBzt/ .

$(function () {
        $('#container').highcharts({
            chart: {
                type: 'column'
            },
            title: {
                text: 'Monthly Average Rainfall'
            },
            subtitle: {
                text: 'Source: WorldClimate.com'
            },
            xAxis: {
                categories: [
                    'CAT 1',
                    'CAT2'
                ]
            },
            yAxis: {
                min: 0,
                title: {
                    text: 'Rainfall (mm)'
                }
            },
            tooltip: {
                headerFormat: '<span style="font-size:10px">{point.key}</span><table>',
                pointFormat: '<tr><td style="color:{series.color};padding:0">{series.name}: </td>' +
                    '<td style="padding:0"><b>{point.y:.1f} mm</b></td></tr>',
                footerFormat: '</table>',
                shared: true,
                useHTML: true
            },
            plotOptions: {
                column: {
                    pointPadding: 0.2,
                    borderWidth: 0
                }
            },
            series: [{
                name: 'Tokyo',
                data: [{y:49.9, drilldown:'tokyo 1'}, {y:71.5, drilldown:'tokyo 2'}]

            }, {
                name: 'New York',
                data: [{y:49.9, drilldown:'ny 1'}, {y:71.5, drilldown:'ny 2'}]

            }],
            drilldown:{
                series: [{
                    id: 'tokyo 1',
                    data: [{y:39.9, name:'name1'}, {y:31.5, name:'name2'}]

                }, {
                    id: 'tokyo 2',
                    data: [{y:39.9, name:'name1'}, {y:31.5, name:'name2'}]

                },
                {
                    id: 'ny 1',
                    data: [{y:39.9, name:'name1'}, {y:31.5, name:'name2'}]

                }, {
                    id: 'ny 2',
                    data: [{y:39.9, name:'name1'}, {y:31.5, name:'name2'}]

                }]
              }
        });
    });

我如何确保所有父级系列在执行向下钻取时都处于隐藏状态,并且它们是然后在我钻取时正确恢复?

How can I make sure that all parent series are hidden when I perform a drilldown, and that they are then restored correctly when I drill up?

推荐答案

3.0.8和3.0.9版本的向下钻取是bug。它已经固定在master分支上,请参阅: http://jsfiddle.net/6bBzt/1/

It's bug in 3.0.8 and 3.0.9 version of drilldown. It's already fixed on master branch, see: http://jsfiddle.net/6bBzt/1/

<script src="http://github.highcharts.com/highcharts.js"></script>
<script src="http://github.highcharts.com/modules/exporting.js"></script>
<script src="http://github.highcharts.com/modules/drilldown.js"></script>

这篇关于Highcharts 3.08向下钻取多个父系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆