admin管理员组文章数量:1434900
I am using Highcharts drilldown feature and change visualization type in each level of drilldown. I have an issue when I drillup from pie chart to columns type, the xAxis labels disapear (replaced by number values).
You can see an example in the following jsfiddle : /
When you click on "Safari" then drillup to "Browser", the xAxis values are correct but when you click on "Chrome" and drillup to "Browser", the xAxis values are replaced by numbers.
I tried to use the
chart:{
event:{
drillup: function(e) {
var chart = this;
chart.axes[0].update({type: "category"});
}
}
}
but it seems the "names" values are not correctly set in the xAxis.
Is there a way to fix that please ? Thanks
I am using Highcharts drilldown feature and change visualization type in each level of drilldown. I have an issue when I drillup from pie chart to columns type, the xAxis labels disapear (replaced by number values).
You can see an example in the following jsfiddle : https://jsfiddle/vegaelce/21ogcap9/
When you click on "Safari" then drillup to "Browser", the xAxis values are correct but when you click on "Chrome" and drillup to "Browser", the xAxis values are replaced by numbers.
I tried to use the
chart:{
event:{
drillup: function(e) {
var chart = this;
chart.axes[0].update({type: "category"});
}
}
}
but it seems the "names" values are not correctly set in the xAxis.
Is there a way to fix that please ? Thanks
Share Improve this question asked Nov 18, 2024 at 10:29 vegaelcevegaelce 1458 bronze badges1 Answer
Reset to default 1Inside of the drillup event, you can update the x-axis type to category and set correct categories by extracting names from the data points.
events: {
drillup: function(e) {
const categories = e.seriesOptions.data.map(data => data.name);
e.target.xAxis[0].update({
type: 'category',
categories
});
}
}
Demo: https://jsfiddle/BlackLabel/vufgc0x2/
You can also set the categories array explicitly on the x-axis, so that it will work correctly on the drillup regardless of the displayed chart type.
xAxis: {
type: "category",
categories: ['Chrome', 'Safari', 'Other']
}
Demo: https://jsfiddle/BlackLabel/mdw7tpxb/
本文标签: Highcharts drilldown column to pieaxis label issueStack Overflow
版权声明:本文标题:Highcharts drilldown column to pie, axis label issue - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745626098a2666979.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论