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; }
public void setData(TimeseriesData data, TimeseriesMetadataOutput timeMetadata, StyleProperties style) { getXYPlot().setDataset(timeseriesIndex, createTimeseriesCollection(data, style)); ValueAxis rangeAxis = createRangeAxis(timeMetadata); getXYPlot().setRangeAxis(timeseriesIndex, rangeAxis); getXYPlot().mapDatasetToRangeAxis(timeseriesIndex, timeseriesIndex); }
plot.mapDatasetToRangeAxis(1, 1); //2nd dataset to 2nd y-axi
public void setData(Data<QuantityValue> data, DatasetOutput< ? > timeMetadata, StyleProperties style) { getXYPlot().setDataset(timeseriesIndex, createTimeseriesCollection(data, style)); ValueAxis rangeAxis = createRangeAxis(timeMetadata); getXYPlot().setRangeAxis(timeseriesIndex, rangeAxis); getXYPlot().mapDatasetToRangeAxis(timeseriesIndex, timeseriesIndex); }
private void addArrayDataToSeries(int domainAxisIndex, int rangeAxisIndex, int datasetIndex, String yName, MetadataElement metadataElement, double[] arrayIndices, String recordElementName) { double[] yAxisData = new double[arrayIndices.length]; ProductData attributeData = metadataElement.getElement(recordElementName).getAttribute(yName).getData(); Arrays.setAll(yAxisData, attributeData::getElemDoubleAt); String seriesKey = String.format("%s/%s", recordElementName, yName); DefaultXYDataset dataset = new DefaultXYDataset(); dataset.addSeries(seriesKey, new double[][]{arrayIndices, yAxisData}); xyPlot.setDataset(datasetIndex, dataset); xyPlot.mapDatasetToRangeAxis(datasetIndex, rangeAxisIndex); xyPlot.mapDatasetToDomainAxis(datasetIndex, domainAxisIndex); xyPlot.setRenderer(datasetIndex, creatItemRenderer(datasetIndex, ProductData.TYPE_INT32)); }
/** * Adds the cash flow axis to the plot. * @param plot the plot * @param dataset the cash flow dataset */ private static void addCashFlowAxis(XYPlot plot, TimeSeriesCollection dataset) { final NumberAxis cashAxis = new NumberAxis("Cash Flow Ratio"); cashAxis.setAutoRangeIncludesZero(false); plot.setRangeAxis(1, cashAxis); plot.setDataset(1, dataset); plot.mapDatasetToRangeAxis(1, 1); final StandardXYItemRenderer cashFlowRenderer = new StandardXYItemRenderer(); cashFlowRenderer.setSeriesPaint(0, Color.blue); plot.setRenderer(1, cashFlowRenderer); }
timeSeriesPlot.setDataset(insituCollectionIndex, insituDataset); timeSeriesPlot.mapDatasetToRangeAxis(cursorCollectionIndex, aliasIdx); timeSeriesPlot.mapDatasetToRangeAxis(pinCollectionIndex, aliasIdx); timeSeriesPlot.mapDatasetToRangeAxis(insituCollectionIndex, aliasIdx);
plot.setRangeAxis(index, (ValueAxis)AxisFactory.createNumberAxis(ofxChart, axisOrientation)); plot.setDataset(index, mapXySeriesCollection.get(i)); plot.mapDatasetToRangeAxis(index, index);
plot.mapDatasetToRangeAxis(0, 0); plot.mapDatasetToRangeAxis(1, 1);
plot.mapDatasetToRangeAxis(seriesCount, seriesCount);
plot.mapDatasetToRangeAxis(seriesCount, seriesCount);
private void configureRangeAxis(int index, MetadataElement metadataElement, String yAttributeName, String[] recordElementNames, String refRecordName, double[] recordIndices) { double[] yAxisData = new double[recordIndices.length]; Arrays.setAll(yAxisData, i -> getDataAsDouble(metadataElement.getElement(recordElementNames[i]).getAttribute(yAttributeName).getData())); DefaultXYDataset dataset2 = new DefaultXYDataset(); dataset2.addSeries(yAttributeName, new double[][]{recordIndices, yAxisData}); xyPlot.setDataset(index, dataset2); xyPlot.mapDatasetToRangeAxis(index, index); int yDataType = getAttributeType(metadataElement.getElement(refRecordName).getAttribute(yAttributeName)); ValueAxis yAxis = configureRangeIndex(index, yDataType); String yUnit = metadataElement.getElement(refRecordName).getAttribute(yAttributeName).getUnit(); yAxis.setLabel(getYAxisLabel(yAttributeName, yUnit)); xyPlot.setRenderer(index, creatItemRenderer(index, yDataType)); }
public JFreeChart createChart(PlotParameters params) throws PlotException { XYSeriesCollection minMax = new XYSeriesCollection(); XYSeriesCollection avgCol = new XYSeriesCollection(); XYPlot plot; XYBarRenderer r = new XYBarRenderer(); r.setBarPainter(new StandardXYBarPainter()); r.setMargin(0.35); minMax.addSeries(min); avgCol.addSeries(series); minMax.addSeries(max); JFreeChart chart = ChartFactory.createXYLineChart(params.title, params.xAxisLabel, params.yAxisLabel, avgCol, params.orientation, params.showLegend, true, false); plot = ((XYPlot) chart.getPlot()); plot.setDataset(1, minMax); plot.setRenderer(1, r); if (separateMinMaxAxis) { NumberAxis minMaxAxis = new NumberAxis("min/max"); plot.setRangeAxis(1, minMaxAxis); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); plot.mapDatasetToRangeAxis(1, 1); } return chart; }
public JFreeChart createChart(PlotParameters params) throws PlotException { XYSeriesCollection minMax = new XYSeriesCollection(); XYSeriesCollection avgCol = new XYSeriesCollection(); XYPlot plot; XYBarRenderer r = new XYBarRenderer(); r.setBarPainter(new StandardXYBarPainter()); r.setMargin(0.35); minMax.addSeries(min); avgCol.addSeries(series); minMax.addSeries(max); JFreeChart chart = ChartFactory.createXYLineChart(params.title, params.xAxisLabel, params.yAxisLabel, avgCol, params.orientation, params.showLegend, true, false); plot = ((XYPlot) chart.getPlot()); plot.setDataset(1, minMax); plot.setRenderer(1, r); if (separateMinMaxAxis) { NumberAxis minMaxAxis = new NumberAxis("min/max"); plot.setRangeAxis(1, minMaxAxis); plot.setRangeAxisLocation(1, AxisLocation.BOTTOM_OR_RIGHT); plot.mapDatasetToRangeAxis(1, 1); } return chart; }
plot.mapDatasetToRangeAxis(index, 0); XYLineAndShapeRenderer renderer2 = new XYLineAndShapeRenderer(true, false); renderer2.setSeriesPaint(index, Color.blue);
plot.getRangeAxis(i).setRange((Double) tuples4FOI.getMinimum(i), (Double) tuples4FOI.getMaximum(i)); plot.mapDatasetToRangeAxis(i, i);
dataset1.addSeries(nameY1, new double[][]{xData, y1AxisData}); xyPlot.setDataset(0, dataset1); xyPlot.mapDatasetToRangeAxis(0, 0); xyPlot.setRenderer(0, creatItemRenderer(0, y1DataType)); dataset2.addSeries(nameY2, new double[][]{xData, y2AxisData}); xyPlot.setDataset(1, dataset2); xyPlot.mapDatasetToRangeAxis(1, 1); xyPlot.setRenderer(1, creatItemRenderer(1, y1DataType));
axis.setAutoRange(true); plot.setRangeAxis(1, axis); plot.mapDatasetToRangeAxis(1, 1);
axis.setAutoRange(true); plot.setRangeAxis(1, axis); plot.mapDatasetToRangeAxis(1, 1);