ColorGrid Legend Colors

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Kev
Newbie
Newbie
Posts: 1
Joined: Mon Apr 16, 2012 12:00 am

ColorGrid Legend Colors

Post by Kev » Fri Feb 22, 2013 2:21 pm

I have created a ColorGrid and I am using a 64 color custom Palette. The ColorGrid works perfectly with the assigned colors. The legend values are also showing correctly, however the color boxes next to the values are all White. Using the ChartEditor, I can switch to a built in Palette which changes the colors on the ColorGrid as well as the Legend colors.

Here is the code that I use to create the Palette.

private void DoPalette()
{
ColorGrid.ClearPalette();
ColorGrid.UseColorRange = false;
ColorGrid.UsePalette = true;
ColorGrid.PaletteSteps = 20;

double dMinimum = .400;
double dMaximum = .500;
double dStep;

ColorGrid.PaletteMin = dMinimum;

double dWallSpan = dMaximum - dMinimum;
dStep = dWallSpan / 64.0;
double value = dMinimum;

//use 64 color palette previously created on main form
for(int i=0;i<64;i++){
ColorGrid.AddPalette(value, Form1.Frm1.Pallet64Color);
value += dStep;
}
}
//======================================================

I create the palette before any data is added to the chart. If I "Re-create" the palette after some data is added, I will get possibly 1 or 2 colors at the top and bottom end of the legend only with everything in between being white. I have attached a picture of my chart showing the problem

thanks,
Kev
Attachments
ColorGrid.JPG
ColorGrid.JPG (64.97 KiB) Viewed 4792 times

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Re: ColorGrid Legend Colors

Post by Narcís » Mon Feb 25, 2013 2:48 pm

Hi Kev,

That probably means that all the values in your custom palette are white. If you look carefully at the values related to each color in the legend, you'll notice that those which are different from white are values that fall off the values in your palette levels. Please bear in mind that the Color parameter in AddPalette method will be used to fill polygons with Y values up to the Value parameter. Having this in mind and creating a simpler example you'll see how pointers are painted using custom palette colors:

Code: Select all

    private Steema.TeeChart.Styles.ColorGrid ColorGrid;

    private void InitializeChart()
    {
      tChart1.Dock = DockStyle.Fill;
      tChart1.Aspect.View3D = false;
      ColorGrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

      DoPalette();

      int count = 1;

      for (int x = 0; x < 10; x++)
      {
        for (int z = 0; z < 10; z++)
        {
          ColorGrid.Add(x, count, z);
          count++;
        }
      }      
    }

    private void DoPalette()
    {
      ColorGrid.ClearPalette();
      ColorGrid.UseColorRange = false;
      ColorGrid.UsePalette = true;
      ColorGrid.PaletteSteps = 10;

      for (int i = 1; i <= 10; i++)
      {
        double value = i * 10;
        int tmp = 25 * i;
        ColorGrid.AddPalette(value, Color.FromArgb(tmp, 0, 0));
      }
    }
If you can't get this working at your end please attach a simple example project we can run "as-is" to reproduce the problem here.

Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply