Question

I am using latest telerik winform dll for my C#.net windows application. In my app, I have populated a radchartview( Line chart) control programatically by the following lines:

        LineSeries lineSeria = new LineSeries();
        lineSeria.VerticalAxis.LabelFormat = "{0:#,###}";        // Y axis label formatting
        lineSeria.HorizontalAxis.LabelFormat = "{0:MM/dd/yyyy}"; //X axis label formatting
        lineSeria.HorizontalAxis.LabelRotationAngle = 300;
        lineSeria.HorizontalAxis.LabelFitMode = AxisLabelFitMode.Rotate;
        lineSeria.HorizontalAxis.LabelInterval = graphInterval;
        lineSeria.VerticalAxis.LabelInterval = 2;   

        List<Graph_Stat> lstGraph = _oGraphBal.LoadGraphs(); //Loading a generic list for populating chartview
        lineSeria.ValueMember = "Value"; //decimal value
        lineSeria.CategoryMember = "Date"; //date time
        lineSeria.DataSource = lstGraph;     //setting datasouce for line series
   this.chartFrontedContractsSold.Series.Add(lineSeria); //adding line series to chartview and populating it

Here in this example , I have formatted both X and Y axis labels of chartview. The datetime value in X axis shows the correct formatting result. But the Y axis label not shows any formatted output ( for Eg, if I have a value 1000, it should have to be displayed as 1,000).

Please help me.

-Praveen.

Was it helpful?

Solution

you write the wrong formatstring:

lineSeria.VerticalAxis.LabelFormat = "{0,#,###}"; 

should be

lineSeria.VerticalAxis.LabelFormat = "{0:#,###}"; 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top