Page 1 of 1

Resetting PieChart Values

PostPosted: Mon Dec 20, 2004 12:13 pm
by Riccardino
Is there a quick way to completely reset all values present in a PieChart, without looping?

I'm using
Code: Select all
elements.pieChart.setLegends([""])

To rapidly empty all the legends, but I can't find a similar procedure to use with:
Code: Select all
elements.pieChart.setValues()


Any suggestion?

Thanks in advance

PostPosted: Tue Dec 21, 2004 11:48 am
by maarten
Can you try
elements.piechart.valueGrid = null;
(haven't tried it myself..it's from the top of my hat)

PostPosted: Tue Dec 21, 2004 2:47 pm
by Riccardino
maarten wrote:Can you try
elements.piechart.valueGrid = null;
(haven't tried it myself..it's from the top of my hat)


It works: thanks, maarten :D

Another little question.
I noticed that, when you have more the 10 values in the legend, the colors are repeated.
I tried to set the color using

elements.pieChart.setColors(number, Color)

After several tests, I saw that the color must be expressed in rgb, but I can't find the right sintax.
using

elements.pieChart.GetColors() and parking it in a variable gives my this kind of result:
java.awt.Color[r=138,g=18,b=0]

But I tried to assign this value testing several ways and I always had an error in return.
Can you give me a little hint? :-)

PostPosted: Tue Dec 21, 2004 4:27 pm
by maarten
elements.pieChart.setColors(number, Color)
The method asks for a java Color object here.

Try this:

elements.pieChart.setColors(x, java.awt.Color.decode('#cc00ff') );

PostPosted: Tue Dec 21, 2004 5:05 pm
by maarten
Code: Select all
elements.piechart.valueGrid = null;

I believe this line of code still forces you to loop.

instead, put this line in the top of your script .
Code: Select all
elements.pieChart.valueGrid.trimColumns(0);

It will completely clean up your chart.

PostPosted: Tue Dec 21, 2004 7:39 pm
by Riccardino
maarten wrote:
Code: Select all
elements.piechart.valueGrid = null;

I believe this line of code still forces you to loop.

instead, put this line in the top of your script .
Code: Select all
elements.pieChart.valueGrid.trimColumns(0);

It will completely clean up your chart.


Even better :D

I also tested successfully your suggestion regarding colours. I store a primary set of colour inside an array and everithyng works as expected.

Thanks again :)