对不起,英语不好。我想在画布图表上向下钻取,没有特定的顺序,表示国家(地区)有省,省(地区)和城市(地区)。如果我想直接从一个国家到另一个城市,那怎么可能?实际上,根据我的研发工作依次进行挖掘工作,但我的要求是其他要求。
它已经按顺序工作了,但是公司的要求还不一样。公司说他不想遵循特定的顺序。他们说这应该是通用的
我已经按顺序执行了向下钻取
这是演示代码,仅供参考 https://jsfiddle.net/canvasjs/03zsrLc8/
chart = new CanvasJS.Chart("chartContainer", {
title: {
text: "Drill down stacked column chart"
},
toolTip: {
enabled: false
},
axisX: {
title: "click on stacked columns to see drill down, Click again to go back"
},
});
var data = [{
type: "stackedColumn100",
click: onClick,
dataPoints: [{
label: "Jan",
y: 55.58
},
{
label: "Feb",
y: 20.09
}
]
},
{
type: "stackedColumn100",
click: onClick,
dataPoints: [{
label: "Jan",
y: 50.58
},
{
label: "Feb",
y: 30.09
}
]
}
];
chart.options.data = data;
chart.render();
var data_Jan = [{
type: "column",
click: onCoulmnClick,
dataPoints: [{
label: "Jan 2012",
y: 6.21
},
{
label: "Jan 2013",
y: 1.93
}
]
}];
var data_Feb = [{
type: "column",
click: onCoulmnClick,
dataPoints: [{
label: "Feb 2012",
y: 0.42
},
{
label: "Feb 2013",
y: 0.41
},
{
label: "Feb 2014",
y: 0.60
}
]
}];
function onClick(e) {
if (e.dataPoint.label === "Jan") {
chart.options.data = data_Jan;
chart.render();
} else {
chart.options.data = data_Feb;
chart.render();
}
}
function onCoulmnClick() {
chart.options.data = data;
chart.render();
}
<script src="https://canvasjs.com/assets/script/canvasjs.min.js"></script>
<div id="chartContainer" style="height: 300px; width: 100%;"></div>
我已经按顺序工作了,但是公司的要求还不一样。公司说他不想遵循特定的顺序。他们说应该是通用的