回复 3楼Hjr2350的帖子
- string colors = "#ffbb22,#ff9911,#aacc33,#aabbbb,#bb0033,#00cc33,#990099,#0011aa,#14D0EE,#B17EC3,#E67F16,#EE5907,#6A2DA1,#0A35F0,#A816D7,#D218AD,#EE0A96,#5A4DAE,#ACE9D9";
- PieSeries pseries = new PieSeries();
- pseries.Values.AddRange(new double[] { 0.2, 0.3, 0.1, 0.2, 0.2 });
- pseries.LabelVisible = true;
- pseries.LabelFormatter = new FarPoint.Win.Spread.Model.GeneralFormatter("0.00%", false);
- FillCollection fc = pseries.PieFills;
- List<SolidFill> list = new List<SolidFill>();
- foreach (string color in colors.Split(new char[] { ',' }))
- {
- list.Add(new SolidFill(ColorTranslator.FromHtml(color)));
- }
- fc.Clear();
- fc.AddRange(list.ToArray());
- PiePlotArea plotArea = new PiePlotArea();
- plotArea.Location = new PointF(0.2f, 0.2f);
- plotArea.Size = new SizeF(0.6f, 0.6f);
- plotArea.Series.Add(pseries);
- ChartModel model = new ChartModel();
- model.PlotAreas.Add(plotArea);
- //FarPoint.Win.Spread.Chart.SpreadChart char000 = new FarPoint.Win.Spread.Chart.SpreadChart();
- //char000.Top = 0;
- //char000.Left = 0;
- //fpSpread1.ActiveSheet.Charts.Add(char000);
- //fpSpread1.ActiveSheet.Charts[0].Model = model;
-
- FarPoint.Win.Spread.Chart.SpreadChart chart = fpSpread1.ActiveSheet.AddChart(0, 0, typeof(FarPoint.Win.Chart.PieSeries), 400, 400, 0, 0);
- chart.Model = model;
复制代码 |