My renderer wont change shapes (XYDotRenderer)

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
samoht
Posts: 12
Joined: Wed Jun 18, 2008 12:25 pm
Location: Norway

My renderer wont change shapes (XYDotRenderer)

Post by samoht » Thu Jul 10, 2008 10:20 am

Im trying to change a shape:

XYDotRenderer dotRenderer = new XYDotRenderer();
dotRenderer.setPaint(Color.black);
dotRenderer.setDotHeight(3);
dotRenderer.setDotWidth(3); dotRenderer.setBaseShape(org.jfree.chart.plot.DefaultDrawingSupplier.DEFAULT_SHAPE_SEQUENCE[6]);
xyplot.setRenderer(0, dotRenderer);

I have gone over all the setshape methods in the renderer but non works, it is always the same rectangle. If i try dotRenderer.setLegendShape(Shape) it works fine... but not the shape of the dot itself.. ideas?

skunk
Posts: 1087
Joined: Thu Jun 02, 2005 10:14 pm
Location: Brisbane, Australia

Post by skunk » Thu Jul 10, 2008 1:13 pm

If you look at the source for org.jfree.chart.renderer.xy.XYDotRenderer you will see that the shape of the dot is hardcoded

Code: Select all

252                    g2.fillRect((int) transY, (int) transX, this.dotHeight, 
253                            this.dotWidth);

Nikeitaro
Posts: 6
Joined: Thu Jun 19, 2008 10:46 am

Post by Nikeitaro » Thu Jul 10, 2008 1:15 pm

Hi,

Try the function setSeriesShape instead of setBaseShape

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

Post by david.gilbert » Thu Jul 10, 2008 3:41 pm

skunk wrote:If you look at the source for org.jfree.chart.renderer.xy.XYDotRenderer you will see that the shape of the dot is hardcoded

Code: Select all

252                    g2.fillRect((int) transY, (int) transX, this.dotHeight, 
253                            this.dotWidth);
Correct. For more generalised shapes, the XYLineAndShapeRenderer should be used instead (you can switch off the lines).
David Gilbert
JFreeChart Project Leader

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

samoht
Posts: 12
Joined: Wed Jun 18, 2008 12:25 pm
Location: Norway

Post by samoht » Fri Jul 11, 2008 10:00 am

ah , thanks. I'll use the XYLineAndShapeRenderer then :-)

Locked