コード例 #1
0
		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
		}
コード例 #2
0
ファイル: ChartThumbnail.cs プロジェクト: wshanshan/DDD
		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();  
		}
コード例 #3
0
ファイル: ChartForm.cs プロジェクト: wshanshan/DDD
		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();  				
		}