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.
Headings/Labels in Export
-
- Site Admin
- Posts: 1349
- Joined: Thu Jan 01, 1970 12:00 am
- Location: Riudellots de la Selva, Catalonia
- Contact:
Hi Brock,
The output from this code is the following:
OK. Have a look at the following code (latest available TeeChart for .NET version):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?
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");
}
- 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;
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/
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/
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.
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.
Hi.
The label header name can also be changed. See the following code:
Export filter uses Texts.Text string as label header. Since it's not a constant string, you can change it to whatever you like.
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);
}
Marjan Slatinek,
http://www.steema.com
http://www.steema.com