Using XYDotRenderer with PaintScale

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
NaggingDaivy
Posts: 21
Joined: Mon Jan 09, 2017 2:04 pm
antibot: No, of course not.

Using XYDotRenderer with PaintScale

Post by NaggingDaivy » Mon Jan 09, 2017 2:15 pm

Hello,

I am quite new at JFreeChart and I can't find how to use a Dotrenderer with a Paintscale.
As an example : Image

On this picture : Image

I want to replace the circles by dots, and make the dot color value follow the paintscale value. However, I don't find how to do that. Can anyone explain to me?

Thanks in advance,
Daivy

paradoxoff
Posts: 1633
Joined: Sat Feb 17, 2007 1:51 pm

Re: Using XYDotRenderer with PaintScale

Post by paradoxoff » Tue Jan 10, 2017 12:47 pm

Use an XYShapeRenderer.
This renderer allows to use an PaintScale (in contrast to an XYDotRenderer), and also allows to freely define the type of the symbols (in contrast to an XYBlockRenderer, which also supports the use of a PaintScale, but always draws rectangles as symbols).

NaggingDaivy
Posts: 21
Joined: Mon Jan 09, 2017 2:04 pm
antibot: No, of course not.

Re: Using XYDotRenderer with PaintScale

Post by NaggingDaivy » Wed Jan 11, 2017 9:10 am

paradoxoff wrote:Use an XYShapeRenderer.
This renderer allows to use an PaintScale (in contrast to an XYDotRenderer), and also allows to freely define the type of the symbols (in contrast to an XYBlockRenderer, which also supports the use of a PaintScale, but always draws rectangles as symbols).
Hello paradoxoff, thanks for you answer. You say that I can freely define the type of symbols, so how can I define the symbol as a dot ? XYShapeRenderer by default uses circle.
Thanks again.

paradoxoff
Posts: 1633
Joined: Sat Feb 17, 2007 1:51 pm

Re: Using XYDotRenderer with PaintScale

Post by paradoxoff » Wed Jan 11, 2017 3:21 pm

Just use a very small shape, such as an Ellipse2D.Double(-1, -1, 2, 2) or a Rectangle2D.Double(-1, -1, 2, 2), and set those as seriesShape on the renderer:
renderer.setSeriesShape(int indexOfSeriesInDataset, Shape theShape)

NaggingDaivy
Posts: 21
Joined: Mon Jan 09, 2017 2:04 pm
antibot: No, of course not.

Re: Using XYDotRenderer with PaintScale

Post by NaggingDaivy » Thu Jan 12, 2017 8:25 am

paradoxoff wrote:Just use a very small shape, such as an Ellipse2D.Double(-1, -1, 2, 2) or a Rectangle2D.Double(-1, -1, 2, 2), and set those as seriesShape on the renderer:
renderer.setSeriesShape(int indexOfSeriesInDataset, Shape theShape)
It does the job for me ; I didn't know it was as simple as that. Thank you very much !

Post Reply