How to display large number of points with specific color

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
Amol
Advanced
Posts: 176
Joined: Mon May 29, 2006 12:00 am

How to display large number of points with specific color

Post by Amol » Mon Oct 25, 2010 2:26 pm

Hi,


Please view my requirements given below and suggest some way to implement it in TeeChart.

I need to show a large number of points on the chart. This number can be in lacs. Each point is associated with three values that are X coordinate, y coordinate and a third Z value which will decide the color of that point. It is some thing like showing a three dimensional surface in 2d where the points at different height will be of different color. How can I achieve this in TeeChart?

Your suggestions will be highly appreciated.


Thank You
Yatendra

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

Re: How to display large number of points with specific color

Post by Narcís » Mon Oct 25, 2010 2:39 pm

Hi Yatendra,

I think the best option for this kind of charts is using ColorGrid series. Please bear in mind the way such series works.

Hope this helps!
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

Amol
Advanced
Posts: 176
Joined: Mon May 29, 2006 12:00 am

Re: How to display large number of points with specific color

Post by Amol » Tue Oct 26, 2010 10:43 am

Hi Narcis,


Thank you very much for the suggestion.


But I see some problems while using color grid series.

I think the coor grid fails to work when data is to large. It shows "Index outside the bounds of array" with my data.

Also when I enabled irregular grid property and then added some random points to the colorgrid, I did not see anything on the chart, however legend was showing the colors for differnt values but the chart was empty.

I am providing you sample data with which I am trying to create colorgrid. It will be so nice of you if you please provide a code sample to generate color grid with that data.Here Z value indicates the color of the point.
X Y Z
---------------------------------
649525.00 1840735.13 6220.000
649525.00 1840747.63 6228.000
649525.00 1840760.13 6240.000
649525.00 1840772.63 6244.000
649525.00 1840785.13 6252.000
649525.00 1840797.63 6260.000
649525.00 1840810.13 6268.000
649525.00 1840822.63 6276.000
649525.00 1840835.13 6304.000
649525.00 1840847.63 6312.000
649525.00 1840860.13 6324.000
649525.00 1840872.63 6328.000
649525.00 1840885.13 6336.000
649525.00 1840897.63 6336.000
649525.00 1840910.13 6336.000
649525.00 1840922.63 6340.000
649525.00 1840935.13 6344.000
649525.00 1840947.63 6348.000
649525.00 1840960.13 6352.000
649525.00 1840972.63 6352.000
649525.00 1840985.13 6356.000
649525.00 1840997.63 6360.000
649525.00 1841010.13 6364.000
649525.00 1841022.63 6364.000
649525.00 1841035.13 6368.000
649525.00 1841047.63 6372.000
649525.00 1841060.13 6376.000
649525.00 1841072.63 6376.000
649525.00 1841085.13 6380.000
649525.00 1841097.63 6380.000
649525.00 1841110.13 6384.000
649525.00 1841122.75 6384.000
649525.00 1841135.13 6384.000
649525.00 1841147.63 6388.000
649525.00 1841160.13 6388.000
649525.00 1841172.63 6388.000
649525.00 1841185.13 6388.000
649525.00 1841197.63 6388.000
649525.00 1841210.13 6392.000
649525.00 1841222.63 6392.000
649525.00 1841235.13 6392.000
649525.00 1841247.63 6392.000
649525.00 1841260.13 6392.000
649525.00 1841272.63 6396.000
649525.00 1841285.13 6396.000
649525.00 1841297.63 6400.000


Thanks & Regards
Yatendra

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

Re: How to display large number of points with specific color

Post by Narcís » Tue Oct 26, 2010 1:43 pm

Hi Yatendra,

Ok, ColorGridSeries was intended for populating grid-style data, not a single column. However, you can get a char with your data doing something like in the code snippet below. Notice that I'm using an auxiliar series for switching Y values for Z values according to the link I posted.

