Wednesday, March 22, 2017

ASP.NET pie chart control

<asp:Chart ID="ChartFarmProfile" runat="server" Width="450px">
<Series>
<asp:Series Name="Series3">
</asp:Series>
</Series>
<ChartAreas>
<asp:ChartArea Name="ChartArea3">
<AxisX>
<MajorGrid Enabled="False" />
</AxisX>
<AxisY>
<MajorGrid Enabled="False" />
</AxisY>
</asp:ChartArea>
</ChartAreas>
</asp:Chart>

if (DtPlotCrop.Rows.Count > 0)
                    {

                        DataView dv = DtPlotCrop.Rows[0].Table.DefaultView;
                        ChartCropProfile.Series["Series3"].Points.DataBindXY(dv, "Crop_Name", dv, "CropArea");

                        ChartCropProfile.Series["Series3"].ChartType = SeriesChartType.Pie;

                        ChartCropProfile.Series["Series3"]["PointWidth"] = "0.5";
                        ChartCropProfile.Series["Series3"].IsValueShownAsLabel = true;
                        ChartCropProfile.Series["Series3"].Label = "#VALY " + DtPlotCrop.Rows[0]["Unit"];
                        ChartCropProfile.Series["Series3"]["BarLabelStyle"] = "Center";
                        ChartCropProfile.ChartAreas["ChartArea3"].Area3DStyle.Enable3D = true;
                        ChartCropProfile.Series["Series3"]["DrawingStyle"] = "Cylinder";
                        ChartCropProfile.Series["Series3"]["LineColor"] = "Black";
                        ChartCropProfile.Series["Series3"]["LabelStyle"] = "Outside";
                        
                        ChartCropProfile.Series["Series3"].ToolTip = "#VALX (#VALY " + DtPlotCrop.Rows[0]["Unit"] + ")"+ "#PERCENT";

                        ChartCropProfile.Series["Series3"].BackGradientStyle = GradientStyle.DiagonalLeft;
                        ChartCropProfile.Series["Series3"].BackSecondaryColor = System.Drawing.Color.LightGray;



                        ChartCropProfile.Legends.Add(new Legend("Profile"));
                        ChartCropProfile.Legends["Profile"].Title = "Crop Name (Area)";
                        ChartCropProfile.Series[0].LegendText = "#VALX (#VALY " + DtPlotCrop.Rows[0]["Unit"] + ")";

                        ChartCropProfile.Legends[0].TableStyle = LegendTableStyle.Wide;
                        ChartCropProfile.Legends[0].Docking = Docking.Bottom;


                    }

No comments:

HOW TO RECOVER THE SQL DATABASE FROM SUSPECT MODE (Or) HOW TO BRING BACK THE SUSPECTED DATABASE TO THE NORMAL MODE When you logi...