drmaa
drmaa

Reputation: 3674

JFree Chart with discontinuous series line charts

I am plotting XYChart range say 1 to 10 then 20 to 30 as series 1, and 11 to 19 as series 2. It looks straight forward to do it in JFreeChart serie1 (1,0), (10,0) (20, 0), (30, 0) and series2 (11, 0), (19, 0). The problem is that series 1 line connects values from 1 to 30 and thus overlap series 2. Is it possible to hide series 1 from 11 to 19. I can do it using more then two series but in that case it will look weird to have multiple series in the legends for two items. Many thanks for your help.

Upvotes: 3

Views: 691

Answers (1)

drmaa
drmaa

Reputation: 3674

Thanks for your help. I did it this way. here is the screenshot in my case

To do the questioned task we need to add another point to the series, so in above case

series1 (1,0), (10,0), (10, null) (20, 0), (30, 0) series2 (11, 0), (19, 0)

(10, null) will break series 1 from 10 to 20. This way series 2 will occupy the space as shown in the figure for my case. Let me know if any one need further help.

Upvotes: 1

Related Questions