Hi Support
Ive set up a simple application. (Im using Visual C# and Visual Studio).
Ive added a TeeChart control and a button to a windows form.
When the user presses the button the following code is run.
Steema.TeeChart.Styles.Line Line1;
Line1 = new Steema.TeeChart.Styles.Line();
tChart1.Series.Add(Line1);
Line1.FillSampleValues(20);
This adds a line to the chart. Ive 2 questions.
1. Why when there is only 1 line displayed is there 2 lines (Line1, Line2) shown in the Legend.
2. How do I set the name in the legend? ie. When I click the button to add the new line how do I set the name in the legend to lets say "Rupert"?
Thanks.
How Do I set values in the Legend?
Hi Dave,
1. Are you sure that you haven't added another line previously (i.e. at design time)?
Here, I drop a chart and a button on a form, and if I use only the following code, it seems to work fine:
If you are sure that you have no other series, please, could you send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
2. You could do this setting a series title, for example:
Finally, note that, by default, if you have only one series, the legend shows its points, not the series name. To change this:
1. Are you sure that you haven't added another line previously (i.e. at design time)?
Here, I drop a chart and a button on a form, and if I use only the following code, it seems to work fine:
Code: Select all
private void button1_Click(object sender, EventArgs e)
{
Steema.TeeChart.Styles.Line Line1;
Line1 = new Steema.TeeChart.Styles.Line();
tChart1.Series.Add(Line1);
Line1.FillSampleValues(20);
}
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
2. You could do this setting a series title, for example:
Code: Select all
Line1.Title = "Rupert";
Code: Select all
tChart1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Series;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |