I'm working with some old code that uses StandardXYItemRenderers. I saw the class comment saying it "has been retained for historical reasons and, in general, you should use the XYLineAndShapeRenderer class instead." I was considering changing the code to use the newer renderer. However, it looks like XYLineAndShapeRenderer lacks the support for gaps/discontinuous lines present in StandardXYItemRenderer. Are there any plans to add support for that in XYLineAndShapeRenderer?
--Matt
Support for gaps in XYLineAndShapeRenderer?
Re: Support for gaps in XYLineAndShapeRenderer?
This should work. See for example XYSeriesDemo1, which uses XYLineAndShapeRenderer and has gaps (null-values) in it.
If it doesn't work for you, please provide an small, self-contained demo to reproduce the problem.
thanks,
- martin
If it doesn't work for you, please provide an small, self-contained demo to reproduce the problem.
thanks,
- martin
-
- Posts: 5
- Joined: Wed Oct 07, 2009 7:15 pm
- antibot: No, of course not.
- Location: Waltham, MA USA
- Contact:
Re: Support for gaps in XYLineAndShapeRenderer?
Hi Martin,
Thanks for the reply. It's good to know that XYLineAndShapeRenderer supports gaps using explicit null values. I guess what I should have said is that it lacks gap detection. In contrast, with StandardXYItemRenderer set to draw discontinuous lines, if you have x values of 1, 2, 3, 7, 8, and 9, it can detect that there is a gap between 3 and 7 and not try to draw a line between those two points. In the application I'm working on, we're not otherwise aware of gaps, so unless we duplicated the gap detection logic in our own code, we wouldn't know where we needed to insert null values.
Thanks,
Matt
Thanks for the reply. It's good to know that XYLineAndShapeRenderer supports gaps using explicit null values. I guess what I should have said is that it lacks gap detection. In contrast, with StandardXYItemRenderer set to draw discontinuous lines, if you have x values of 1, 2, 3, 7, 8, and 9, it can detect that there is a gap between 3 and 7 and not try to draw a line between those two points. In the application I'm working on, we're not otherwise aware of gaps, so unless we duplicated the gap detection logic in our own code, we wouldn't know where we needed to insert null values.
Thanks,
Matt
Re: Support for gaps in XYLineAndShapeRenderer?
I don't know the StandardXYItemRenderer code but if it really detects missing values by itself, this is IMHO a bad practice! Not everybody wants gaps if a value is missing.
You should probably port your application to insert null-values into the dataset if you want gaps.
- martin
You should probably port your application to insert null-values into the dataset if you want gaps.
- martin
-
- Posts: 5
- Joined: Wed Oct 07, 2009 7:15 pm
- antibot: No, of course not.
- Location: Waltham, MA USA
- Contact:
Re: Support for gaps in XYLineAndShapeRenderer?
Notice that I said
--Matt
It's an option that you can choose to turn on. It's worked quite well for us for years, but I understand that not everyone would want that behavior.with StandardXYItemRenderer set to draw discontinuous lines
--Matt
Re: Support for gaps in XYLineAndShapeRenderer?
Ah, I see. I didn't know this option and it is not present in XYLineAndShapeRenderer.
So, if you want to switch the renderer, you would have to adapt your application to in a way that the dataset will return null-values when gaps are required.
hth,
- martin
So, if you want to switch the renderer, you would have to adapt your application to in a way that the dataset will return null-values when gaps are required.
hth,
- martin