private XYZDataset createXyzDataset() { if (sampleXyzDataset == null) { DefaultXYZDataset dataset = new DefaultXYZDataset(); dataset.addSeries( "First", new double[][]{ {2.1, 2.3, 2.3, 2.2, 2.2, 1.8, 1.8, 1.9, 2.3, 3.8}, {14.1, 11.1, 10.0, 8.8, 8.7, 8.4, 5.4, 4.1, 4.1, 25}, {2.4, 2.7, 2.7, 2.2, 2.2, 2.2, 2.1, 2.2, 1.6, 4} } ); sampleXyzDataset = dataset; } return sampleXyzDataset; }
/** * Returns the key for a series. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * * @return The key for the series. * * @throws IllegalArgumentException if {@code series} is not in the * specified range. */ @Override public Comparable getSeriesKey(int series) { if ((series < 0) || (series >= getSeriesCount())) { throw new IllegalArgumentException("Series index out of bounds"); } return (Comparable) this.seriesKeys.get(series); }
/** * Returns the x-value for an item within a series. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * @param item the item index (in the range {@code 0} to * {@code getItemCount(series)}). * * @return The x-value. * * @throws ArrayIndexOutOfBoundsException if {@code series} is not * within the specified range. * @throws ArrayIndexOutOfBoundsException if {@code item} is not * within the specified range. * * @see #getXValue(int, int) */ @Override public Number getX(int series, int item) { return new Double(getXValue(series, item)); }
/** * Removes a series from the dataset, then sends a * {@link DatasetChangeEvent} to all registered listeners. * * @param seriesKey the series key ({@code null} not permitted). * */ public void removeSeries(Comparable seriesKey) { int seriesIndex = indexOf(seriesKey); if (seriesIndex >= 0) { this.seriesKeys.remove(seriesIndex); this.seriesList.remove(seriesIndex); notifyListeners(new DatasetChangeEvent(this, this)); } }
xyDataset = new DefaultXYDataset(); } else { xyzDataset = new DefaultXYZDataset(); xyDataset.addSeries(sparkline3dDataSeries.getSeriesLabel(), data); } else { xyzDataset.addSeries(sparkline3dDataSeries.getSeriesLabel(), data); for (int i = 0; i < xyzDataset.getSeriesCount(); i++) { plot.getRenderer().setSeriesPaint(i, colors.get(i));
/** * Returns the z-value for an item within a series. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (in the range <code>0</code> to * <code>getItemCount(series)</code>). * * @return The z-value. * * @throws ArrayIndexOutOfBoundsException if <code>series</code> is not * within the specified range. * @throws ArrayIndexOutOfBoundsException if <code>item</code> is not * within the specified range. * * @see #getZ(int, int) */ public Number getZ(int series, int item) { return new Double(getZValue(series, item)); }
/** * Returns the y-value for an item within a series. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * @param item the item index (in the range {@code 0} to * {@code getItemCount(series)}). * * @return The y-value. * * @throws ArrayIndexOutOfBoundsException if {@code series} is not * within the specified range. * @throws ArrayIndexOutOfBoundsException if {@code item} is not * within the specified range. * * @see #getX(int, int) */ @Override public Number getY(int series, int item) { return new Double(getYValue(series, item)); }
/** * Removes a series from the dataset, then sends a * {@link DatasetChangeEvent} to all registered listeners. * * @param seriesKey the series key (<code>null</code> not permitted). * */ public void removeSeries(Comparable seriesKey) { int seriesIndex = indexOf(seriesKey); if (seriesIndex >= 0) { this.seriesKeys.remove(seriesIndex); this.seriesList.remove(seriesIndex); notifyListeners(new DatasetChangeEvent(this, this)); } }
/** * Returns the z-value for an item within a series. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * @param item the item index (in the range {@code 0} to * {@code getItemCount(series)}). * * @return The z-value. * * @throws ArrayIndexOutOfBoundsException if {@code series} is not * within the specified range. * @throws ArrayIndexOutOfBoundsException if {@code item} is not * within the specified range. * * @see #getZ(int, int) */ @Override public Number getZ(int series, int item) { return new Double(getZValue(series, item)); }
/** * Returns the y-value for an item within a series. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (in the range <code>0</code> to * <code>getItemCount(series)</code>). * * @return The y-value. * * @throws ArrayIndexOutOfBoundsException if <code>series</code> is not * within the specified range. * @throws ArrayIndexOutOfBoundsException if <code>item</code> is not * within the specified range. * * @see #getX(int, int) */ public Number getY(int series, int item) { return new Double(getYValue(series, item)); }
/** * transfer a XYZModel into JFreeChart XYZDataset. * @since 3.5.0 */ private XYZDataset XYZModelToXYZDataset(XYZModel model) { final DefaultXYZDataset dataset = new DefaultXYZDataset(); for (final Iterator it = model.getSeries().iterator(); it.hasNext();) { final Comparable seriesKey = (Comparable) it.next(); final int size = model.getDataCount(seriesKey); final double[][] data = new double[3][size]; for(int j = 0; j < size; ++j) { data[0][j] = model.getX(seriesKey, j).doubleValue(); data[1][j] = model.getY(seriesKey, j).doubleValue(); data[2][j] = model.getZ(seriesKey, j).doubleValue(); } dataset.addSeries(seriesKey, data); } return dataset; }
+ "three arrays all having the same length."); int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { // add a new series this.seriesKeys.add(seriesKey); this.seriesList.add(seriesIndex, data); notifyListeners(new DatasetChangeEvent(this, this));
/** * Returns the key for a series. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * * @return The key for the series. * * @throws IllegalArgumentException if <code>series</code> is not in the * specified range. */ public Comparable getSeriesKey(int series) { if ((series < 0) || (series >= getSeriesCount())) { throw new IllegalArgumentException("Series index out of bounds"); } return (Comparable) this.seriesKeys.get(series); }
/** * Returns the x-value for an item within a series. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (in the range <code>0</code> to * <code>getItemCount(series)</code>). * * @return The x-value. * * @throws ArrayIndexOutOfBoundsException if <code>series</code> is not * within the specified range. * @throws ArrayIndexOutOfBoundsException if <code>item</code> is not * within the specified range. * * @see #getXValue(int, int) */ public Number getX(int series, int item) { return new Double(getXValue(series, item)); }
/**Create data for the background data set */ private static XYZDataset createBackgroundData(INDArray backgroundIn, INDArray backgroundOut) { int nRows = backgroundIn.rows(); double[] xValues = new double[nRows]; double[] yValues = new double[nRows]; double[] zValues = new double[nRows]; for( int i=0; i<nRows; i++ ){ xValues[i] = backgroundIn.getDouble(i,0); yValues[i] = backgroundIn.getDouble(i,1); zValues[i] = backgroundOut.getDouble(i, 0); } DefaultXYZDataset dataset = new DefaultXYZDataset(); dataset.addSeries("Series 1", new double[][]{xValues, yValues, zValues}); return dataset; }
+ "three arrays all having the same length."); int seriesIndex = indexOf(seriesKey); if (seriesIndex == -1) { // add a new series this.seriesKeys.add(seriesKey); this.seriesList.add(seriesIndex, data); notifyListeners(new DatasetChangeEvent(this, this));
/** * Returns the number of items in the specified series. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * * @return The item count. * * @throws IllegalArgumentException if <code>series</code> is not in the * specified range. */ public int getItemCount(int series) { if ((series < 0) || (series >= getSeriesCount())) { throw new IllegalArgumentException("Series index out of bounds"); } double[][] seriesArray = (double[][]) this.seriesList.get(series); return seriesArray[0].length; }
DefaultXYZDataset xyzDataset = new DefaultXYZDataset(); Color bubbleColor = Color.BLACK; xyzDataset.addSeries("1", data); bubbleColor = GradientColorCoding.findGradientColor(((Double) value).doubleValue(), -maxAbsValue, maxAbsValue, currentColorGradient, positiveColorGradient); xyzDataset.addSeries("1", data); bubbleColor = GradientColorCoding.findGradientColor(((Integer) value).doubleValue(), -maxAbsValue, maxAbsValue, currentColorGradient, positiveColorGradient);
/** * Returns the number of items in the specified series. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * * @return The item count. * * @throws IllegalArgumentException if {@code series} is not in the * specified range. */ @Override public int getItemCount(int series) { if ((series < 0) || (series >= getSeriesCount())) { throw new IllegalArgumentException("Series index out of bounds"); } double[][] seriesArray = (double[][]) this.seriesList.get(series); return seriesArray[0].length; }
tempXYZData[2][3] = 4; DefaultXYZDataset dataset2 = new DefaultXYZDataset(); dataset2.addSeries("Series 1", tempXYZData);