Home › forums › Using CanvasJS › drawing a solid line
Tagged: Axis, length, Line, Margin
I have a multi-series column chart and I need to draw a straight line across all the columns marking a specific value on the chart.
I have done this using a line series but that line only goes from the middle of the first set of columns to the middle of the last set of columns. I need it to go all the way from start of axis to end of axis.
how can I do this?
You can do the same by using stripLines property of axisY. In case this doesn’t work for you, please create a jsfiddle so that we can have a look.
not quite what I want. stripLines goes behind the columns but I need it in front. Also, it does not show up if the value is above the maximum on the Axis. If there is a way around these things then it’s great
not quite what I want. stripLines goes behind the columns but I need it in front
We are planning to implement feature to render stripLines above data in the next version – will be available in the last week of April.
Also, it does not show up if the value is above the maximum on the Axis.
This looks like a bug in the library. We’ll look into this behaviour in the coming versions. As a workaround you can set maximum property of axis such that it is always higher than the stripLine’s value.
One more alternative is to use a line series (like you already did) with axisX’s minimum & maximum values set. Then you can add two dataPoints to the series such that the lines starts at minimum and ends at maximum of axisX. You can also disable toolTip for this line series by setting toolTipContent property to null.
You must be logged in to reply to this topic.