⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 charserviceimpl.java

📁 使用jfreechart制作jsp图形统计
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
					.pie2D(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String pie3DChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.pie3D(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.pie3D(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String pie2DMultipleChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.pie2DMultiple(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.pie2DMultiple(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String pie3DMultipleChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.pie3DMultiple(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.pie3DMultiple(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String ringChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.ring(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.ring(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String scatterChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.scatter(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.scatter(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String histogramChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.histogram(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.histogram(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String bubbleChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.bubble(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.bubble(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String ganttChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.gantt(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.gantt(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String highLowChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.highLow(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.highLow(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String candlestickChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.candlestick(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.candlestick(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String polarChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.polar(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.polar(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String waferMapChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.waferMap(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.waferMap(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String waterFallChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.waterFall(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.waterFall(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String timeSeriesChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.timeSeries(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.timeSeries(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	public String windPlotChar(DatasetObj datasetObj, String reportpath,
			String imgname, String imgtype, int width, int hight)
			throws Exception {
		charname = reportpath + imgname + "." + imgtype;
		image = imgname + "." + imgtype;
		if ("png".equals(imgtype)) {
			isChartAsPNG(new FileOutputStream(charname), this.crimpl
					.windPlot(datasetObj), width, hight);
		} else if ("jpg".equals(imgtype)) {
			isChartAsJPEG(new FileOutputStream(charname), this.crimpl
					.windPlot(datasetObj), width, hight);
		} else {
			image = "";
		}
		return image;
	}

	/**
	 * 生成PNG图
	 * 
	 * @throws IOException
	 */
	private static void isChartAsPNG(FileOutputStream fos_jpg,
			JFreeChart chart, int width, int hight) throws Exception {
		ChartUtilities.writeChartAsPNG(fos_jpg, chart, width, hight);
		fos_jpg.close();
	}

	/**
	 * 生成JPEG图
	 * 
	 * @throws IOException
	 */
	private static void isChartAsJPEG(FileOutputStream fos_jpg,
			JFreeChart chart, int width, int hight) throws Exception {
		ChartUtilities.writeChartAsJPEG(fos_jpg, 0.7f, chart, width, hight);
		fos_jpg.close();
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -