Resetting PieChart Values

Questions and answers on developing, deploying and using plugins and JavaBeans

Resetting PieChart Values

Postby Riccardino » Mon Dec 20, 2004 12:13 pm

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
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Postby maarten » Tue Dec 21, 2004 11:48 am

Can you try
elements.piechart.valueGrid = null;
(haven't tried it myself..it's from the top of my hat)
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Riccardino » Tue Dec 21, 2004 2:47 pm

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? :-)
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy

Postby maarten » Tue Dec 21, 2004 4:27 pm

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') );
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby maarten » Tue Dec 21, 2004 5:05 pm

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.
Maarten Berkenbosch
User avatar
maarten
 
Posts: 797
Joined: Wed Apr 23, 2003 10:52 pm
Location: Amersfoort, Netherlands

Postby Riccardino » Tue Dec 21, 2004 7:39 pm

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 :)
ciao, ric
User avatar
Riccardino
 
Posts: 911
Joined: Thu Apr 24, 2003 11:42 am
Location: Ferrara, Italy


Return to Plugins and Beans

Who is online

Users browsing this forum: Bing [Bot] and 17 guests