Exporting data in color grid seriese

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

Exporting data in color grid seriese

Post by Amol » Mon Jul 11, 2011 1:16 pm

hi

i am working on color grid seriese.I want to export data, currently exported file have the following format
text X Y Z
. . . .
. . . .
but my desired format is
polygon polygon indexed property value Layer
. . . .
. . . .

For this i use ValuesLists but colorgrid take only three index i.e ValuesLists [0] , ValuesLists [1], ValuesLists [2] in this way i am able to set three header but can not add the fourth header i.e polygon please tell me how to add fourth header




thanks&regards

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

Re: Exporting data in color grid seriese

Post by Sandra » Mon Jul 11, 2011 3:01 pm

Hello Amol,

Can you send us a simple project so we can try to reproduce exactly your problem with export and ColorGrid?

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

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

Re: Exporting data in color grid seriese

Post by Amol » Wed Jul 13, 2011 2:00 pm

hi
i am using colorgrid
in color grid series i am using add method and format of add method is
colorgrid.add(x,y,x,label);
Now when i am exporting data following format is getting
text X Y Z
. . . .
. . . .
but i want to add my own header text in place of text X Y Z for this i use .
colorgrid.ValuesLists[0].Name="Polygon";
colorgrid.ValuesLists[1].Name="polygon index";
colorgrid.ValuesLists[2].Name="Layer";
but when i add colorgrid.ValuesLists[3].Name="polygon value".i got run time exception index out of bound
please tell me how i can add fourth ValuesLists


Tanks&Regards

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

Re: Exporting data in color grid seriese

Post by Sandra » Thu Jul 14, 2011 12:39 pm

Hello Amol,
hi
i am using colorgrid in color grid series i am using add method and format of add method is
colorgrid.add(x,y,x,label); Now when i am exporting data following format is getting
text X Y Z
. . . .
. . . .
but i want to add my own header text in place of text X Y Z for this i use.ç
colorgrid.ValuesLists[0].Name="Polygon";
colorgrid.ValuesLists[1].Name="polygon index";
colorgrid.ValuesLists[2].Name="Layer";
but when i add colorgrid.ValuesLists[3].Name="polygon value".i got run time exception index out of bound
please tell me how i can add fourth ValuesLists
The exception indicates you try access to a value that doesn't exist. So, when you use colorgrid series, you need know that only have 3 values X,Y,Z and for this reason you can not acces to ValueList[3], so it is null. Therefore, I suggest you use IndexFieldName of Export Data to achieve change the Text label of your hedear. You can do something as next:

Code: Select all

 private void InitializeChart()
        {
            tChart1.Aspect.View3D = false;
            Steema.TeeChart.Styles.ColorGrid colorgrid = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);
            colorgrid.FillSampleValues(5);
            colorgrid.ValuesLists[0].Name="Polygon";
            colorgrid.ValuesLists[1].Name="polygon index";
            colorgrid.ValuesLists[2].Name="Layer";            
        }

        private void button1_Click(object sender, EventArgs e)
        {
            tChart1.Export.Data.Excel.IndexFieldName = "polygon value";
            tChart1.Export.Data.Excel.IncludeIndex = true;
            tChart1.Export.Data.Excel.IncludeHeader = true;
            tChart1.Export.Data.Excel.Save(@"C:\tmp\Chart1.xls");

        }
Please, can you confirm us if previous code works for you?

I hope will helps.

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

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

Re: Exporting data in color grid seriese

Post by Amol » Fri Jul 15, 2011 12:59 pm

hi Sandra

the code given by you is not working in my case .
this code set the header name of index column in Exported file .But as i am already told that i want set the header of label column.
in colorgrid add method i.e colorgrid.Add(x,y,z,label);
fourth argument is lebel.I am exporting data with X Y Z alog with label and i am able to set the header of X,Y,Z from following code.
colorgrid.ValuesLists[0].Name="Polygon";
colorgrid.ValuesLists[1].Name="polygon index";
colorgrid.ValuesLists[2].Name="Layer";
but can not set the header of label by this method as already told
please tell me the way by which i can set the header of label.



thanks & regards

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

Re: Exporting data in color grid seriese

Post by Narcís » Fri Jul 15, 2011 1:43 pm

Hi Amol,

You can set label's ValueList name using colorGrid1.Labels.Name as in this example:

Code: Select all

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

    private void InitializeChart()
    {
      Steema.TeeChart.Styles.ColorGrid colorGrid1 = new Steema.TeeChart.Styles.ColorGrid(tChart1.Chart);

      Random y = new Random();
      int c = 0;

      for (int x = 0; x < 10; x++)
      {
        for (int z = 0; z < 10; z++)
        {
          colorGrid1.Add(x, y.Next(), z, "point " + c.ToString());
          c++;
        }
      }

      colorGrid1.ValuesLists[0].Name = "Polygon";
      colorGrid1.ValuesLists[1].Name = "polygon index";
      colorGrid1.ValuesLists[2].Name = "Layer";
      colorGrid1.Labels.Name = "Series Labels";

      tChart1.Export.Data.Excel.IncludeIndex = true;
      tChart1.Export.Data.Excel.IncludeHeader = true;
      tChart1.Export.Data.Excel.IncludeLabels = true;
      tChart1.Export.Data.Excel.Save(@"C:\temp\Chart1.xls");
    }
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