Cell Color in ColorGrid

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Planoresearch
Newbie
Newbie
Posts: 57
Joined: Thu Jun 02, 2011 12:00 am

Cell Color in ColorGrid

Post by Planoresearch » Sat Dec 24, 2011 12:55 pm

Hi Steema Support,

We are using TeeChart for .NET2010. I am trying to create a color grid series I which we are putting data in the manner as in following code. I have put red color in each cell of grid. I am facing problem when I am trying to zoom the chart. The color of cells are changing as soon as I zoom the chart. You can see it in attached picture.

The code is:

Code: Select all

tChart1.Aspect.View3D = false;
            tChart1.Header.Text = "";
            tChart1.Walls.Visible = false;
            tChart1.Chart.Panel.Color = Color.Transparent;
            tChart1.Zoom.Allow = false;

            tChart1.Axes.Bottom.Automatic = true;
            tChart1.Axes.Bottom.AxisPen.Color = Color.Gray;
            tChart1.Axes.Left.Automatic = true;
            tChart1.Axes.Left.AxisPen.Color = Color.Gray;
            tChart1.Zoom.Allow = true;

            tChart1.Legend.Visible = true;

            clrGrid = newColorGrid();
            clrGrid.Pen.Color = Color.Blue;
            clrGrid.UsePalette = true;
            clrGrid.UseColorRange = false;
            clrGrid.Pen.Visible = true;

int k = 0;
for (int i = 1539; i < 2819; i++)
            {
                k++;
for (int j = 0; j < 5976; j = j + 4)
                {
                    clrGrid.Add(i,k,j, Color.Red);
                }

            }

            tChart1.Series.Add(clrGrid);
In above code “i” represents to x ,”j” represents to y and “k” is some value which represent the z value. Currently I am putting red color to all cell later I will put color on the basis of z values.
Attachments
test.png
test.png (81.85 KiB) Viewed 5052 times

Sandra
Site Admin
Site Admin
Posts: 3132
Joined: Fri Nov 07, 2008 12:00 am

Re: Cell Color in ColorGrid

Post by Sandra » Tue Dec 27, 2011 11:57 am

Hello Planoresearch,

I have modify a little your code to work with less data. Moreover, I have added IrregularGrid=true. Please see next:

Code: Select all

   public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }
        ColorGrid clrGrid;
        private void InitializeChart()
        {
            /*Chart*/
            tChart1.Aspect.View3D = false;
            tChart1.Walls.Visible = false;
            tChart1.Chart.Panel.Color = Color.Transparent;
            tChart1.Legend.Visible = true;

            tChart1.AutoRepaint = false;

            clrGrid = new ColorGrid(tChart1.Chart);
            clrGrid.Pen.Color = Color.Blue;
            clrGrid.UsePalette = false;
            clrGrid.UseColorRange = false;
            clrGrid.IrregularGrid = true;

            int k = 0;
            for (int i = 153/*9*/; i < 281/*9*/; i++)
            {
                k++;
                for (int j = 0; j < 597/*6*/; j = j + 4)
                {
                    clrGrid.Add(i, k, j, Color.Red);
                }

            }

            tChart1.AutoRepaint = true;
            tChart1.Refresh();
        }
Can you tell us if using previous code your problem appears? On the other hand, can you tell us which version are you using?

Thanks,
Best Regards,
Sandra Pazos / 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

Planoresearch
Newbie
Newbie
Posts: 57
Joined: Thu Jun 02, 2011 12:00 am

Re: Cell Color in ColorGrid

Post by Planoresearch » Wed Dec 28, 2011 10:24 am

Hi Sandra,

Thanks for reply. Given code is exactly working fine. Our problem is resolved.

Thanks & Regards,

Plano Research

Post Reply