Headings/Labels in Export

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
brock
Newbie
Newbie
Posts: 2
Joined: Wed Jan 08, 2003 5:00 am
Contact:

Headings/Labels in Export

Post by brock » Mon Jul 05, 2004 2:37 pm

I'm using the following to export to a csv file:
m_Chart.Export().Data.Text.TextDelimiter = ", "
m_Chart.Export().Data.Text.TextLineSeparator = vbCrLf
m_Chart.Export().Data.Text.IncludeHeader = True
m_Chart.Export().Data.Text.IncludeLabels = True
Dim ms As IO.MemoryStream = New IO.MemoryStream
m_Chart.Export().Data.Text.Series = m_Chart.Series(0)
m_Chart.Export().Data.Text.Save(ms)

And my output is like follows:
Text, Bar1
15, 100
16, 0
17, 0
18, 0
19, 0
20, 0
21, 0
22, 0

My problem is, I want my x and y axes labels to replace the "Text, Bar1" line. In my code above, it looks like IncludeLabels is not doing anything (if I remove, I get the same output). What properties in the series or bar to I have to set in order to have the labels that are displayed on the axes of the graph in the export. I know I could change the name of Bar1 to whatever my y-axis label is, but I have no idea where the "Text" is coming from?

Thanks for any help.

Christopher
Site Admin
Site Admin
Posts: 1349
Joined: Thu Jan 01, 1970 12:00 am
Location: Riudellots de la Selva, Catalonia
Contact:

Post by Christopher » Tue Jul 06, 2004 10:43 am

Hi Brock,
My problem is, I want my x and y axes labels to replace the "Text, Bar1" line. In my code above, it looks like IncludeLabels is not doing anything (if I remove, I get the same output). What properties in the series or bar to I have to set in order to have the labels that are displayed on the axes of the graph in the export. I know I could change the name of Bar1 to whatever my y-axis label is, but I have no idea where the "Text" is coming from?
OK. Have a look at the following code (latest available TeeChart for .NET version):

Code: Select all

private void Form1_Load(object sender, System.EventArgs e) {
	Steema.TeeChart.Styles.Bar bar1 = new Steema.TeeChart.Styles.Bar(tChart1.Chart);
	bar1.Title = "MyBarSeries";
	Random rnd = new Random();
	for(double i=0;i<10;++i) {
		bar1.Add(i,rnd.Next(100), "string" + i.ToString(), Color.Red);
	}
}

private void button1_Click(object sender, System.EventArgs e) {
	tChart1.Export.Data.Text.Series = tChart1[0];
	tChart1.Export.Data.Text.IncludeHeader = true;
	tChart1.Export.Data.Text.IncludeIndex = true;
	tChart1.Export.Data.Text.IncludeLabels = true;
	tChart1.Export.Data.Text.TextLineSeparator = ";";
	tChart1.Export.Data.Text.Save(@"C:\TEMP\exptxt.txt");
}
The output from this code is the following:
  • Index Text MyBarSeries;
    0 string0 49;
    1 string1 40;
    2 string2 9;
    3 string3 33;
    4 string4 91;
    5 string5 33;
    6 string6 51;
    7 string7 54;
    8 string8 72;
    9 string9 42;
Here, the Text field is coming from the string text argument of the Add() overloads which contain it.
Thank you!

Christopher Ireland (Steema crew)
Please be aware of the newsgroup archives:
http://www.teechart.net/support/search.php
http://groups.google.com
http://codenewsfast.com/

brock
Newbie
Newbie
Posts: 2
Joined: Wed Jan 08, 2003 5:00 am
Contact:

Post by brock » Fri Jul 09, 2004 10:31 pm

Thanks for the reply Chris...

I can change the Bar1.Title = "Uptime %", but what I also need to do is change the "Text" header for the x-axis label (which in this particular case represents "Hour") to "Hour" which is what is actually the text displayed on my x-axis.

Is this possible or will "Text" (for the column header) always be displayed no matter what. If that is the case, I will need to write my own export routine to go through the values and display the x/y-axis as the column header. Not really a problem, but I was hoping to use the built-in export functionality.

Thanks.

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Sat Jul 10, 2004 9:48 am

Hi.

The label header name can also be changed. See the following code:

Code: Select all

      bar1.YValues.Name = "MyBarSeries";
      Steema.TeeChart.Texts.Text = "Hour"; // << Export filter uses Texts.Text as label header
      Random rnd = new Random(); 
      for(double i=0;i<10;++i) 
      { 
        bar1.Add(i,rnd.Next(100), "string" + i.ToString(), Color.Red); 
      } 
Export filter uses Texts.Text string as label header. Since it's not a constant string, you can change it to whatever you like.
Marjan Slatinek,
http://www.steema.com

Post Reply