在 hplot R 的饼图中向下钻取

Drilldown in Pie Chart of hplot R

本文关键字:钻取 hplot      更新时间:2023-09-26

我想获得HighCharts提供的向下钻取功能,如此处所述,使用rCharts使用hplot库。此处提供的向下钻取函数的示例是

drill_function <- "#! function() {
    var drilldown = this.drilldown;
    function setChart(name, categories, data, color) {
        chart.xAxis[0].setCategories(categories, false);
        chart.series[0].remove(false);
        chart.addSeries({
            name: name,
            data: data,
            color: color || 'black'
        }, false);
        chart.redraw();
    };
    if (drilldown) { // drill down
        setChart(drilldown.name, drilldown.categories, drilldown.data, drilldown.color);
    } else { // restore
        setChart(name, categories, data);
    }
} !#"

我是 JavaScript 的新手,此实现中的任何帮助对我都非常有用

您可以使用highcharter包来暗示drilldown.js。您可以在此处查看演示:http://rpubs.com/jbkunst/highcarter-drilldown。

目前,我正在研究一种功能,以使制作这种类型的图表变得更加容易。