本文整理汇总了Java中org.jfree.chart.renderer.xy.XYItemRenderer.setSeriesShape方法的典型用法代码示例。如果您正苦于以下问题:Java XYItemRenderer.setSeriesShape方法的具体用法?Java XYItemRenderer.setSeriesShape怎么用?Java XYItemRenderer.setSeriesShape使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.chart.renderer.xy.XYItemRenderer
的用法示例。
在下文中一共展示了XYItemRenderer.setSeriesShape方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GenerateRTMapPNG
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
private void GenerateRTMapPNG(XYSeriesCollection xySeriesCollection, XYSeries series, float R2) throws IOException {
new File(Workfolder + "/RT_Mapping/").mkdir();
String pngfile = Workfolder + "/RT_Mapping/" + FilenameUtils.getBaseName(LCMSA.mzXMLFileName).substring(0, Math.min(120, FilenameUtils.getBaseName(LCMSA.mzXMLFileName).length() - 1)) + "_" + FilenameUtils.getBaseName(LCMSB.mzXMLFileName).substring(0, Math.min(120, FilenameUtils.getBaseName(LCMSB.mzXMLFileName).length() - 1)) + "_RT.png";
XYSeries smoothline = new XYSeries("RT fitting curve");
for (XYZData data : regression.PredictYList) {
smoothline.add(data.getX(), data.getY());
}
xySeriesCollection.addSeries(smoothline);
xySeriesCollection.addSeries(series);
JFreeChart chart = ChartFactory.createScatterPlot("Retention time mapping: R2=" + R2, "RT:" + FilenameUtils.getBaseName(LCMSA.mzXMLFileName), "RT:" + FilenameUtils.getBaseName(LCMSB.mzXMLFileName), xySeriesCollection,
PlotOrientation.VERTICAL, true, true, false);
XYPlot xyPlot = (XYPlot) chart.getPlot();
xyPlot.setDomainCrosshairVisible(true);
xyPlot.setRangeCrosshairVisible(true);
XYItemRenderer renderer = xyPlot.getRenderer();
renderer.setSeriesPaint(1, Color.blue);
renderer.setSeriesPaint(0, Color.BLACK);
renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0, 3, 3));
renderer.setSeriesStroke(1, new BasicStroke(3.0f));
renderer.setSeriesStroke(0, new BasicStroke(3.0f));
xyPlot.setBackgroundPaint(Color.white);
ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
}
示例2: updateChart
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
public void updateChart(double[] data) {
this.removeAll();
this.revalidate();
series = new XYSeries("XYGraph");
for(int i=0; i<data.length;i++){
if(data[i]>-1){
series.add(5*i , data[i]/255 );
}
}
dataset = new XYSeriesCollection();
dataset.addSeries(series);
chart = ChartFactory.createScatterPlot(
null, // Title
"ω [rad/s]", // x-axis Label
"Q / Qmax", // y-axis Label
dataset, // Dataset
PlotOrientation.VERTICAL,
false, // Show Legend
true, // Use tooltips
false // Configure chart to generate URLs?
);
XYPlot plot = (XYPlot) chart.getPlot();
plot.setBackgroundPaint( Color.WHITE );
XYItemRenderer renderer = plot.getRenderer();
renderer.setSeriesPaint(0, Color.RED);
double delta = 2.0;
Shape shape1 = new Rectangle2D.Double(-delta, -delta, delta, delta);
renderer.setSeriesShape(0, shape1);
ValueAxis yAxis = plot.getRangeAxis();
yAxis.setRange(0, 1.1);
ValueAxis xAxis = plot.getDomainAxis();
xAxis.setRange(0, 2000);
ChartPanel cp = new ChartPanel(chart);
cp.setBackground(Color.WHITE);
this.setLayout(new BorderLayout());
this.add(cp, BorderLayout.CENTER);
this.repaint();
}
示例3: GenerateRTMapPNG
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
private void GenerateRTMapPNG(XYSeriesCollection xySeriesCollection, XYSeries series, float R2) throws IOException {
String pngfile = FilenameUtils.getFullPath(TargetLCMS.mzXMLFileName) + "/" + FilenameUtils.getBaseName(TargetLCMS.mzXMLFileName) + "_" + libManager.LibID + "_RTMap.png";
FileWriter writer = new FileWriter(FilenameUtils.getFullPath(TargetLCMS.mzXMLFileName) + "/" + FilenameUtils.getBaseName(TargetLCMS.mzXMLFileName) + "_" + libManager.LibID + "_RTMap.txt");
XYSeries smoothline = new XYSeries("RT fitting curve");
for (XYZData data : regression.PredictYList) {
smoothline.add(data.getX(), data.getY());
writer.write(data.getX() + "\t" + data.getY() + "\n");
}
writer.close();
xySeriesCollection.addSeries(smoothline);
xySeriesCollection.addSeries(series);
JFreeChart chart = ChartFactory.createScatterPlot("Retention time mapping: R2=" + R2, "Normalized RT (" + libManager.LibID + ")", "RT:" + FilenameUtils.getBaseName(TargetLCMS.mzXMLFileName), xySeriesCollection,
PlotOrientation.VERTICAL, true, true, false);
XYPlot xyPlot = (XYPlot) chart.getPlot();
xyPlot.setDomainCrosshairVisible(true);
xyPlot.setRangeCrosshairVisible(true);
XYItemRenderer renderer = xyPlot.getRenderer();
renderer.setSeriesPaint(1, Color.blue);
renderer.setSeriesPaint(0, Color.BLACK);
renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0, 3, 3));
renderer.setSeriesStroke(1, new BasicStroke(3.0f));
renderer.setSeriesStroke(0, new BasicStroke(3.0f));
xyPlot.setBackgroundPaint(Color.white);
ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
}
示例4: copyNumberCDF
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
@NotNull
static JFreeChart copyNumberCDF(@NotNull final List<PurpleCopyNumber> copyNumbers) {
final XYDataset dataset = CopyNumberCharts.createDataset(copyNumbers);
JFreeChart chart =
ChartFactory.createScatterPlot("Copy Number CDF", "BAF Weighting (CDF)", "Ploidy", dataset, PlotOrientation.VERTICAL, false,
false, false);
XYPlot xyPlot = (XYPlot) chart.getPlot();
XYItemRenderer renderer = ((XYPlot) chart.getPlot()).getRenderer();
Shape shape = new Ellipse2D.Double(0, 0, 4, 4);
renderer.setSeriesShape(0, shape);
renderer.setSeriesPaint(0, Color.blue);
xyPlot.getRangeAxis().setRange(0, 10);
return chart;
}
示例5: GenerateMassCalibrationRTMap
import org.jfree.chart.renderer.xy.XYItemRenderer; //导入方法依赖的package包/类
public void GenerateMassCalibrationRTMap() throws IOException {
String pngfile = FilenameUtils.getFullPath(ScanCollectionName) + "/" + FilenameUtils.getBaseName(ScanCollectionName) + "_masscaliRT.png";
XYSeries series = new XYSeries("PSM");
XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
LoessInterpolator loessInterpolator = new LoessInterpolator(
0.75,//bandwidth,
2//robustnessIters
);
for (PSM psm : this.IDsummary.PSMList.values()) {
float ppm = InstrumentParameter.CalcSignedPPM(psm.ObserPrecursorMass, psm.NeutralPepMass);
series.add(new XYDataItem(psm.RetentionTime, ppm));
}
double x[] = new double[IDsummary.PSMList.size()];
double y[] = new double[x.length];
double currentmin = 0f;
for (int i = 0; i < series.getItemCount(); i++) {
x[i] = (double) series.getX(i);
if (x[i] <= currentmin) {
x[i] = currentmin + 0.0001f;
}
currentmin = x[i];
y[i] = (double) series.getY(i);
}
Masscalibrationfunction = loessInterpolator.interpolate(x, y);
XYSeries smoothline = new XYSeries("Loess Regression");
double xvalue = series.getMinX();
while (xvalue < series.getMaxX()) {
smoothline.add(xvalue, Masscalibrationfunction.value(xvalue));
xvalue += 0.05d;
}
xySeriesCollection.addSeries(smoothline);
xySeriesCollection.addSeries(series);
JFreeChart chart = ChartFactory.createScatterPlot("Mass calibration", "RT", "Mass error (ppm)", xySeriesCollection,
PlotOrientation.VERTICAL, true, true, false);
XYPlot xyPlot = (XYPlot) chart.getPlot();
xyPlot.setDomainCrosshairVisible(true);
xyPlot.setRangeCrosshairVisible(true);
XYItemRenderer renderer = xyPlot.getRenderer();
renderer.setSeriesPaint(1, Color.blue);
renderer.setSeriesPaint(0, Color.BLACK);
renderer.setSeriesShape(1, new Ellipse2D.Double(0, 0, 3, 3));
renderer.setSeriesStroke(1, new BasicStroke(1.0f));
xyPlot.setBackgroundPaint(Color.white);
ChartUtilities.saveChartAsPNG(new File(pngfile), chart, 1000, 600);
}