简体   繁体   中英

Create spline chart from edge to edge of graph

I'm putting a spline chart and horizontal bar chart together in one graph (like this example on the Highcharts site , but with bars instead of columns).

Unlike in this example, I'd like the spline chart to go from edge to edge. The reason is that the number of categories is variable and could equal 1. As it stands, if there's only one category, the spline stops being a line and is just a point; we need to keep a line.

I've tried using pointPlacement: 0.5 on the spline, which successfully shifts the top (left) of the spline up to the top edge of the graph, but means the bottom (right) doesn't extend far enough. I compensated by adding an additional data point, but that added an extra column to the graph instead of bringing the spline out to the edge.

How can I avoid that extra column and have the spline come out to the edge of the graph? Or, alternately, is there another strategy I can use to get this effect?

If it matters, the spline graph is a constant value across all categories - it's meant to show a threshold value to compare the columns against. If there's a simpler way of showing this in Highcharts, that might solve the problem as well.

If you data is going to be constant for any point on the xAxis what you could do is use the plotLines . A simple setup would be:

yAxis: {
  plotLines: [{
    color: '#FF0000',
    width: 2,
    value: 75,
    label: {
      text: 'Plot line',
      align: 'right',
      x: -10
    }
  }]
},

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM