【问题标题】:redraw funnel chart in highchart when a segment is removed?删除段时在highchart中重绘漏斗图?
【发布时间】:2014-04-03 03:41:16
【问题描述】:

当一个段被删除时,有没有办法像饼图一样重绘漏斗图?

类似于这个问题redraw pie chart in highchart

http://jsfiddle.net/2Me2z/

 $(function () {
        var chart = new Highcharts.Chart({
            chart: {
                renderTo: 'container',
                type: 'pie'
            },

            plotOptions: {
                pie: {
                    showInLegend: true
                }
            },

            legend: {
                enabled: true
            },

            series: [{
                data: [20, 30, 30, 20]        
            }]
        });

        // button handler
        $('#button').click(function() {
            var series = chart.series[0];
            if (series.data.length) {
                chart.series[0].data[0].remove(); 
            }
        });
    });

所以点击图例中的任意切片都会导致图表重绘,剩余的切片会占满100%

想知道是否可以为漏斗图做同样的事情

http://jsfiddle.net/YUL5c/2/

  $(function () {
        var chart;

        $(document).ready(function () {

            // Build the chart
            $('#container').highcharts({
                chart: {
                     type: 'funnel',
                    plotBackgroundColor: null,
                    plotBorderWidth: null,
                    plotShadow: false
                },
                title: {
                    text: 'Browser market shares at a specific website, 2010'
                },
                tooltip: {
                    pointFormat: '{series.name}: <b>{point.percentage:.1f}%</b>'
                },
                plotOptions: {
                    series: {
                        allowPointSelect: true,
                        cursor: 'pointer',
                        dataLabels: {
                            enabled: false
                        },
                        showInLegend: true
                    }
                },
                series: [{

                    name: 'Browser share',
                    data: [
                        ['Firefox',   45.0],
                        ['IE',       26.8],
                        {
                            name: 'Chrome',
                            y: 12.8,
                            sliced: true,
                            selected: true
                        },
                        ['Safari',    8.5],
                        ['Opera',     6.2],
                        ['Others',   0.01]
                    ]
                }]
            });
        });

    });


Currently the segment just disaapear. But the chart does not redraw 

【问题讨论】:

    标签: charts highcharts


    【解决方案1】:

    很遗憾,不支持此动画,但我建议您在uservoice website 上发布您的请求

    【讨论】:

      【解决方案2】:

      point.visible 标志在漏斗代码中被忽略。 如果将检查添加回绘图逻辑,事情就会神奇地起作用。即使是动画。 不确定这是一个错误还是故意忽略了

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2021-03-31
        • 1970-01-01
        • 1970-01-01
        • 2021-07-28
        • 1970-01-01
        相关资源
        最近更新 更多