HighCharts中是否有最大数量的x轴项目 [英] Is there a maximum number of x-Axis items in HighCharts

查看:303
本文介绍了HighCharts中是否有最大数量的x轴项目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用HighCharts进行3级深入分析.

I am using HighCharts to make a 3 level drilldown.

当我在第二级使用超过50个项目时,项目文本不再显示在左侧.单击第一个项目(父项1),然后您将看到第二个级别以及未显示的内容.

When I use over 50 items at the second level, the item text no longer displays on the left. Click on the first item (Parent 1) and then you will see the second level and what is not displaying.

这是由于我正在使用的JSON数据量造成的吗?

Is this due to the amount of JSON data I am using?

这是我用于图表的代码

let options = {
chart: {
    type: 'bar',
    events: {
        drilldown: function (e) {
            if (e.seriesOptions) {
                e.seriesOptions.hiddenValue = e.point.options.hiddenValue;
            }
        }
  }
},
title: {
    text: 'Overall Status'
},
xAxis: {
    type: 'category',
    labels: {
        style: {
            fontSize: '15px'
        }
    }
},
yAxis: {
    title:{
            text: "Percentage Complete"
        },
    labels: {
        style: {
            fontSize: '15px'
        }
    }
},

legend: {
    enabled: false
},

plotOptions: {
    series: {
        borderWidth: 0,
        dataLabels: {
            enabled: true,
            style: {
                fontSize: '20px'
            }
        },
        cursor: 'pointer',
        point: {
            events: {
                click: function () {
                    let seriesOptions = this.series && this.series.options;
                    let hiddenValue = seriesOptions && seriesOptions.hiddenValue;
                    if(this.options && this.options.url) {
                        location.href = this.options.url + '?id=' + hiddenValue;
                    }
                }
            }
        }
    }
},
series: [{
    name: 'Status',
    colorByPoint: true
}],
drilldown: {
}
};

我这里有一个带有JSON数据的小提琴. https://jsfiddle.net/mark2017/yb3y9dt9/

I have a fiddle here that has the JSON data. https://jsfiddle.net/mark2017/yb3y9dt9/

推荐答案

您可以看到,第一次向下钻取不是从0值开始,而是从10开始-就像它将计算顶级系列中的所有值一样.这是一个已在github上报告的错误:深入到50多个-跳过类别名称

You can see that the first drilldown does not start from 0 value, instead it starts from 10 - like it would count in all the values from the top level series. It is a bug which was already reported on github: Drilldown to more than 50 - skip categories name

在您的情况下,将cropTreshold设置为大于所有点数的数字似乎可行-必须针对所有系列进行设置,例如在plotOptions.series

Setting cropTreshold to a number bigger than the number of all your points seems to work in your case - it must be set for all series, e.g. in plotOptions.series

plotOptions: {
  series: {
    cropThreshold: 2000,
    borderWidth: 0,

示例: https://jsfiddle.net/hfpofx28/

这篇关于HighCharts中是否有最大数量的x轴项目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