I am rendering some stock charts to PDF. I almost have it working, but when I have too many data points in the chart, it renders the open/close ticks so large that they overlap a number of data points on either side.
Is there a way to customize the size of the ticks that stick out from the HighLow items? It looks like I need to modify HighLowRenderer.java, and change:
double delta = 2.0;
into something smaller. Obviously I'd prefer not to do that.
HighLow renderer renders open/close ticks too large
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Yes, that's not great. Would it be sufficient to have an attribute for the 'delta', so you can set the absolute length of the open and close indicators, instead of it being hardcoded as 2.0?
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Yeah, I think that would be fine. While I'd love for the "delta" to be calculated on the fly, that might not make sense for most applications.
Honestly, if I was rendering this chart to a PNG or the screen, I suspect 2.0 renders as 2 pixels, so I really wouldn't be able to shrink it too much. The fact that I'm writing it to PDF means that when I decided yesterday to hard-code it to 0.4, I can still see them fine. But I suspect many people don't render to PDF/SVG, so they probably wouldn't want it to be set below 1.0. As such, just the ability to change it without modifying the code would provide the necessary power with only a few lines of code.
Honestly, if I was rendering this chart to a PNG or the screen, I suspect 2.0 renders as 2 pixels, so I really wouldn't be able to shrink it too much. The fact that I'm writing it to PDF means that when I decided yesterday to hard-code it to 0.4, I can still see them fine. But I suspect many people don't render to PDF/SVG, so they probably wouldn't want it to be set below 1.0. As such, just the ability to change it without modifying the code would provide the necessary power with only a few lines of code.
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
I'd like to calculate the tick length on the fly, but I'm not sure what the best way to do it is. It seems obvious, when you see some daily data against a linear axis - but then there can be gaps in the data (Friday to Monday), and when the number of observations is low, you probably don't want the tick marks to extend all the way between observations.
Well, for now I've just added getTickLength() and setTickLength() methods (to be included in the 1.0.10 release).
Well, for now I've just added getTickLength() and setTickLength() methods (to be included in the 1.0.10 release).
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


I completely understand the issue. Back in 2001 or so, I wrote a Java program to graph sensor data, and wrote the graph engine from scratch. Even with a pretty constrained application, it was still pretty daunting.
I appreciate you adding that functionality in. I really don't want to maintain my own branch of the JFreeChart code, and adding that ability means I won't have to. Thanks!
I appreciate you adding that functionality in. I really don't want to maintain my own branch of the JFreeChart code, and adding that ability means I won't have to. Thanks!