首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在高图集中删除TickInterval上的drillDown

在高图集中删除TickInterval上的drillDown
EN

Stack Overflow用户
提问于 2020-01-29 22:38:59
回答 1查看 110关注 0票数 0

我所面临的问题是在钻取时,刻度间隔标签仍然存在于轴上,在钻取时,我需要我的tickInterval为0.5,但在向下钻取时,我不希望有任何刻度间隔,这样它们就不会在x轴上显示,

正如所看到的间隔为0.5,但现在当我向下钻8.5,它显示在下面,并且间隔标签仍然存在

下面是我的代码

代码语言:javascript
复制
Highcharts.chart('container', {
    chart: {
        type: 'column',
       events : {
                        drilldown : function(e) {
                            this.xAxis[0].setTitle({
                                text : 'MilestoneTypeId'
                            });

              this.xAxis[0].tickmarkPlacement = 'off'
              this.setTitle({ text: "Error Distribution by Milestone" });
                        },
                        drillup : function(e) {
                            this.xAxis[0].setTitle({
                                text : 'Mean Absolute Error (in days)'
                            });
              this.xAxis[0].tickmarkPlacement = 'on'
              this.setTitle({ text: "Error Distribution in Days" });
                        }
                    }
    }, 

    title: {
        text: 'Error Distribution (Days)'
    },
   xAxis : {
                    title : {
                        text : 'Mean Absolute Error (in days)'
                    },
                    type: 'category',
                    tickInterval : 0.50,
                    crosshair : true
                },
                yAxis : {
                    title : {
                        text : 'Predicted Milestone Count'
                    }
                },


    tooltip : {
                    headerFormat : '',
                    shared : true,
                    pointFormat : 'Predicted Milestone Count : {point.y}'

                },

    series: [
        {
            name: "Error Distribution by Days Report",
            data: [

   {
      "x":1.5,
      "y":1000,
      "drilldown":"1.5",
      "name":1.5
   },
   {
      "x":2,
      "y":500,
      "drilldown":"2",
      "name":2
   },
   {
      "x":2.5,
      "y":500,
      "drilldown":"2.5",
      "name":2.5
   },
   {
      "x":3.5,
      "y":500,
      "drilldown":"3.5",
      "name":3.5
   },
   {
      "x":4,
      "y":500,
      "drilldown":"4",
      "name":4
   },
   {
      "x":5,
      "y":500,
      "drilldown":"5",
      "name":5
   },
   {
      "x":6,
      "y":500,
      "drilldown":"6",
      "name":6
   },
   {
      "x":8.5,
      "y":1000,
      "drilldown":"8.5",
      "name":8.5
   },
   {
      "x":9,
      "y":500,
      "drilldown":"9",
      "name":9
   },
   {
      "x":10,
      "y":3508,
      "drilldown":"10",
      "name":"More"
   }

            ]
        }
    ],
    drilldown: {
        series:[
   {
      "name":"2",
      "id":"2",
      "pointWidth":30,
      "data":[
         [
            "Event33",
            500
         ]
      ]
   },
   {
      "name":"4",
      "id":"4",
      "pointWidth":30,
      "data":[
         [
            "Event42",
            500
         ]
      ]
   },
   {
      "name":"5",
      "id":"5",
      "pointWidth":30,
      "data":[
         [
            "Event11",
            500
         ]
      ]
   },
   {
      "name":"6",
      "id":"6",
      "pointWidth":30,
      "data":[
         [
            "Event1",
            500
         ]
      ]
   },
   {
      "name":"9",
      "id":"9",
      "pointWidth":30,
      "data":[
         [
            "Event23",
            500
         ]
      ]
   },
   {
      "name":"10",
      "id":"10",
      "pointWidth":30,
      "data":[
         [
            "Event24",
            501
         ],
         [
            "Event14",
            1001
         ],
         [
            "Event2",
            1
         ],
         [
            "Event3",
            1001
         ],
         [
            "Event10",
            1
         ],
         [
            "Event8",
            1001
         ],
         [
            "Event1",
            1
         ],
         [
            "Event5",
            1
         ]
      ]
   },
   {
      "name":"1.5",
      "id":"1.5",
      "pointWidth":30,
      "data":[
         [
            "Event6",
            500
         ],
         [
            "Event5",
            500
         ]
      ]
   },
   {
      "name":"2.5",
      "id":"2.5",
      "pointWidth":30,
      "data":[
         [
            "Event4",
            500
         ]
      ]
   },
   {
      "name":"3.5",
      "id":"3.5",
      "pointWidth":30,
      "data":[
         [
            "Event3",
            500
         ]
      ]
   },
   {
      "name":"8.5",
      "id":"8.5",
      "pointWidth":30,
      "data":[
         [
            "Event2",
            500
         ],
         [
            "Event1",
            500
         ]
      ]
   }
]

    }
});

这是我的小提琴链接https://jsfiddle.net/L0mgdwc4/

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-01-30 11:15:20

您可以使用xAxis.update特性在钻取事件触发时禁用tickInterval,并使用相同的特性在钻取时启用。

演示:https://jsfiddle.net/BlackLabel/zex8jfah/

代码语言:javascript
复制
  events: {
    drilldown: function(e) {
      this.xAxis[0].setTitle({
        text: 'MilestoneTypeId'
      });

      this.xAxis[0].tickmarkPlacement = 'off'
      this.setTitle({
        text: "Error Distribution by Milestone"
      });

      this.xAxis[0].update({
              tickInterval: 0,
      })
    },
    drillup: function(e) {
      this.xAxis[0].setTitle({
        text: 'Mean Absolute Error (in days)'
      });
      this.xAxis[0].tickmarkPlacement = 'on'
      this.setTitle({
        text: "Error Distribution in Days"
      });

      this.xAxis[0].update({
              tickInterval: 0.5,
      })
    }
  }

API:https://api.highcharts.com/class-reference/Highcharts.Axis#update

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/59976651

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档