Remove Y-axis Repeated Value

Thread is closed for posting
2 posts, 0 answers
  1. Palaniappan
    Palaniappan avatar
    8 posts
    Member since:
    Jan 2013

    Posted 19 Jul 2013 Link to this post

    Hi Telerik Team,

    I am using Telerik Radchart. How to remove a repeated Y-axis value? Please see the attached file. Value return in Y-axis value 1. But it is repeated in chart. I don't want this type. In case I will check another condition means like (Value return of 1500) It will work fine like (returns 500, 1000, 1500). I want solution for when value returns 1 means that problem need to resolve.

    Please find attached file.

    Regards
    Palaniappan. R
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 24 Jul 2013 Link to this post

    Hi Palaniappan,

    What you are observing is caused by the YAxis labels format string, which rounds the values to integers. In your case the labels most probably correspond to 1.1, 1.0, 0.9, 0.8, 0.7, 0.6 and 0.5. There are several ways that you can approach the problem:
    • You can change the format string to always display the decimal part of the numbers, like this:
      this.chart.PlotArea.YAxis.Appearance.ValueFormat = ChartValueFormat.Number;
    • Depending on what information you are trying to visualize, you can use different views (separately configured RadCharts), or
    • You can programmatically change the control settings similar to this:
      var data = this.chart.DataSource as List<BusinessObject>;
       
      double max = data.Max(item => item.Value);
       
      if (max > 10.0)
      {
          this.chart.PlotArea.YAxis.Appearance.ValueFormat =
             ChartValueFormat.General;
      }
      else
      {
          this.chart.PlotArea.YAxis.Appearance.CustomFormat = "F2";
          this.chart.PlotArea.YAxis.Appearance.ValueFormat =
             ChartValueFormat.None;
      }
       

    I hope this helps. 

    Regards,
    Petar Kirov
    Telerik
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top