public IRenderedRow render()

in application/org.openjdk.jmc.ui/src/main/java/org/openjdk/jmc/ui/charts/XYDataRenderer.java [184:247]


	public IRenderedRow render(Graphics2D context, SubdividedQuantityRange xRange, int height) {
		int width = xRange.getPixelExtent();
		IQuantity yAxisMin = includeLow;
		IQuantity yAxisMax = includeHigh;
		for (SeriesEntry<?> se : entries) {
			se.updatePointsCache(xRange);
			if (se.points.getSize() > 0) {
				IQuantity seriesMinY = se.points.getMinY();
				if (yAxisMin == null || yAxisMin.compareTo(seriesMinY) > 0) {
					yAxisMin = seriesMinY;
				}
				IQuantity seriesMaxY = se.points.getMaxY();
				if (yAxisMax == null || yAxisMax.compareTo(seriesMaxY) < 0) {
					yAxisMax = seriesMaxY;
				}
			}
		}

		if (yAxisMin != null && yAxisMax != null) {
			FontMetrics fm = context.getFontMetrics();
			// If min=max, expand range to be [min, min+1], or [min, min+1024] in the case of 
			//a graph measured in bytes
			if (yAxisMin.compareTo(yAxisMax) == 0) {
				int offset = yAxisMin.getUnit() == UnitLookup.BYTE ? 1024 : 1;
				yAxisMax = yAxisMin.getUnit().quantity(yAxisMin.doubleValue() + offset);
			} else {
				// Add sufficient padding to ensure that labels for ticks <= yAxisMax fit,
				// and constant value graphs are discernible.
				double padFactor = ((double) (height + 1 + fm.getAscent() / 2)) / height;
				yAxisMax = yAxisMin.add(yAxisMax.subtract(yAxisMin).multiply(padFactor));
			}
			SubdividedQuantityRange yRange = new SubdividedQuantityRange(yAxisMin, yAxisMax, height, fm.getHeight());
			context.setPaint(Color.LIGHT_GRAY);
			AWTChartToolkit.drawGrid(context, yRange, width, true);
			Shape oldClip = context.getClip();
			context.setClip(new Rectangle(width, height));
			for (SeriesEntry<?> se : entries) {
				// Always set yRange since it is used in infoAt().
				se.points.setYRange(yRange);
				if (se.points.getSize() > 0) {
					if (se instanceof LineSeriesEntry) {
						LineSeriesEntry<?> lse = (LineSeriesEntry<?>) se;
						if (lse.connect) {
							context.setPaint(lse.fill ? ColorToolkit.getGradientPaint(lse.color, height) : lse.color);
							AWTChartToolkit.drawLineChart(context, se.points, width, height, lse.fill);
						} else {
							context.setPaint(lse.color);
							AWTChartToolkit.drawPlot(context, se.points, height, lse.fill);
						}
					} else if (se instanceof BarSeriesEntry) {
						drawBarChart(context, (BarSeriesEntry<?>) se, width, height);
					}
				}
			}
			context.setClip(oldClip);
			context.setPaint(Color.BLACK);
			if (axisOnLeft) {
				AWTChartToolkit.drawAxis(context, yRange, 0, true, 1, true);
			} else {
				AWTChartToolkit.drawAxis(context, yRange, width, false, 1, true);
			}
		}
		return new RenderedResult(height);
	}