simple vertical and horizontal lines on line chart

1,160 views
Skip to first unread message

Stephen Huey

unread,
Oct 20, 2014, 4:38:52 PM10/20/14
to google-visua...@googlegroups.com
I have a line chart and I'm displaying point values like a scatter chart, meaning there is no line connecting the points.  I'd like to also draw on the same chart 2 other lines:  a vertical line and horizontal line not related to the aforementioned points.  I'm placing labels next to the point with an annotation in my data.  I've read that an additional annotation can be used to draw a vertical line, but it didn't draw the line all the way across.  However, this seems like the wrong approach.  Without using an additional annotation, isn't there a simple way to say at such-and-such X value, draw a vertical line?  It seems like if I attempt to put 2 line charts on the same chart, it won't do what I want because in the options the line is either on or off.  Plus I tried to call draw again with different data and the first round of data was erased, so I'm hoping there's a simple solution for this.  

Thanks, 
Stephen

Andrew Gallant

unread,
Oct 20, 2014, 9:22:33 PM10/20/14
to google-visua...@googlegroups.com
Creating a vertical line can be done either by adding a domain-axis annotation with the style option set to "line", or by adding an additional data series with two (x, y) points sharing a common x-value.  The horizontal line can be added with an additional data series with two (x, y) points sharing a common y-value.  If these lines can be the same color, then you can use a single data series to accomplish this.  Here's an example: http://jsfiddle.net/asgallant/cq27yf6v/
Reply all
Reply to author
Forward
0 new messages