Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1004
sample code to add data in Stacked Bar and column Chart
posted

Hello Infragistics People,

I add Data in Stacked Bar, Column Chart using NumericSeries but how can i add/display the labels in Y Axis in stacked Bar Chart and X Axis in Stacked Column Chart, may be had somebody any sample showing how data are add in such Chart.

Thank you very much

public void RenderSBarChart(UltraChart RenderSBarChart)
        {
            var preset = new ControlChartTyp(SBarChart);
            RenderSBarChart.ChartType = ChartType.StackBarChart;
            RenderSBarChart.Data.ZeroAligned = true;
            RenderSBarChart.LoadPreset(preset.GetFilePath(), true);

            NumericSeries series = GetNumericSeries();
            NumericSeries series2 = GetNumericSeries2();
            RenderSBarChart.StackChart.ChartComponent.Series.Add(series);
            RenderSBarChart.StackChart.ChartComponent.Series.Add(series2);

            RenderSBarChart.Width = 500;
            RenderSBarChart.Height = 400;
        }

        private static NumericSeries GetNumericSeries()
        {
            NumericSeries series1 = new NumericSeries();

            Random roller = new Random();

            series1.Points.Add(new NumericDataPoint(3.0, "Point A", false));
            series1.Points.Add(new NumericDataPoint(50.8, "Point B", false));
            series1.Points.Add(new NumericDataPoint(11.5, "Point C", false));
            series1.Points.Add(new NumericDataPoint(9.9, "Point D", false));
            series1.Points.Add(new NumericDataPoint(1.0, "Point E", false));
            return series1;
        }

        private static NumericSeries GetNumericSeries2()
        {
            NumericSeries series1 = new NumericSeries();

            Random roller = new Random();

            series1.Points.Add(new NumericDataPoint(2.0, "Point A", false));
            series1.Points.Add(new NumericDataPoint(10.0, "Point B", false));
            series1.Points.Add(new NumericDataPoint(1.0, "Point C", false));
            series1.Points.Add(new NumericDataPoint(20.9, "Point D", false));
            series1.Points.Add(new NumericDataPoint(6.7, "Point E", false));
            return series1;
        }