Code: Select all

        public Form1()
        {
            InitializeComponent();
            InitializeChart();
        }

        private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            tChart1.Dock = DockStyle.Fill;

            Steema.TeeChart.Styles.ColorGrid colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
            colorGrid1.IrregularGrid = true;
            PopulateSeries(colorGrid1);

            tChart1.Axes.Bottom.SetMinMax(colorGrid1.MinXValue(), colorGrid1.MaxXValue() + 1);
        }

        private void PopulateSeries(Steema.TeeChart.Styles.ColorGrid colorGrid)
        {
            Steema.TeeChart.Styles.ColorGrid colorGridAux = new Steema.TeeChart.Styles.ColorGrid();

            colorGridAux.Add(649525.00, 1840735.13, 6220.000);
            colorGridAux.Add(649525.00, 1840747.63, 6228.000);
            colorGridAux.Add(649525.00, 1840760.13, 6240.000);
            colorGridAux.Add(649525.00, 1840772.63, 6244.000);
            colorGridAux.Add(649525.00, 1840785.13, 6252.000);
            colorGridAux.Add(649525.00, 1840797.63, 6260.000);
            colorGridAux.Add(649525.00, 1840810.13, 6268.000);
            colorGridAux.Add(649525.00, 1840822.63, 6276.000);
            colorGridAux.Add(649525.00, 1840835.13, 6304.000);
            colorGridAux.Add(649525.00, 1840847.63, 6312.000);
            colorGridAux.Add(649525.00, 1840860.13, 6324.000);
            colorGridAux.Add(649525.00, 1840872.63, 6328.000);
            colorGridAux.Add(649525.00, 1840885.13, 6336.000);
            colorGridAux.Add(649525.00, 1840897.63, 6336.000);
            colorGridAux.Add(649525.00, 1840910.13, 6336.000);
            colorGridAux.Add(649525.00, 1840922.63, 6340.000);
            colorGridAux.Add(649525.00, 1840935.13, 6344.000);
            colorGridAux.Add(649525.00, 1840947.63, 6348.000);
            colorGridAux.Add(649525.00, 1840960.13, 6352.000);
            colorGridAux.Add(649525.00, 1840972.63, 6352.000);
            colorGridAux.Add(649525.00, 1840985.13, 6356.000);
            colorGridAux.Add(649525.00, 1840997.63, 6360.000);
            colorGridAux.Add(649525.00, 1841010.13, 6364.000);
            colorGridAux.Add(649525.00, 1841022.63, 6364.000);
            colorGridAux.Add(649525.00, 1841035.13, 6368.000);
            colorGridAux.Add(649525.00, 1841047.63, 6372.000);
            colorGridAux.Add(649525.00, 1841060.13, 6376.000);
            colorGridAux.Add(649525.00, 1841072.63, 6376.000);
            colorGridAux.Add(649525.00, 1841085.13, 6380.000);
            colorGridAux.Add(649525.00, 1841097.63, 6380.000);
            colorGridAux.Add(649525.00, 1841110.13, 6384.000);
            colorGridAux.Add(649525.00, 1841122.75, 6384.000);
            colorGridAux.Add(649525.00, 1841135.13, 6384.000);
            colorGridAux.Add(649525.00, 1841147.63, 6388.000);
            colorGridAux.Add(649525.00, 1841160.13, 6388.000);
            colorGridAux.Add(649525.00, 1841172.63, 6388.000);
            colorGridAux.Add(649525.00, 1841185.13, 6388.000);
            colorGridAux.Add(649525.00, 1841197.63, 6388.000);
            colorGridAux.Add(649525.00, 1841210.13, 6392.000);
            colorGridAux.Add(649525.00, 1841222.63, 6392.000);
            colorGridAux.Add(649525.00, 1841235.13, 6392.000);
            colorGridAux.Add(649525.00, 1841247.63, 6392.000);
            colorGridAux.Add(649525.00, 1841260.13, 6392.000);
            colorGridAux.Add(649525.00, 1841272.63, 6396.000);
            colorGridAux.Add(649525.00, 1841285.13, 6396.000);
            colorGridAux.Add(649525.00, 1841297.63, 6400.000);

            for (int i = 0; i < colorGridAux.Count; i++)
            {
                colorGrid.Add(colorGridAux.XValues[i], colorGridAux.ZValues[i], colorGridAux.YValues[i]);
            }

            colorGridAux.Dispose();
        }
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

Amol
Advanced
Posts: 176
Joined: Mon May 29, 2006 12:00 am

Re: How to display large number of points with specific color

Post by Amol » Wed Oct 27, 2010 1:10 pm

Hi Narcis,


Your code works fine with the sample data I provided.

The data seems to be a single column because it is just a small portion of original data. Original data contains more than 62000 values and the number of values may go to 2.5 to 3 lacs. When I tried your code with original data I got "Index out of Range" exception.

I also tried to attach original data file with this reply but it failed everytime. May be it is due to the size of file. It is 2.24 mb in size.

Please help.


Thanks and Regards
Yatendra

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

Re: How to display large number of points with specific color

Post by Narcís » Wed Oct 27, 2010 1:17 pm

Hi Yatendra,

Please post it at our upload page.

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

Amol
Advanced
Posts: 176
Joined: Mon May 29, 2006 12:00 am

Re: How to display large number of points with specific color

Post by Amol » Thu Oct 28, 2010 1:10 pm

Hi Narcis,

I uploaded the data file over the link you provided. The name of the file is "XYZ.txt".

Please try it with colorgrid and let me know if colorgrid can be genrated with that data. Please note that Z value denotes the color of a point in this data.

Thanks & Regards

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

Re: How to display large number of points with specific color

Post by Narcís » Thu Oct 28, 2010 2:42 pm

Hi Amol,

Thanks for the file. First of all please notice that I slightly modified your text file, which I attach. I removed some blank spaces to have a uniform structure to be able to load it into TeeChart using code snippet below. However I didn't succeed so I have added this issue (TF02015254) to the defect list to be investigated.

Code: Select all

            tChart1.Aspect.View3D = false;
            tChart1.Dock = DockStyle.Fill;

            Steema.TeeChart.Styles.ColorGrid colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
            colorGrid1.IrregularGrid = true;

            Steema.TeeChart.Data.TextSource ts = new Steema.TeeChart.Data.TextSource();
            try
            {
                Cursor = Cursors.WaitCursor;
                ts.HeaderLines = 2;
                ts.Separator = ' ';
                ts.Series = colorGrid1;
                ts.Fields.Add(0, "X");
                ts.Fields.Add(2, "Y");
                ts.Fields.Add(1, "Z");
                ts.LoadFromFile(@"c:\temp\XYZ.txt");
            }
            finally
            {
                Cursor = Cursors.Default;
            }
Attachments
XYZ.zip
(224.97 KiB) Downloaded 615 times
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