Hi,
We noticed that if JFreeChart line chart is drawn into a vector device such as PDF, the plots are composed of many disconnected lines.
This is ok for screen viewing, but when a vector graphics file (e.g., PDF or SVG) is produced, it makes subsequent downstream editing more difficult, because it is impossible to adjust the parameters of the whole line that belongs to a series (such as color or line thickness).
For making scientific figures, we often need to adjust the exported charts, e.g. in Adobe Illustrator or Inkscape.
I suppose the cause of this problem is that the XYLineAndShapeRenderer class is using Graphics2D.drawLine() to draw each segment separately. If it used Graphics2D.drawPolyLine() to draw the entire series, it would produce a single "polyline" object in the resulting vector image.
Would it be too very difficult to change this?
Tomas
Ref: https://docs.oracle.com/javase/7/docs/a ... [],%20int)
Use of drawLine() vs drawPolyLine()
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: Use of drawLine() vs drawPolyLine()
In the XYLineAndShapeRenderer class, there is a flag drawSeriesLineAsPath. It defaults to false, but you can set it to true and then the line for a series will be drawn as a single path.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader


Re: Use of drawLine() vs drawPolyLine()
Amazing!
JFreeChart never stops surprising me
JFreeChart never stops surprising me
