📄 charserviceimpl.java
字号:
package com.service.impl;
import java.io.FileOutputStream;
import java.io.IOException;
import org.jfree.chart.ChartUtilities;
import org.jfree.chart.JFreeChart;
import com.domain.DatasetObj;
import com.report.CharReport;
import com.report.impl.CharReportImpl;
import com.service.CharService;
public class CharServiceImpl implements CharService {
private CharReport crimpl = new CharReportImpl();
private String charname;
private String image;
public String line2DChar(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
.line2D(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.line2D(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String line3DChar(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
.line3D(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.line3D(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String lineDataPointChar(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
.lineDataPoint(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.lineDataPoint(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String areaChar(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
.area(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.area(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String areaStackedChar(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
.areaStacked(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.areaStacked(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String areaDataPointChar(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
.areaDataPoint(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.areaDataPoint(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String areaDataStepChar(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
.areaDataStep(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.areaDataStep(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String areaDataStackedChar(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
.areaDataStacked(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.areaDataStacked(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String bar2DChar(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
.areaDataStep(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.areaDataStep(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String bar3DChar(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
.bar3D(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.bar3D(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String barLine2DChar(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
.barLine2D(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.barLine2D(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String barLine3DChar(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
.barLine3D(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.barLine3D(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String barDataPointChar(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
.barDataPoint(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.barDataPoint(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String bar2DStackedChar(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
.bar2DStacked(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.bar2DStacked(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String bar3DStackedChar(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
.bar3DStacked(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
.bar3DStacked(datasetObj), width, hight);
} else {
image = "";
}
return image;
}
public String pie2DChar(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
.pie2D(datasetObj), width, hight);
} else if ("jpg".equals(imgtype)) {
isChartAsJPEG(new FileOutputStream(charname), this.crimpl
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -