This is a migrated thread and some comments may be shown as answers.

Staked chart axis label setting.

1 Answer 31 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Srikar
Top achievements
Rank 1
Srikar asked on 26 Jun 2013, 02:05 PM
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)
            {
                j++;

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

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.

Thanks,
Srikar.

1 Answer, 1 is accepted

Sort by
0
Rosko
Telerik team
answered on 01 Jul 2013, 07:28 AM
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;

Regards,
Rosko
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.
Tags
Chart (Obsolete)
Asked by
Srikar
Top achievements
Rank 1
Answers by
Rosko
Telerik team
Share this question
or