Small percentage values in Chart DataTable

Thread is closed for posting
2 posts, 0 answers
  1. Christopher
    Christopher avatar
    1 posts
    Member since:
    Dec 2011

    Posted 20 Jan 2012 Link to this post

    Hello,

    I am working with a RadChart as a stacked bar style and showing the DataTable below the chart which shows value percentages. However, I am using some values with large range differences and this means several of my data items are less than 1% but show as 0% in the DataTable. Is it possible to change the DataTable values to show percentages less than 1%?

    Thanks
  2. jumpstart
    jumpstart avatar
    479 posts
    Member since:
    Nov 2011

    Posted 23 Jan 2012 Link to this post

    Christopher:

    Depending on the ratio of sub 1% values, you could set AutoScale=false for the Y-axis and then set an arbitrary value for the YAxis.MaxValue that would better display the smaller values and just let the large values shoot through the roof.

    Default.aspx.cs:
    using System;
    using System.Web;
    using System.Web.UI;
    using System.Web.UI.WebControls;
     
    using System.Data;
    using System.Configuration;
    using System.Web.Security;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using Telerik.Web.UI;
    using Telerik.Charting;
     
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                LoadChart();
            }
        }
     
        private void LoadChart()
        {
            RadChart1.Series.Clear();
     
            ChartSeries c = new ChartSeries("Series1", ChartSeriesType.StackedBar);
     
            c.AddItem(.1);
            c.AddItem(10);
            c.AddItem(.3);
            c.AddItem(25);
            c.AddItem(.6);
            c.AddItem(75);
            c.AddItem(.2);
            c.AddItem(150);
            c.AddItem(.8);
            c.AddItem(200);
     
            RadChart1.AddChartSeries(c);
     
            RadChart1.PlotArea.YAxis.AutoScale = false;
            RadChart1.PlotArea.YAxis.MaxValue = 25;
        }
    }

    See attached image for display.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top