Hi, how exactly do I control/get to the colors of a pie chart?
In bar, stacked and Line I grab the series and change the color.
For example, I have only one series yet the slices of the pie are all different colors and I can't find for the life of me how to adjust them. The naming of a few of the methods/classes etc... doesn't seem very intuitive to me, the documentation is mediocre at best and I obviously can't see the source code so I need to ask questions like this here.
Brian
Custom colors on Pie
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Re: Custom colors on Pie
Hi Brian,
You have 2 options here:
1. Populating series specifying a color for each slice:
2. Changing Colors ValueLists colors:
Why can't you see the source code? Full sources are included in all TeeChart for Java licenses.
You have 2 options here:
1. Populating series specifying a color for each slice:
Code: Select all
com.steema.teechart.styles.Pie pie1 = new com.steema.teechart.styles.Pie(tChart1.getChart());
Random y = new Random();
for (int i= 0; i < 10; i++) {
pie1.add(y.nextDouble(), Color.fromArgb(i * 25, i * 25, i * 25));
}
Code: Select all
com.steema.teechart.styles.Pie pie1 = new com.steema.teechart.styles.Pie(tChart1.getChart());
pie1.fillSampleValues(10);
for (int i= 0; i < pie1.getCount(); i++) {
pie1.getColors().setColor(i, Color.fromArgb(i * 25, i * 25, i * 25));
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |