Hi,
I'm using TeeChart v2 in C#.Net.
I want to show the series value in the Legend in WebChart.
I have set
ch1.Legend.LegendStyle = LegendStyles.Values;
ch1.Axes.Bottom.Labels.DateTimeFormat = "yyyy-MM";
The data series are set up at run time.
But when the chart first loaded the legend is like '-- 35.2356 2.05', which actually should be like '-- 1997-01 2.05'. If perform some zoom actions, the legend will turned to currect date format.
Is there any additional settings should be made to get the currect date format in legend when it first loaded?
Thanks a lot~
Value format in the Legend...
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi shangwei,
This works fine for me here using latest TeeChart for .NET v2 release available at the client download area (Build 2.0.2887.28039/40) and this code:
Could you please check if it works fine at your end?
This works fine for me here using latest TeeChart for .NET v2 release available at the client download area (Build 2.0.2887.28039/40) and this code:
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
Steema.TeeChart.Chart ch1 = WebChart1.Chart;
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(ch1);
line1.XValues.DateTime = true;
line1.YValues.DateTime = true;
for (int i = 1; i < 13; i++)
{
line1.Add(DateTime.Parse("01/" + i.ToString() + "/2008"), DateTime.Parse("01/" + i.ToString() + "/2008"));
}
ch1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Values;
ch1.Axes.Bottom.Labels.DateTimeFormat = "yyyy-MM";
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi shangwei,
Yes, that's true, I've added this problem to our defect list (TF02012761) to be fixed for future releases. In the meantime, as a workaround, you can use legend's GetText event as shown here:
Yes, that's true, I've added this problem to our defect list (TF02012761) to be fixed for future releases. In the meantime, as a workaround, you can use legend's GetText event as shown here:
Code: Select all
protected void Page_Load(object sender, EventArgs e)
{
Steema.TeeChart.Chart ch1 = WebChart1.Chart;
Steema.TeeChart.Styles.Line line1 = new Steema.TeeChart.Styles.Line(ch1);
line1.XValues.DateTime = true;
line1.YValues.DateTime = true;
for (int i = 1; i < 13; i++)
{
line1.Add(DateTime.Parse("01/" + i.ToString() + "/2008"), DateTime.Parse("01/" + i.ToString() + "/2008"));
}
//ch1.Legend.LegendStyle = Steema.TeeChart.LegendStyles.Values;
ch1.Legend.TextStyle = Steema.TeeChart.LegendTextStyles.XAndValue;
ch1.Axes.Bottom.Labels.DateTimeFormat = "yyyy-MM";
WebChart1.GetLegendText += new Steema.TeeChart.GetLegendTextEventHandler(WebChart1_GetLegendText);
}
void WebChart1_GetLegendText(object sender, Steema.TeeChart.GetLegendTextEventArgs e)
{
string tmpStr = e.Text.Substring(0, 6); ;
e.Text = DateTime.FromOADate(Convert.ToDouble(tmpStr)).ToShortDateString() + e.Text.Remove(0,6);
}
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |