本文整理汇总了Java中org.jfree.data.xy.XYSeriesCollection.addSeries方法的典型用法代码示例。如果您正苦于以下问题:Java XYSeriesCollection.addSeries方法的具体用法?Java XYSeriesCollection.addSeries怎么用?Java XYSeriesCollection.addSeries使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.XYSeriesCollection
的用法示例。
在下文中一共展示了XYSeriesCollection.addSeries方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: GenerateRTMapPNG
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的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: testXYAutoRange2
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
/**
* Checks that the auto-range for the range axis on an XYPlot is
* working as expected.
*/
public void testXYAutoRange2() {
XYSeries series = new XYSeries("Series 1");
series.add(1.0, 1.0);
series.add(2.0, 2.0);
series.add(3.0, 3.0);
XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(series);
JFreeChart chart = ChartFactory.createScatterPlot(
"Test",
"X",
"Y",
dataset,
PlotOrientation.VERTICAL,
false,
false,
false
);
XYPlot plot = (XYPlot) chart.getPlot();
NumberAxis axis = (NumberAxis) plot.getRangeAxis();
axis.setAutoRangeIncludesZero(false);
assertEquals(0.9, axis.getLowerBound(), EPSILON);
assertEquals(3.1, axis.getUpperBound(), EPSILON);
}
示例3: addSeries
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
private void addSeries(double[][] data,String[] seriesLabel,int xcolumn,Paint[] color){
int length = data.length;
int numberOfSeries = data[0].length-1;
//int currentSize = seriesColor.size();
for (int j = 0; j < numberOfSeries+1; j++) {
XYSeriesCollection seriesCollection = new XYSeriesCollection();
XYSeries series = new XYSeries(seriesLabel[0],false);
if(j==xcolumn)
continue;
else{
seriesColor.add(color[(j>=xcolumn)?j-1:j]);
for(int i=0;i<length;i++){
series.add( data[i][xcolumn], data[i][j] ,false);
}
seriesCollection.addSeries(series);
}
dataset.add(seriesCollection);
}
}
开发者ID:PacktPublishing,项目名称:Neural-Network-Programming-with-Java-SecondEdition,代码行数:22,代码来源:Chart.java
示例4: createNumericalDataSet
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
private XYDataset createNumericalDataSet() {
XYSeriesCollection dataSet = new XYSeriesCollection();
int translatedPlotColumn = translateToModelColumn(plotColumn);
double start = model.getLowerBound(translatedPlotColumn);
double end = model.getUpperBound(translatedPlotColumn);
double stepSize = (end - start) / (NUMBER_OF_STEPS - 1);
for (int classIndex : model.getClassIndices()) {
XYSeries series = new XYSeries(model.getClassName(classIndex));
ContinuousDistribution distribution = (ContinuousDistribution) model.getDistribution(classIndex,
translatedPlotColumn);
for (double currentValue = start; currentValue < end; currentValue += stepSize) {
double probability = distribution.getProbability(currentValue);
if (!Double.isNaN(probability)) {
series.add(currentValue, distribution.getProbability(currentValue));
}
}
dataSet.addSeries(series);
}
return dataSet;
}
示例5: createDataset
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
protected XYDataset createDataset(BufferedImage img) {
CalculadorDeHistograma calculadorDePixel = new CalculadorDeHistograma();
calculadorDePixel.calculaHistogramas(img);
int[] qtdPixelsR = calculadorDePixel.getHistogramaR();
int[] qtdPixelsG = calculadorDePixel.getHistogramaG();
int[] qtdPixelsB = calculadorDePixel.getHistogramaB();
final XYSeries linhaR = new XYSeries("R");
final XYSeries linhaG = new XYSeries("G");
final XYSeries linhaB = new XYSeries("B");
for (int i = 0; i < qtdPixelsR.length; i++) {
linhaR.add(i, qtdPixelsR[i]);
linhaG.add(i, qtdPixelsG[i]);
linhaB.add(i, qtdPixelsB[i]);
}
final XYSeriesCollection dataset = new XYSeriesCollection();
dataset.addSeries(linhaR);
dataset.addSeries(linhaB);
dataset.addSeries(linhaG);
return dataset;
}
示例6: generateThroughputPerformChart
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
public static void generateThroughputPerformChart(String dbName,long performBatchId){
String path=getChartRootPath(dbName+"_ThroughputPerform");
System.out.println(path);
XYSeries values = new XYSeries(dbName);
List<Map<String, Object>> list = BizDBUtils.selectListBySqlAndParam("select success_times,timeout_avg from ts_timeout_perform where perform_batch_id=? and load_type=99",performBatchId);
if(list!=null&&list.size()>0){
for(int i=0;i<list.size();i++){
Map<String, Object> map = list.get(i);
double timeout=((Number)map.get("timeout_avg")).doubleValue();
double successTimes=((Number)map.get("success_times")).doubleValue();
if(successTimes==0){
values.add(i+1,0);
}else{
values.add(i+1,successTimes*(TimeUnit.SECONDS.toMicros(1)/timeout));
}
}
}
XYSeriesCollection mCollection = new XYSeriesCollection();
mCollection.addSeries(values);
JFreeChart mChart= createXYLineChart("数据吞吐量折线图", "请求次数","吞吐量(requests/sec)",mCollection);
//saveAsFile(mChart,path, 1200, 800);
saveAsFile(mChart,path, 2400, 800);
}
示例7: createMovingAverage
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
/**
* Creates a new {@link XYDataset} containing the moving averages of each series in the
* <code>source</code> dataset.
*
* @param source the source dataset.
* @param suffix the string to append to source series names to create target series names.
* @param period the averaging period.
* @param skip the length of the initial skip period.
*
* @return The dataset.
*/
public static XYDataset createMovingAverage(XYDataset source, String suffix,
double period, double skip) {
// check arguments
if (source == null) {
throw new IllegalArgumentException(
"MovingAverage.createMovingAverage(...) : null source (XYDataset)."
);
}
final XYSeriesCollection result = new XYSeriesCollection();
for (int i = 0; i < source.getSeriesCount(); i++) {
final XYSeries s = createMovingAverage(source, i, source.getSeriesName(i) + suffix,
period, skip);
result.addSeries(s);
}
return result;
}
示例8: getDataset
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
private static XYDataset getDataset() throws Exception{
if(vars.size()!= varsValues.size())
throw new Exception("function formatting error: a variable name is missing");
String[] newFunction = new String[function.length];
BigDecimal pt,rightEnd=rangesRight.get(0), step=steps.get(0);
//BigDecimal pt=rangesLeft.get(0), rightEnd=rangesRight.get(0), step=steps.get(0);
String bf;
XYSeries[] series=new XYSeries[function.length];
for(int i = 0; i < function.length;i++){
series[i] = new XYSeries(function[i]);
newFunction[i] = function[i];
for(int j = 1;j < vars.size();j++)
newFunction[i]=SmartReplace.get(newFunction[i],vars.get(j),varsValues.get(j).toPlainString());
//newFunction[i]=newFunction[i].replace(vars.get(j),varsValues.get(j).toPlainString());
pt=rangesLeft.get(0);
while(pt.compareTo(rightEnd)<0){
//System.out.println(newFunction[i].replace(Var,pt.toPlainString()));
bf=jc.eval(SmartReplace.get(newFunction[i],Var,pt.toPlainString()));
//bf=jc.eval(newFunction[i].replace(Var,pt.toPlainString()));
if(bf.indexOf('/')!=-1)
series[i].add(pt,(new Fraction(bf)).toBigDecimal());
else
series[i].add(pt,new BigDecimal(bf));
pt=pt.add(step);
}
}
XYSeriesCollection dataset = new XYSeriesCollection();
for (XYSeries serie : series) {
dataset.addSeries(serie);
}
return dataset;
}
示例9: addSeries
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
private static void addSeries(final XYSeriesCollection dataSet, final INDArray x, final INDArray y, final String label){
final double[] xd = x.data().asDouble();
final double[] yd = y.data().asDouble();
final XYSeries s = new XYSeries(label);
for( int j=0; j<xd.length; j++ ) s.add(xd[j],yd[j]);
dataSet.addSeries(s);
}
示例10: createTestXYSeriesCollection
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
/**
* Creates and returns a sample dataset for testing purposes.
*
* @return A sample dataset.
*/
public static XYSeriesCollection createTestXYSeriesCollection() {
XYSeriesCollection result = new XYSeriesCollection();
XYSeries series1 = new XYSeries("Series 1", false, false);
series1.add(1.0, 2.0);
series1.add(2.0, 5.0);
XYSeries series2 = new XYSeries("Series 2", false, false);
series2.add(1.0, 4.0);
series2.add(2.0, 3.0);
result.addSeries(series1);
result.addSeries(series2);
return result;
}
示例11: generateThroughRequestsBXYLine
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
/**
* 请求吞吐量折线图
* @param dbs
*/
private static void generateThroughRequestsBXYLine(List<String> dbs) {
XYSeriesCollection mCollection = new XYSeriesCollection();
for(String className:dbs){
String sql="select rowid as row_num,timeout_avg value from ts_timeout_perform ttp where ttp.load_type=99 and ttp.perform_batch_id=(select max(id) from ts_perform_batch tpb where tpb.load_batch_id =(select max(id) from ts_load_batch tlb where data_status=1 and target_db=?))";
mCollection.addSeries(generateXYSeriesBySqlAndClassName(sql, className));
}
JFreeChart mChart= createXYLineChart("数据库吞吐量折线对比图", "次数","speed(requests/sec)",mCollection);
String path=getChartRootPath("throughput_perform_requests_line");
saveAsFile(mChart,path, 24000, 800);
}
示例12: generateThroughPointsXYLine
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
private static void generateThroughPointsXYLine(List<String> dbs) {
XYSeriesCollection mCollection = new XYSeriesCollection();
for(String className:dbs){
String sql="select rowid as row_num,tlr.pps value from ts_load_record tlr where tlr.load_batch_id=(select max(id) from ts_load_batch tlb where data_status=1 and target_db=? )";
mCollection.addSeries(generateXYSeriesBySqlAndClassName(sql, className));
}
JFreeChart mChart= createXYLineChart("import_speed_comparison", "times","speed(points/sec)",mCollection);
String path=getChartRootPath("import_points_speed_comparison_line");
saveAsFile(mChart,path, 8000, 800);
}
示例13: addSerie
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
public void addSerie(int indexSerie, Color color, XYSeries localXYSeries){
XYSeriesCollection localXYSeriesCollection = new XYSeriesCollection();
localXYSeriesCollection.addSeries(localXYSeries); //Se aniade la serie
Ellipse2D.Double localDouble = new Ellipse2D.Double(-4.0D, -4.0D, 8.0D, 8.0D); //Forma de la anotacion del punto x,y
XYLineAndShapeRenderer localXYLineAndShapeRenderer = new XYLineAndShapeRenderer();
localXYLineAndShapeRenderer.setSeriesLinesVisible(indexSerie,true); //provoca que se pinten lineas rectas que unen los puntos x,y que conforman la serie
localXYLineAndShapeRenderer.setSeriesShapesVisible(indexSerie,false); //provoca que se pinte la forma asociada al punto x,y
plot.setDataset(indexSerie, localXYSeriesCollection); //Se aniade la serie al plot
plot.setRenderer(indexSerie, localXYLineAndShapeRenderer);
localXYLineAndShapeRenderer.setSeriesShape(indexSerie, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));
// localXYLineAndShapeRenderer.setSeriesShape(indexSerie, localDouble);
localXYLineAndShapeRenderer.setSeriesPaint(indexSerie, color);
//localXYLineAndShapeRenderer.setSeriesFillPaint(indexSerie, Color.yellow);
//localXYLineAndShapeRenderer.setSeriesOutlinePaint(indexSerie, Color.gray);
localXYLineAndShapeRenderer.setUseFillPaint(false);//true
localXYLineAndShapeRenderer.setUseOutlinePaint(false);//true
localXYLineAndShapeRenderer.setDrawOutlines(false);
localXYLineAndShapeRenderer.setDrawSeriesLineAsPath(true);
}
示例14: addSerie
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
public void addSerie(int indexSerie, Color color, XYSeries localXYSeries){
XYPlot plot=null;
XYSeriesCollection localXYSeriesCollection = new XYSeriesCollection();
localXYSeriesCollection.addSeries(localXYSeries); //Se aniade la serie
Ellipse2D.Double localDouble = new Ellipse2D.Double(-4.0D, -4.0D, 8.0D, 8.0D); //Forma de la anotacion del punto x,y
XYLineAndShapeRenderer localXYLineAndShapeRenderer = new XYLineAndShapeRenderer();
localXYLineAndShapeRenderer.setSeriesLinesVisible(indexSerie,true); //provoca que se pinten lineas rectas que unen los puntos x,y que conforman la serie
localXYLineAndShapeRenderer.setSeriesShapesVisible(indexSerie,false); //provoca que se pinte la forma asociada al punto x,y
plot.setDataset(indexSerie, localXYSeriesCollection); //Se aniade la serie al plot
plot.setRenderer(indexSerie, localXYLineAndShapeRenderer);
localXYLineAndShapeRenderer.setSeriesShape(indexSerie, new Ellipse2D.Double(-4.0, -4.0, 8.0, 8.0));
// localXYLineAndShapeRenderer.setSeriesShape(indexSerie, localDouble);
localXYLineAndShapeRenderer.setSeriesPaint(indexSerie, color);
//localXYLineAndShapeRenderer.setSeriesFillPaint(indexSerie, Color.yellow);
//localXYLineAndShapeRenderer.setSeriesOutlinePaint(indexSerie, Color.gray);
localXYLineAndShapeRenderer.setUseFillPaint(false);//true
localXYLineAndShapeRenderer.setUseOutlinePaint(false);//true
localXYLineAndShapeRenderer.setDrawOutlines(false);
localXYLineAndShapeRenderer.setDrawSeriesLineAsPath(true);
}
示例15: createDataset1
import org.jfree.data.xy.XYSeriesCollection; //导入方法依赖的package包/类
/**
* Creates a sample dataset.
*
* @return Series 1.
*/
private XYDataset createDataset1() {
// create dataset 1...
XYSeries series1 = new XYSeries("Series 1");
series1.add(10.0, 12353.3);
series1.add(20.0, 13734.4);
series1.add(30.0, 14525.3);
series1.add(40.0, 13984.3);
series1.add(50.0, 12999.4);
series1.add(60.0, 14274.3);
series1.add(70.0, 15943.5);
series1.add(80.0, 14845.3);
series1.add(90.0, 14645.4);
series1.add(100.0, 16234.6);
series1.add(110.0, 17232.3);
series1.add(120.0, 14232.2);
series1.add(130.0, 13102.2);
series1.add(140.0, 14230.2);
series1.add(150.0, 11235.2);
XYSeries series2 = new XYSeries("Series 2");
series2.add(10.0, 15000.3);
series2.add(20.0, 11000.4);
series2.add(30.0, 17000.3);
series2.add(40.0, 15000.3);
series2.add(50.0, 14000.4);
series2.add(60.0, 12000.3);
series2.add(70.0, 11000.5);
series2.add(80.0, 12000.3);
series2.add(90.0, 13000.4);
series2.add(100.0, 12000.6);
series2.add(110.0, 13000.3);
series2.add(120.0, 17000.2);
series2.add(130.0, 18000.2);
series2.add(140.0, 16000.2);
series2.add(150.0, 17000.2);
XYSeriesCollection collection = new XYSeriesCollection();
collection.addSeries(series1);
collection.addSeries(series2);
return collection;
}