HistogramDataset dataSet = new HistogramDataset(); dataSet.setType(HistogramType.FREQUENCY); dataSet.addSeries("Hibernate", Doubles.toArray(values), 1000);
/** * Returns the end y-value for a bin (which is the same as the y-value, * this method exists only to support the general form of the * {@link IntervalXYDataset} interface). * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (zero based). * * @return The Y value. * * @throws IndexOutOfBoundsException if <code>series</code> is outside the * specified range. */ public Number getEndY(int series, int item) { return getY(series, item); }
/** * Adds a series to the dataset, using the specified number of bins, * and sends a {@link DatasetChangeEvent} to all registered listeners. * * @param key the series key ({@code null} not permitted). * @param values the values ({@code null} not permitted). * @param bins the number of bins (must be at least 1). */ public void addSeries(Comparable key, double[] values, int bins) { // defer argument checking... double minimum = getMinimum(values); double maximum = getMaximum(values); addSeries(key, values, bins, minimum, maximum); }
HistogramDataset dataset = new HistogramDataset(); dataset.addSeries("series label",arrayOfValues,noOfBins);
dataset = new HistogramDataset(); Raster raster = image.getRaster(); final int w = image.getWidth(); double[] r = new double[w * h]; r = raster.getSamples(0, 0, w, h, 0, r); dataset.addSeries("Red", r, BINS); r = raster.getSamples(0, 0, w, h, 1, r); dataset.addSeries("Green", r, BINS); r = raster.getSamples(0, 0, w, h, 2, r); dataset.addSeries("Blue", r, BINS); this.putValue(NAME, (String) dataset.getSeriesKey(i)); this.putValue(SELECTED_KEY, true); renderer.setSeriesVisible(i, true);
HistogramDataset dataset = new HistogramDataset(); dataset.setType(HistogramType.RELATIVE_FREQUENCY); dataset.addSeries("H1", double[], 20); HistogramDataset dataset = new HistogramDataset(); double[] values = {1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0}; dataset.addSeries("H1", values, 10, 0.0, 10.0);
List bins = getBins(series); HistogramBin bin = (HistogramBin) bins.get(item); double total = getTotal(series); double binWidth = getBinWidth(series);
/** * Returns the number of data items for a series. * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * * @return The item count. * * @throws IndexOutOfBoundsException if <code>series</code> is outside the * specified range. */ public int getItemCount(int series) { return getBins(series).size(); }
HistogramDataset histogramdataset = new HistogramDataset(); histogramdataset.addSeries("Red histogram", red, 256); histogramdataset.addSeries("Blue histogram", blue, 256); histogramdataset.addSeries("Green histogram", green, 256);
dataset = new HistogramDataset(); Raster raster = image.getRaster(); final int w = image.getWidth(); double[] r = new double[w * h]; r = raster.getSamples(0, 0, w, h, 0, r); dataset.addSeries("Red", r, BINS); r = raster.getSamples(0, 0, w, h, 1, r); dataset.addSeries("Green", r, BINS); r = raster.getSamples(0, 0, w, h, 2, r); dataset.addSeries("Blue", r, BINS); this.putValue(NAME, (String) dataset.getSeriesKey(i)); this.putValue(SELECTED_KEY, true); renderer.setSeriesVisible(i, true);
// dataset dataset = new HistogramDataset(); final int w = image.getWidth(); final int h = image.getHeight(); double[] buffer = new double[w * h]; double[] rgb; buffer = raster.getSamples(0, 0, w, h, 0, buffer); rgb = Arrays.copyOf(buffer, buffer.length * 3); // copy as otherwise it gets overwritten in next getSamples dataset.addSeries(lang.getString("HistogramRGB.String.red"), buffer, BINS); buffer = raster.getSamples(0, 0, w, h, 1, buffer); System.arraycopy(buffer, 0, rgb, buffer.length, buffer.length); //Add G dataset.addSeries(lang.getString("HistogramRGB.String.green"), buffer, BINS); buffer = raster.getSamples(0, 0, w, h, 2, buffer); System.arraycopy(buffer, 0, rgb, buffer.length * 2, buffer.length); //Add B dataset.addSeries(lang.getString("HistogramRGB.String.blue"), buffer, BINS); dataset.addSeries(lang.getString("HistogramRGB.String.brigthness"), rgb, BINS); // chart chart = ChartFactory.createHistogram(lang.getString("HistogramRGB.String.histogram"), "", "", dataset, PlotOrientation.VERTICAL, false, true, false);
List bins = getBins(series); HistogramBin bin = (HistogramBin) bins.get(item); double total = getTotal(series); double binWidth = getBinWidth(series);
/** * Returns the number of data items for a series. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * * @return The item count. * * @throws IndexOutOfBoundsException if {@code series} is outside the * specified range. */ @Override public int getItemCount(int series) { return getBins(series).size(); }
HistogramDataset dataset = new HistogramDataset(); dataset.setType(HistogramType.RELATIVE_FREQUENCY); dataset.addSeries("Hist",data,200); // Number of bins is 50 String plotTitle = ""; String xAxis = "Frequency";
private XYPlot createResponseTimesPlot(AggregatedResponses aggregatedResponses) { Samples durations = aggregatedResponses.getDuration(); // Distribution double[] values = new double[durations.getSamples().size()]; for (int i = 0; i < durations.getSamples().size(); i++) { values[i] = durations.getSamples().get(i); } HistogramDataset histogramdataset = new HistogramDataset(); histogramdataset.addSeries("Request Count", values, 40); // Percentiles List<Double> y = new ArrayList<Double>(Q + 1); List<Long> x = new ArrayList<Long>(Q + 1); Quantile quantile = durations.getQuantiles(Q); // Add zero value y.add(0D); x.add(0L); for (int i = 1; i < Q; i++) { y.add(((double) i) / 10); x.add(quantile.getQuantile(i)); } // Add max value y.add(100D); x.add(durations.getMax()); XYPlot plot = ChartUtil.createResponseTimesPlot("Response Times (ms)"); ChartUtil.addDatasetRender(plot, new XYSeriesCollection( createValuesSeries("Percentiles", x, y, 0)), ChartUtil.createLineAndShapeRenderer()); ChartUtil.addDatasetRender(plot, histogramdataset, ChartUtil.createBarRenderer()); plot.mapDatasetToRangeAxis(1, 1); return plot; }
/** * Adds a series to the dataset, using the specified number of bins. * * @param key the series key (<code>null</code> not permitted). * @param values the values (<code>null</code> not permitted). * @param bins the number of bins (must be at least 1). */ public void addSeries(Comparable key, double[] values, int bins) { // defer argument checking... double minimum = getMinimum(values); double maximum = getMaximum(values); addSeries(key, values, bins, minimum, maximum); }
/** * Returns the start y-value for a bin (which is the same as the y-value, * this method exists only to support the general form of the * {@link IntervalXYDataset} interface). * * @param series the series index (in the range <code>0</code> to * <code>getSeriesCount() - 1</code>). * @param item the item index (zero based). * * @return The y-value. * * @throws IndexOutOfBoundsException if <code>series</code> is outside the * specified range. */ public Number getStartY(int series, int item) { return getY(series, item); }
/** * Returns the start value for a bin. * * @param series the series index (in the range {@code 0} to * {@code getSeriesCount() - 1}). * @param item the item index (zero based). * * @return The start value. * * @throws IndexOutOfBoundsException if {@code series} is outside the * specified range. */ @Override public Number getStartX(int series, int item) { List bins = getBins(series); HistogramBin bin = (HistogramBin) bins.get(item); return new Double(bin.getStartBoundary()); }
/** Return the JFreeChart with this histogram, and as a side effect, show it in a JFrame * that provides the means to edit the dimensions and also the plot properties via a popup menu. */ public JFreeChart asChart(final boolean show) { double[] d = new double[this.size()]; int i = 0; for (Number num : this.values()) d[i++] = num.doubleValue(); HistogramDataset hd = new HistogramDataset(); hd.setType(HistogramType.RELATIVE_FREQUENCY); String title = "Histogram"; hd.addSeries(title, d, d.length); JFreeChart chart = ChartFactory.createHistogram(title, "", "", hd, PlotOrientation.VERTICAL, false, false, false); setTheme(chart); if (show) { JFrame frame = new JFrame(title); frame.getContentPane().add(new ChartPanel(chart)); frame.pack(); frame.setVisible(true); } return chart; }
protected static JFreeChart createHistogramChart( ResponsetimeSamples samples, String label, ResourceBundle bundle, ReportConfig config ) HistogramDataset histogramdataset = new HistogramDataset(); histogramdataset.addSeries( label, sampleArray, BINS ); JFreeChart chart = ChartFactory.createHistogram( bundle.getString( "chronos.label.histogram" ), bundle.getString( "chronos.label.histogram.x" ),