Using XYDotRenderer with PaintScale

A discussion forum for JFreeChart (a 2D chart library for the Java platform).

Using XYDotRenderer with PaintScale

Postby 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
NaggingDaivy
 
Posts: 21
Joined: Mon Jan 09, 2017 2:04 pm

Re: Using XYDotRenderer with PaintScale

Postby 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).
paradoxoff
 
Posts: 1593
Joined: Sat Feb 17, 2007 1:51 pm

Re: Using XYDotRenderer with PaintScale

Postby 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.
NaggingDaivy
 
Posts: 21
Joined: Mon Jan 09, 2017 2:04 pm

Re: Using XYDotRenderer with PaintScale

Postby 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)
paradoxoff
 
Posts: 1593
Joined: Sat Feb 17, 2007 1:51 pm

Re: Using XYDotRenderer with PaintScale

Postby 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 !
NaggingDaivy
 
Posts: 21
Joined: Mon Jan 09, 2017 2:04 pm


Return to JFreeChart

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], gw1500se and 8 guests