使minPointLenght应用于堆积柱形图中的所有块

问题描述 投票:0回答:1

我们正在使用minPointLength属性来使值为0的点显示在堆积的柱状图中。问题是现在显示的点值为4(屏幕快照中从左数第三列)小于最小高度。在下面的屏幕截图中,将鼠标悬停在值为4的非常小的块上,并以红色显示具有0的块。

Chart with block smaller than minPointLength

我希望值大于0的块也大于值0或至少相同高度的块。

我们的总体目标是为所有块设置最小高度,以便可以显示所有框标签。

这里是一个玩弄的小提琴:https://jsfiddle.net/ftmkxdbo/

这是我们图表的配置:

Highcharts.chart('container', {
  "chart": {
    "type": "column"
  },
  "title": {
    "text": ""
  },
  "credits": {
    "enabled": false
  },
  "xAxis": {
    "categories": ["10/17", "10/18", "10/19", "10/20"]
  },
  "yAxis": {
    "title": {
      "text": ""
    },
    "stackLabels": {
      "enabled": true,
      "style": {
        "color": "gray"
      }
    },
    "min": 0,
  },
  "legend": {
    "enabled": false
  },
  "plotOptions": {
    "column": {
      "stacking": "normal",
      "dataLabels": {
        "enabled": true,
        "style": {
          "fontSize": "10px",
          "fontWeight": "normal",
          "textShadow": "0px"
        },
      },
      "minPointLength": 5,
    }
  },
  "series": [{
    "name": "3",
    "data": [{
      "x": 0,
      "y": 3,
    }],
    "index": 0,
    "color": "rgba(120,185,40,0.8)"
  }, {
    "name": "12",
    "data": [{
      "x": 0,
      "y": 12,
    }],
    "index": 1,
    "color": "rgba(245,155,0,0.8)"
  }, {
    "name": "19",
    "data": [{
      "x": 0,
      "y": 19,
    }],
    "index": 2,
    "color": "rgba(120,185,40,0.8)"
  }, {
    "name": "13",
    "data": [{
      "x": 0,
      "y": 13,
    }],
    "index": 3,
    "color": "rgba(120,185,40,0.8)"
  }, {
    "name": "18",
    "data": [{
      "x": 1,
      "y": 18,
    }],
    "index": 0,
    "color": "rgba(120,185,40,0.8)"
  }, 
    // ...
  ]
});
highcharts
1个回答
0
投票

这是一个非常有问题的问题。当前,列重叠,因为堆叠功能未考虑minPointLength选项。否则,该列的总值将不正确。

您可以在github上看到有关此问题的所有讨论:https://github.com/highcharts/highcharts/issues/1776

© www.soinside.com 2019 - 2024. All rights reserved.