### Question:
AreaGraph2DRenderer extends Graph2DRenderer<AreaGraph2DRendererUpdate> { public void draw(Graphics2D graphics, Cell1DDataset dataset) { Color dividerColor = new Color(196, 196, 196); Color lineColor = new Color(140, 140, 140); Color histogramColor = new Color(175, 175, 175); this.g = graphics; this.referenceLineColor = this.backgroundColor; calculateRanges(dataset.getXRange(), dataset.getXRange(), dataset.getStatistics().getRange(), dataset.getDisplayRange()); calculateLabels(); calculateGraphArea(); drawBackground(); drawGraphArea(); int[] binLimitsPx = new int[dataset.getXCount() + 1]; int[] binHeightsPx = new int[dataset.getXCount()]; focusValueIndex = null; for (int i = 0; i < dataset.getXCount(); i++) { binLimitsPx[i] = (int) scaledX(dataset.getXBoundaries().getDouble(i)); binHeightsPx[i] = (int) scaledY(dataset.getValue(i)); if (focusPixelX != null && binLimitsPx[i] < focusPixelX) { focusValueIndex = i; } } binLimitsPx[dataset.getXCount()] = (int) scaledX(dataset.getXBoundaries().getDouble(dataset.getXCount())); int plotStart = (int) scaledY(getYPlotRange().getMinimum()); for (int i = 0; i < binHeightsPx.length; i++) { graphics.setColor(histogramColor); if (!highlightFocusValue || focusValueIndex == null || i != focusValueIndex) { graphics.fillRect(binLimitsPx[i], binHeightsPx[i], binLimitsPx[i+1] - binLimitsPx[i], plotStart - binHeightsPx[i]); } graphics.setColor(dividerColor); if ((plotStart - binHeightsPx[i]) > 0) { graphics.drawLine(binLimitsPx[i], binHeightsPx[i], binLimitsPx[i], plotStart); } } graphics.setColor(backgroundColor); drawHorizontalReferenceLines(); int previousHeight = plotStart; for (int i = 0; i < binHeightsPx.length; i++) { graphics.setColor(lineColor); graphics.drawLine(binLimitsPx[i], previousHeight, binLimitsPx[i], binHeightsPx[i]); graphics.drawLine(binLimitsPx[i], binHeightsPx[i], binLimitsPx[i+1], binHeightsPx[i]); previousHeight = binHeightsPx[i]; } if (previousHeight > 0) graphics.drawLine(binLimitsPx[binLimitsPx.length - 1], previousHeight, binLimitsPx[binLimitsPx.length - 1], plotStart); } AreaGraph2DRenderer(int imageWidth, int imageHeight); @Override AreaGraph2DRendererUpdate newUpdate(); @Override void update(AreaGraph2DRendererUpdate update); void draw(Graphics2D graphics, Cell1DDataset dataset); Integer getFocusPixelX(); Integer getFocusValueIndex();  }### Answer:
@Test public void test4() throws Exception { Cell1DDataset dataset = Cell1DDatasets.linearRange(new ArrayDouble(0,1,2,3,4,5,6,7,8,9,10), 0, 10); BufferedImage image = new BufferedImage(640, 480, BufferedImage.TYPE_3BYTE_BGR); AreaGraph2DRenderer renderer = new AreaGraph2DRenderer(640, 480); Graphics2D graphics = (Graphics2D) image.getGraphics(); renderer.draw(graphics, dataset); compareImages("bar1DChart.4", image); }