private void createPieChart() { int offset = 10; PieChartData data = (PieChartData)this.chartData; this.Label = data.Title; // Create a PieChart object ChartDirector.PieChart c = new ChartDirector.PieChart(this.chartPanel.Size.Width, this.chartPanel.Size.Height); int radius = (Math.Min(this.chartPanel.Size.Width, this.chartPanel.Size.Height) - (2 * offset) ) / 2; // Set the center of the pie c.setPieSize(this.chartPanel.Size.Width/2, this.chartPanel.Size.Height/2, radius); // Set the pie data and the pie labels c.setData(data.Data); c.setLabelFormat("{label}"); // output the chart this.chartPanel.Image = c.makeImage(); }
private void buildPieChart() { int offset = 20; PieChartData data = (PieChartData)this.chartData; ChartDirector.PieChart pieChart = new ChartDirector.PieChart(this.chartPanel.Size.Width, this.chartPanel.Size.Height); int radius = (Math.Min(this.chartPanel.Size.Width, this.chartPanel.Size.Height) - (2 * offset)) / 2; // Set the center of the pie pieChart.setPieSize(this.chartPanel.Size.Width/2, this.chartPanel.Size.Height/2, radius); pieChart.addTitle(data.Title); pieChart.setData(data.Data, data.Labels); pieChart.setLabelStyle("", 8); pieChart.set3D(); pieChart.setLabelLayout(1); // output the chart this.chartPanel.Image = pieChart.makeImage(); }