Click here to Skip to main content
15,903,203 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
private void Bindchart()
    {
        SqlConnection Conn = new SqlConnection(ConfigurationHelper.ConnectionStringDCI);
        com = new SqlCommand("GetSaleData", Conn);
        com.CommandType = CommandType.StoredProcedure;
        SqlDataAdapter da = new SqlDataAdapter(com);
        DataSet ds = new DataSet();
        da.Fill(ds);
        DataTable ChartData = ds.Tables[0];
        //storing total rows count to loop on each Record  
        string[] XPointMember = new string[ChartData.Rows.Count];
        int[] YPointMember = new int[ChartData.Rows.Count];
        for (int count = 0; count < ChartData.Rows.Count; count++)
        {
            //storing Values for X axis  
            XPointMember[count] = ChartData.Rows[count]["Quarter"].ToString();
            //storing values for Y Axis  
           YPointMember[count] = Convert.ToInt32(ChartData.Rows[count]["SalesValue"]);

        }
        //binding chart control  
        Chart1.Series[0].Points.DataBindXY(XPointMember, YPointMember);

        //Setting width of line  
        Chart1.Series[0].BorderWidth = 10;
        //setting Chart type   
        Chart1.Series[0].ChartType = SeriesChartType.Pie;
      //  Chart1.Series[0].Appearance.DiameterScale = 0.6;

        foreach (Series charts in Chart1.Series)
        {
            foreach (DataPoint point in charts.Points)
            {
                switch (point.AxisLabel)
                {
                    case "Below 31": point.Color = Color.SteelBlue; break;
                    case "Between 31 & 60": point.Color = Color.LightSkyBlue; break;
                    case "Above 60": point.Color = Color.LightSkyBlue; break;
                }
                point.Label = string.Format("{0:0}% -  {1} ", point.YValues[0], point.AxisLabel);
                Chart1.Series["Default"].Font = new Font("Arial", 10.0f, FontStyle.Bold);
                Chart1.Legends["Default"].Font = new Font("Arial", 11.0f, FontStyle.Bold);               
            }
        }             
        Conn.Close();

    }


What I have tried:

I give you Code I want to Know How to show Only Salesvalue in Series and Legend Value in Quarter in this Google Chart So Please Help Me How To Do
Posted
Updated 6-Mar-17 18:16pm
v2
Comments
Member 12183079 7-Mar-17 2:09am    
Please Reply anyone

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900