【问题标题】:Is is possible to have a stacked bar chart in Am Charts with Drill Down option?是否可以在带有向下钻取选项的 Am Charts 中使用堆积条形图?
【发布时间】:2016-05-02 13:40:47
【问题描述】:

我想实现 StackedBar 图表,并且我想进一步向下钻取一列到条形图中。 例如:一列代表一个国家,在一个国家下我们可能有许多州(堆叠)。如果我单击任何国家/地区列,那么它应该进一步深入到条形图,其中每个条形代表一个州。 所以场景就像从“堆积条形图”到“条形图”

AM Charts 可以吗? 我无法在文档中找到它。

【问题讨论】:

    标签: charts amcharts stacked-chart


    【解决方案1】:

    首先生成堆积条形图。现在调用 chart.addListener 方法。当我们单击任何条时,将调用此方法。通过使用“event.index”,我们可以获得点击 BAR 的 INDEX。现在通过传递列索引参数调用一个单独的函数。该新功能将有以下事情要做。 1.隐藏堆积条形图 2. 显示新的条形图(使用参数INDEX为下钻图生成数据)。

    chart.addListener("clickGraphItem", function (event) {                        
             //Take the Index of Bar chart which has been clicked(eg: 0,1 2 etc..)
             //Call a function with column INDEX parameter
             //console.log(event.index); >> this will give index of chart 
             $scope.DrillChart(event.index);
        });
    
    $scope.DrillChart =function(colid){
       //hide stack bar chart
       //Show simple bar chart
       //get the data for "colid"
       //Generate the Simple Bar Chart
    
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-02-17
      • 1970-01-01
      • 1970-01-01
      • 2023-04-07
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多