I'm using the ColorGrid to display Integer values, 0-2, and adding them with the following code:
colorgrid.add(x,val , z, Data.get(0).getCountries().get(x),colors.get(new Integer(val)));
where val is in {0,1,2} and colors contains three colors.
The legend for this chart displays the values 0-2 in 8 steps with colors ranging from white to blue. I want instead to show just 0,1,2 in the legend with their associated colors.
How can I achieve this?
Non-continuous Legend Display
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi McMClark,
You can try doing as in the All Features\Welcome!\Themes\Chart Palettes example in TeeChart.Features.jar demo included with TeeChart's installation. You could create a custom palette with 3 colors so that's what is displayed in the legend.
You can try doing as in the All Features\Welcome!\Themes\Chart Palettes example in TeeChart.Features.jar demo included with TeeChart's installation. You could create a custom palette with 3 colors so that's what is displayed in the legend.
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 |
Legend - Color Grid
I tried this and saw that it worked for the bar chart. However when I changed the Series type to Color Grid the legend stopped being updated by the palette changes. You can reproduce by changing only the series type in the sample code and running the example.narcis wrote:Hi McMClark,
You can try doing as in the All Features\Welcome!\Themes\Chart Palettes example in TeeChart.Features.jar demo included with TeeChart's installation. You could create a custom palette with 3 colors so that's what is displayed in the legend.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi,
For ColorGrid series this may not be the most appropiate example. In that case you can use this:
Hope this helps!
For ColorGrid series this may not be the most appropiate example. In that case you can use this:
Code: Select all
myChart.getLegend().setVisible(true);
ColorGrid tmpSeries = new com.steema.teechart.styles.ColorGrid(myChart.getChart());
tmpSeries.setUsePalette(true);
tmpSeries.setPaletteSteps(5);
tmpSeries.setUseColorRange(false);
tmpSeries.clearPalette();
tmpSeries.addPalette(1, Color.RED);
tmpSeries.addPalette(2, Color.BLUE);
tmpSeries.addPalette(3, Color.YELLOW);
tmpSeries.addPalette(4, Color.WHITE);
tmpSeries.addPalette(5, Color.GREEN);
for (int x = 1; x < 6; x++)
{
for (int z = 1; z < 6; z++)
{
tmpSeries.add(x, x, z);
}
}
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 |