Outlines in 2D line charts

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
itai.marko
Posts: 10
Joined: Mon Jun 22, 2009 2:42 pm

Outlines in 2D line charts

Post by itai.marko » Mon Jun 22, 2009 4:25 pm

Hi,

In 3D line charts, code like this:

Code: Select all

LineRenderer3D renderer = (LineRenderer3D) plot.getRenderer();
renderer.setBaseOutlinePaint(Color.white);
renderer.setBaseOutlineStroke(new BasicStroke(3.0f), false);
will surround the whole line with a pretty thick white outline as expected.
However, In 2D line charts, code like:

Code: Select all

LineAndShapeRenderer renderer = (LineAndShapeRenderer) plot.getRenderer();
renderer.setBaseOutlinePaint(Color.white);
renderer.setBaseOutlineStroke(new BasicStroke(3.0f), false);
will surround only the shapes with an outline and not in white but in the same color as the line.

My questions are:
a. Is this a bug? (I'm using version 1.0.12)
b. Is there a way to get the outlines in 2D like they are in 3D?


Thanks,
Itai

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Outlines in 2D line charts

Post by david.gilbert » Mon Jun 22, 2009 4:56 pm

The LineAndShapeRenderer doesn't have outlines for the lines, just the shapes. For ease of use, the series paint is used for both the outline and fill paint for the shapes, but you can override that with the setUseFillPaint() and setUseOutlinePaint() methods.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

itai.marko
Posts: 10
Joined: Mon Jun 22, 2009 2:42 pm

Re: Outlines in 2D line charts

Post by itai.marko » Mon Jun 22, 2009 5:08 pm

Thanks for the quick reply.
So what do I need to do If I want to get outlines for the lines?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Re: Outlines in 2D line charts

Post by david.gilbert » Tue Jun 23, 2009 12:42 pm

You'll have to modify the LineAndShapeRenderer code, because right now it just draws a single line between the data points (using the seriesPaint).
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked