Highcharts reversed line chart is partially hidden at min value

大憨熊 提交于 2021-02-08 21:37:50

问题


When using a reversed line chart with min and max values, the line is partially hidden at the min value. The problem is that the drawing canvas ends exactly at the min value line. When you have a line that is thick only part of it is visible there, the part that is lying above the min value line is hidden. You can see an example here. I tried different options to fix this but havent been successful. Is there a way you can increase the chart canvas on top?

This is the highcharts code:

$("#chart").highcharts({
  chart: {
  type: "line",
  spacingBottom: 30,
  height: 400,
  alignTicks: false,
  },
  credits: {
    enabled: false
  },
  legend: {
    enabled: false
  },
  title: {
    text: "Chart"
  },
  yAxis: [{
    title: null,
    reversed: true,
    showFirstLabel: true,
    allowDecimals: false,
    startOnTick: false,
    endOnTick: false,
    tickInterval: 5,
    minorTickInterval: 1,
    max: 10,
    min: 1,
  }],
  series: [{
    yAxis: 0,
    data: [6,2,2,1,1,1,1,1,1,1,1,1,1,2,2,1,1,2,2,2,2,2],
    lineWidth: 10, 
    marker: {
      enabled: false
    }
  }]
});

回答1:


The min: 0.9 works well unless you have tickPositions set as well without startOnTick set. If you are setting tickPositions, then look at adding startOnTick: false to the yAxis as well.




回答2:


I'm not sure why this is a problem - you have set strict min value for yAxis, so chart is forced to cut off that line, remove that option, and this will work perfectly fine: http://jsfiddle.net/DruGa/5/



来源:https://stackoverflow.com/questions/18047958/highcharts-reversed-line-chart-is-partially-hidden-at-min-value

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!