本文整理汇总了Java中org.jfree.data.xy.XYSeries.add方法的典型用法代码示例。如果您正苦于以下问题:Java XYSeries.add方法的具体用法?Java XYSeries.add怎么用?Java XYSeries.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.jfree.data.xy.XYSeries
的用法示例。
在下文中一共展示了XYSeries.add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createDataset
import org.jfree.data.xy.XYSeries; //导入方法依赖的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;
}
示例2: addSeries
import org.jfree.data.xy.XYSeries; //导入方法依赖的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
示例3: testReplaceDataset
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Replaces the dataset and checks that it has changed as expected.
*/
public void testReplaceDataset() {
// create a dataset...
XYSeries series1 = new XYSeries("Series 1");
series1.add(10.0, 10.0);
series1.add(20.0, 20.0);
series1.add(30.0, 30.0);
XYDataset dataset = new XYSeriesCollection(series1);
LocalListener l = new LocalListener();
this.chart.addChangeListener(l);
XYPlot plot = (XYPlot) this.chart.getPlot();
plot.setDataset(dataset);
assertEquals(true, l.flag);
ValueAxis axis = plot.getRangeAxis();
Range range = axis.getRange();
assertTrue("Expecting the lower bound of the range to be around 10: "
+ range.getLowerBound(), range.getLowerBound() <= 10);
assertTrue("Expecting the upper bound of the range to be around 30: "
+ range.getUpperBound(), range.getUpperBound() >= 30);
}
示例4: GenerateModel
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
public void GenerateModel() throws IOException {
XYPointCollection points = new XYPointCollection();
XYSeries series = new XYSeries("Peptide ions");
XYSeriesCollection xySeriesCollection = new XYSeriesCollection();
for (PepIonID pepA : LCMSA.GetPepIonList().values()) {
if (LCMSB.GetPepIonList().containsKey(pepA.GetKey())) {
PepIonID pepB = LCMSB.GetPepIonList().get(pepA.GetKey());
points.AddPoint(pepA.GetRT(), pepB.GetRT());
series.add(new XYDataItem(pepA.GetRT(), pepB.GetRT()));
}
}
regression = new PiecewiseRegression(parameter.MaxCurveRTRange, parameter.MaxCurveRTRange);
regression.SetData(points);
float R2 = regression.GetR2();
Logger.getRootLogger().info("Retention time prediction model:(" + FilenameUtils.getBaseName(LCMSA.mzXMLFileName) + "-" + FilenameUtils.getBaseName(LCMSB.mzXMLFileName) + ")..R2=" + R2 + "(No. of commonly identified peptide ions=" + points.PointCount() + ")");
GenerateRTMapPNG(xySeriesCollection, series, R2);
}
示例5: testPowerRegression2b
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Checks the results of a power regression on sample dataset 2 AFTER
* converting it to an XYSeries.
*/
public void testPowerRegression2b() {
double[][] data = createSampleData2();
XYSeries series = new XYSeries("Test");
for (int i = 0; i < 10; i++) {
series.add(data[i][0], data[i][1]);
}
XYDataset ds = new XYSeriesCollection(series);
double[] result = Regression.getPowerRegression(ds, 0);
assertEquals(106.1241681, result[0], 0.0000001);
assertEquals(-0.8466615, result[1], 0.0000001);
}
示例6: addSeries
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
public void addSeries(final NumberSeries<?> aSeries, final Shape shape) {
final XYSeries tmpSeries = new XYSeries(aSeries.getName(), true, false);
Number tmpKey;
Number tmpValue;
for (final Map.Entry<? extends Number, ? extends Number> tmpEntry : aSeries.entrySet()) {
tmpKey = tmpEntry.getKey();
tmpValue = tmpEntry.getValue();
tmpSeries.add(tmpKey, tmpValue);
}
myCollection.addSeries(tmpSeries);
this.putColour(aSeries.getName(), new Color(aSeries.getColour().getRGB()));
this.putShape(aSeries.getName(), shape);
}
示例7: createTestXYSeriesCollection
import org.jfree.data.xy.XYSeries; //导入方法依赖的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;
}
示例8: testDrawWithNullInfo
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Draws the chart with a <code>null</code> info object to make sure that
* no exceptions are thrown (particularly by code in the renderer).
*/
public void testDrawWithNullInfo() {
boolean success = false;
try {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(5.0, 5.0);
s1.add(10.0, 15.5);
s1.add(15.0, 9.5);
s1.add(20.0, 7.5);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(5.0, 5.0);
s2.add(10.0, 15.5);
s2.add(15.0, 9.5);
s2.add(20.0, 3.5);
dataset.addSeries(s2);
XYPlot plot = new XYPlot(dataset,
new NumberAxis("X"), new NumberAxis("Y"),
new XYStepRenderer());
JFreeChart chart = new JFreeChart(plot);
/* BufferedImage image = */ chart.createBufferedImage(300, 200,
null);
success = true;
}
catch (NullPointerException e) {
e.printStackTrace();
success = false;
}
assertTrue(success);
}
示例9: DataSeries
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
public DataSeries(String label,double[] xdata,double[] ydata){
dimension=2;
seriesLabel = label;
series = new XYSeries(label);
length=xdata.length;
for(int i=0;i<length;i++){
series.add(xdata[i],ydata[i]);
}
dataset2d = new XYSeriesCollection();
}
开发者ID:PacktPublishing,项目名称:Neural-Network-Programming-with-Java-SecondEdition,代码行数:11,代码来源:DataSeries.java
示例10: sampleFunction2D
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Creates an {@link XYDataset} by sampling the specified function over a
* fixed range.
*
* @param f the function (<code>null</code> not permitted).
* @param start the start value for the range.
* @param end the end value for the range.
* @param samples the number of sample points (must be > 1).
* @param seriesKey the key to give the resulting series
* (<code>null</code> not permitted).
*
* @return A dataset.
*/
public static XYDataset sampleFunction2D(Function2D f,
double start,
double end,
int samples,
Comparable seriesKey) {
if (f == null) {
throw new IllegalArgumentException("Null 'f' argument.");
}
if (seriesKey == null) {
throw new IllegalArgumentException("Null 'seriesKey' argument.");
}
if (start >= end) {
throw new IllegalArgumentException("Requires 'start' < 'end'.");
}
if (samples < 2) {
throw new IllegalArgumentException("Requires 'samples' > 1");
}
XYSeries series = new XYSeries(seriesKey);
double step = (end - start) / samples;
for (int i = 0; i <= samples; i++) {
double x = start + (step * i);
series.add(x, f.getValue(x));
}
XYSeriesCollection collection = new XYSeriesCollection(series);
return collection;
}
示例11: exchangeSeries
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
@Override
public void exchangeSeries(int seriesIndex, DataSeries series) throws NoSuchSeriesException {
if(seriesIndex < this.getSeriesCount()){
XyDataSeries xyDataSeries = (XyDataSeries) series;
XYSeries editSeries = this.getSeries(seriesIndex);
// --- Are there configuration changes ? --------------------------
if (xyDataSeries.getAutoSort()==editSeries.getAutoSort() && xyDataSeries.getAvoidDuplicateXValues()==(!editSeries.getAllowDuplicateXValues())) {
// --- No configuration changes -------------------------------
editSeries.clear();
if (series.getLabel()!=null) {
editSeries.setKey(series.getLabel());
}
List valuePairs = xyDataSeries.getXyValuePairs();
for (int i = 0; i < valuePairs.size(); i++) {
XyValuePair valuePair = (XyValuePair) valuePairs.get(i);
editSeries.add(valuePair.getXValue().getFloatValue(), valuePair.getYValue().getFloatValue());
}
} else {
// --- Configuration has changed ------------------------------
XYSeries newSeries = (XYSeries) this.getXYSeriesFromXyDataSeries(xyDataSeries);
// --- Replace the edit series with the new series ------------
Vector<XYSeries> currSerieses = new Vector<XYSeries>();
for (int i=0; i < this.getSeriesCount(); i++) {
currSerieses.add(this.getSeries(i));
}
currSerieses.set(seriesIndex, newSeries);
this.getXySeriesCollection().removeAllSeries();
for (int i = 0; i < currSerieses.size(); i++) {
this.getXySeriesCollection().addSeries(currSerieses.get(i));
}
}
}else{
throw new NoSuchSeriesException();
}
this.setChanged();
this.notifyObservers(ChartModel.EventType.SERIES_ADDED);
}
示例12: createSeriesA
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Creates a series for testing.
*
* @return A series.
*/
private XYSeries createSeriesA() {
XYSeries s = new XYSeries("A", true, false);
s.add(1.0, 1.1);
s.add(2.0, null);
return s;
}
示例13: createTableXYDataset1
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
private TableXYDataset createTableXYDataset1() {
DefaultTableXYDataset dataset = new DefaultTableXYDataset();
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(1.0, 1.0);
s1.add(2.0, 2.0);
dataset.addSeries(s1);
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(1.0, -2.0);
s2.add(2.0, -1.0);
dataset.addSeries(s2);
return dataset;
}
示例14: createTestTableXYDataset
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Creates and returns a sample dataset for testing purposes.
*
* @return A sample dataset.
*/
public static TableXYDataset createTestTableXYDataset() {
DefaultTableXYDataset result = new DefaultTableXYDataset();
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;
}
示例15: testIndexOf
import org.jfree.data.xy.XYSeries; //导入方法依赖的package包/类
/**
* Simple test for the indexOf() method.
*/
public void testIndexOf() {
final XYSeries s1 = new XYSeries("Series 1");
s1.add(1.0, 1.0);
s1.add(2.0, 2.0);
s1.add(3.0, 3.0);
assertEquals(0, s1.indexOf(new Double(1.0)));
}