C# winform chart控件 怎么能才能显示出百分比?
源代码Seriesseries=newSeries();series.ChartType=SeriesChartType.Pie;series.CustomPropert...
源代码
Series series = new Series();
series.ChartType = SeriesChartType.Pie;
series.CustomProperties = "PieDrawingStyle=SoftEdge,PieLabelStyle=Enabled,DoughnutRadius=60";
series.Points.DataBindXY(xValue, yValue);
series.Label = "#VAL" + "人";
series.LegendText = "#VALX";
chart1.Titles.Add(LINE_NAME + "[" + Title + "]结构图");
this.chart1.Series.Add(series);
chart1.Series["Series1"]["PieLabelStyle"] = "Outside"; //线
chart1.ChartAreas[0].Area3DStyle.Enable3D = true;//3D效果 展开
Series series = new Series();
series.ChartType = SeriesChartType.Pie;
series.CustomProperties = "PieDrawingStyle=SoftEdge,PieLabelStyle=Enabled,DoughnutRadius=60";
series.Points.DataBindXY(xValue, yValue);
series.Label = "#VAL" + "人";
series.LegendText = "#VALX";
chart1.Titles.Add(LINE_NAME + "[" + Title + "]结构图");
this.chart1.Series.Add(series);
chart1.Series["Series1"]["PieLabelStyle"] = "Outside"; //线
chart1.ChartAreas[0].Area3DStyle.Enable3D = true;//3D效果 展开
展开全部
chart2.Legends[0].Enabled = false;//不显示图例chart2.ChartAreas[0].BackColor = Color.White;//设置背景为白色chart2.ChartAreas[0].Area3DStyle.Enable3D = true;//设置3D效果chart2.ChartAreas[0].Area3DStyle.PointDepth = chart2.ChartAreas[0].Area3DStyle.PointGapDepth = 50;//设置一下深度,看起来舒服点……chart2.ChartAreas[0].Area3DStyle.WallWidth = 0;//设置墙的宽度为0;chart2.ChartAreas[0].AxisY.LabelStyle.Format = "0%";//格式化,为了显示百分号chart2.ChartAreas[0].AxisY.Interval = 0.05;//设置刻度间隔为5%chart2.ChartAreas[0].AxisX.MajorGrid.Enabled = chart2.ChartAreas[0].AxisY.MajorGrid.Enabled = false;//不显示网格线chart2.ChartAreas[0].AxisX.Minimum = 0.5;//设置最小值,为了让第一个柱紧挨坐标轴chart2.Series[0].Label = "#VAL{P}";//设置标签文本 (在设计期通过属性窗口编辑更直观)chart2.Series[0].IsValueShownAsLabel = true;//显示标签chart2.Series[0].CustomProperties = "DrawingStyle=Cylinder, PointWidth=1";//设置为圆柱形 (在设计期通过属性窗口编辑更直观)chart2.Series[0].Palette = System.Windows.Forms.DataVisualization.Charting.ChartColorPalette.Pastel;//设置调色板//数据chart2.Series[0].Points.AddXY("<10",0.201);chart2.Series[0].Points.AddXY("10~20", 0.395);chart2.Series[0].Points.AddXY("20~30", 0.173);chart2.Series[0].Points.AddXY("30~40", 0.136);chart2.Series[0].Points.AddXY("40~50", 0.059);chart2.Series[0].Points.AddXY("50~60", 0.015);chart2.Series[0].Points.AddXY(">60", 0.022);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询