set the Shape of item

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Rajnesh
Posts: 19
Joined: Thu Jan 03, 2008 8:48 am

set the Shape of item

Post by Rajnesh » Tue Jan 08, 2008 7:23 am

Hi
I want to set the shape to be triangular. but right now i get the square.
how is it possible to set the shape as we required.For this i have used setItemShape(i,j).but i have no idea about the value of i nd j here.
so plzzzzzzzz help me to solve this problem
Thanx

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 » Tue Jan 08, 2008 9:57 am

You can call setSeriesShape(int, Shape) in the renderer. Make sure the shape is defined with its centre at (0, 0) otherwise it won't align properly to the data point.
David Gilbert
JFreeChart Project Leader

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

Rajnesh
Posts: 19
Joined: Thu Jan 03, 2008 8:48 am

set the Shape of item

Post by Rajnesh » Wed Jan 09, 2008 5:49 am

Hi
what should i have to passed for the Shape in setSeriesShape(int,Shape) so that i get get Triangle shape rather the square......
Thanx

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 » Wed Jan 09, 2008 12:20 pm

This is a Java2D question rather than a JFreeChart one, but...why don't you look at the GeneralPath class or the Polygon class in the Java APIs. These classes both implement the Shape interface, and can easily be used to represent a triangle.
David Gilbert
JFreeChart Project Leader

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

Locked