public bool loadData(PieChartData pieChartData) {

            this.pieChart = new ChartDirector.PieChart(this.Size.Width, this.Size.Height); 

			switch (this.validateData(pieChartData)) {
				case DataValidation.INVALID:
					this.drawInvalidChart("Invalid Data");
					return false;
				case DataValidation.EXCEEDS100PERCENT:
					this.drawInvalidChart("Sum of all percent values exceeds 100%");
					return false;
				case DataValidation.VALID:
					//if (!this.compareTo(pieChartData)) {
						//this.drawInvalidChart("Valid DATA, GREAT!!!");
						this.chartData = pieChartData;
						this.drawChart();
					//}
					return true;
			}
			return false; //unknown case
		}
Exemplo n.º 2
0
		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();  
		}
Exemplo n.º 3
0
		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();  				
		}