ChartView Y axis formatting, value too big or too wide ?

3 posts, 1 answers
  1. Dominic
    Dominic avatar
    7 posts
    Member since:
    Oct 2017

    Posted 31 May 2020 Link to this post

    Hi,

    I'm programming with VB.NET, I need help with the ChartView Y-axis value formatting.

    Can you let me know how to format the Y-axis with thousand separator instead of the exponential format and how to widen the Y axis if this is the issue.

    I attached a screenshot...

    Thanks and best regards,

    Dominic

  2. Answer
    Nadya
    Admin
    Nadya avatar
    486 posts

    Posted 01 Jun 2020 Link to this post

    Hello Dominic,

    In order to format the Y-axis, you should access the LinearAxis and set its LabelFormat property to the custom format that you would like to display. By default, the AxisLabelElements are as wide as necessary to display the whole value. More information is available here. Below is an example:

    Public Sub New()
        InitializeComponent()
    
        Dim barSeries As BarSeries = New BarSeries()
        barSeries.Name = "Q1"
        barSeries.DataPoints.Add(New CategoricalDataPoint(17000000, DateTime.Now))
        barSeries.DataPoints.Add(New CategoricalDataPoint(128000000, DateTime.Now.AddDays(1)))
        barSeries.DataPoints.Add(New CategoricalDataPoint(143000000, DateTime.Now.AddDays(2)))
        barSeries.DataPoints.Add(New CategoricalDataPoint(111000000, DateTime.Now.AddDays(3)))
        barSeries.DataPoints.Add(New CategoricalDataPoint(118000000, DateTime.Now.AddDays(4)))
        Me.radChartView1.Series.Add(barSeries)
        Dim verticallAxis As LinearAxis = radChartView1.Axes.[Get](Of LinearAxis)(1)
        verticallAxis.LabelFitMode = AxisLabelFitMode.None
        verticallAxis.LabelFormat = "{0:#,###,###}"
    End Sub

    I hope this helps. Let me know if you need further assistance.

    Regards,
    Nadya
    Progress Telerik

    Progress is here for your business, like always. Read more about the measures we are taking to ensure business continuity and help fight the COVID-19 pandemic.
    Our thoughts here at Progress are with those affected by the outbreak.
  3. Dominic
    Dominic avatar
    7 posts
    Member since:
    Oct 2017

    Posted 01 Jun 2020 in reply to Nadya Link to this post

    Hi Nadya,

     

    Great it works perfectly.

     

    Thanks,

    Dominic

Back to Top