Staked chart axis label setting.

Thread is closed for posting
2 posts, 0 answers
  1. Srikar
    Srikar avatar
    8 posts
    Member since:
    Nov 2012

    Posted 26 Jun 2013 Link to this post

    I am trying to add radchart of stacked type to aspx page. The chart is bound with following data in code behind file as follows.

       ChartSeries cSeries = new ChartSeries();
                ChartSeries cSeries2 = new ChartSeries();
                cSeries.Type = ChartSeriesType.StackedBar;
                cSeries2.Type = ChartSeriesType.StackedBar;
                cSeries.Name = "Blocks Covered";
                cSeries2.Name = "Blocks not covered";

                Dictionary<string, int> dict = new Dictionary<string, int>();
                dict.Add("Common", 20);
                dict.Add("A1", 30);
                dict.Add("A2", 40);
                dict.Add("A3", 50);
                dict.Add("A4", 60);
                int j = 0;
                foreach (string key in dict.Keys)

                    cSeries.AddItem(dict[key], dict[key].ToString());
                    cSeries2.AddItem(dict[key], j.ToString());
                    chtCodeCoverage.PlotArea.XAxis.Items.Add(new ChartAxisItem(key, Color.Black));

    Required out: x-axis should have key values in dictionary.  Y axis values will be values in dictionary and loop counter values.

    But x-axis lables are not displayed. please help me. Refer screen shot for more details.


  2. Rosko
    Rosko avatar
    137 posts

    Posted 01 Jul 2013 Link to this post

    Hi Srikar,

    You are on the right track. All you need to do is to set AutoScale to false and you will achieve the desired effect.
    chtCodeCoverage.PlotArea.XAxis.AutoScale = false;

    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. DevCraft R3 2016 release webinar banner
Back to Top