Format not working for series points and XAxis

Hi,

I have a line chart, bound to a List.
The chart displays the data, however there are 2 issues:

1. the points' values are float with many decimals.
I need to display only 2 decimals.

ChartSeries userScoreSeries;

I tried
userScoreSeries.Style.TextFormat = "0#.##";

but it doesn't work, instead of formatted values, I get only "0#.##"

2. The X axis has dates, which need to be formated to a certain country and certain format.

I tried

saveScoreChart.PrimaryXAxis.ValueType = ChartValueType.DateTime;
saveScoreChart.PrimaryXAxis.Format = "dd MMMM yyyy";

No luck.

I tried attaching an event handler to FormatLabel and set the format in the handler:

void PrimaryXAxis_FormatLabel( object sender, ChartFormatAxisLabelEventArgs e )
{
e.Label = e.ValueAsDate.ToString("dd MMMM yyyy");
e.Handled = true;
}

I get some strange values, don't know from where, formatted as dates, which are tottaly wrong.


Can someone tell me how to format the series and the axis?

Thanks,
Daniel


2 Replies

DB Daniel Blendea September 13, 2010 06:58 AM UTC

Anybody?



JB Jaffersathick B Syncfusion Team September 14, 2010 08:43 AM UTC

Hi Daniel,

Thank you for using Syncfusion products.
We suggest you to use the DateTimeFormat property of the Primary X axis to format the datetime value of the Chart Axis labels.

Please refer the documentation from the following link:


http://help.syncfusion.com/ug_83/User%20Interface/ASP.NET/Chart/default.htm?turl=Documents/axislabeltextformattingappearanceandpositioning.htm

Let me know if it helps.
Regards,
Jaffer



Loader.
Up arrow icon