2
Answers

What is my mistake?

Vikas Ahlawat

Vikas Ahlawat

14y
2.5k
1
I m using telerik control on my form i m using 3 chart control to show data with diff - diff shape like pie line bar,
But my problem is that all three show same shape(which i m applying on radchart1).

according to this code all three show pie chart. not line so what i m doing wrong.

       da.Fill(ds, "Marks");
            da1.Fill(ds, "SubjectNames");
            radChart1.PlotArea.XAxis.AxisLabel.TextBlock.Text = "Years";
            //radChart1.DataSource = ds.Tables["v"];

            ChartSeries[] a;
            a = new ChartSeries[totalpapsers];
            ChartSeries[] b;
            b = new ChartSeries[totalpapsers];
            ChartSeries[] c;
            c = new ChartSeries[totalpapsers];



           

            //radChart3.DataSource = ds.Tables["Marks"];
            //radChart4.DataSource = ds.Tables["Marks"];
            ////radChart1.Skin = "LightBlue";
            //radChart3.DataBind();
            //radChart4.DataBind();


            for (int i = 0; i < totalpapsers; i++)
            {
                a[i] = new ChartSeries();
                a[i].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][i]));
                a[i].Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][3 + i]);
                a[i].Type = ChartSeriesType.Pie;
            }
            radChart1.Clear();

            for (int i = 0; i < totalpapsers; i++)
            {
                radChart1.Series.Add(a[i]);
            }

            radChart1.DataBind();



            for (int i = 0; i < totalpapsers; i++)
            {
                b[i] = new ChartSeries();
                b[i].Type = ChartSeriesType.Line;
                b[i].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][i]));
                b[i].Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][3 + i]);
            }
            radChart3.Clear();

            for (int i = 0; i < totalpapsers; i++)
            {
                radChart3.Series.Add(a[i]);
            }

            radChart3.DataBind();




            for (int i = 0; i < totalpapsers; i++)
            {
                c[i] = new ChartSeries();
                c[i].AddItem(Convert.ToInt32(ds.Tables["Marks"].Rows[0][i]));
                c[i].Name = Convert.ToString(ds.Tables["SubjectNames"].Rows[0][3 + i]);
                c[i].Type = ChartSeriesType.Line;
            }
            radChart4.Clear();

            for (int i = 0; i < totalpapsers; i++)
            {
                radChart4.Series.Add(a[i]);
            }

            radChart4.DataBind();

            con.Close();

Answers (2)