The issue here is twofold: 1) In the line, there are 3 consecutive, identical (x, y) pairs at every point, so a best-fit curve produces straight lines like you see. 2) The typical way to fix this would be to null out two of the points and set the "interpolateNulls" option to true, but this causes the other series to draw lines where you don't want them.
With some creative rearrangement, we can make this work: http://jsfiddle.net/asgallant/6r8MC/3/. The key here is to separate out the line series from the point series. It occurs to me, however, that there may be a simpler solution, depending on what these extra lines represent. Would something like this<https://developers.google.com/chart/interactive/docs/roles#intervalrole>work for you? On Sunday, March 17, 2013 8:58:55 AM UTC-4, Helios wrote: > > Thanks a lot! I was able to produce the graph i was looking for.. but it > have some strange results with smoothing! ( http://jsfiddle.net/6r8MC/2/ ) > > Ideally I would like the red line to be smoothed, in some way. But maybe > the Google Chart API is not the right tool? Maybe I should look more into > the D3.js kind of stuff? > > Thanks again > > > 2013/3/16 asgallant <[email protected] <javascript:>> > >> This will be difficult, but possible to replicate. You are basically >> right with your data structure, but you have to do some weird tricks to >> make it work. >> >> Each data point with one of your lines hanging up or down needs 3 rows in >> the DataTable. The first row contains [x, point value, line value]; the >> second contains [x, line value, line value]; and the third contains [x, >> null, line value]. When you do that, you get a chart that looks like this: >> http://jsfiddle.net/asgallant/6r8MC/1/ >> >> On Saturday, March 16, 2013 11:46:32 AM UTC-4, Helios wrote: >>> >>> Hi alll, I would like to produce a plot like this: >>> >>> https://imageshack.us/a/**img851/1310/plotres.jpg<https://imageshack.us/a/img851/1310/plotres.jpg> >>> >>> I already tried a couple of approaches, but the best I could think of is >>> to store (apart from the x coordinate) two y coordinates, one for the >>> continuous line and one for the points. But I can't see how I can connect >>> the two points with a line. >>> >>> What would you suggest? >>> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Google Visualization API" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/google-visualization-api/VgEiFsalWzA/unsubscribe?hl=en >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected] <javascript:>. >> To post to this group, send email to >> [email protected]<javascript:> >> . >> Visit this group at >> http://groups.google.com/group/google-visualization-api?hl=en. >> For more options, visit https://groups.google.com/groups/opt_out. >> >> >> > > -- You received this message because you are subscribed to the Google Groups "Google Visualization API" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/google-visualization-api?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
