@Test public void testProcessPoint() { System.out.println("processPoint"); Graphics2DEmul g2d = new Graphics2DEmul(); Color color = Color.red; double zoomFactor = 1.0; int limitPointFactor = 1; ChartSettings chartSettings = new ChartSettings(); chartSettings.setDrawFinalZeroingLines(true); LineRowPlotter instance = new LineRowPlotter(chartSettings, new NumberRenderer()); instance.setBoundsValues(g2d.getBounds(), minXVal, maxXVal, minYVal, maxYVal); instance.paintRow(g2d, testRow, color, zoomFactor, limitPointFactor); String expResult = "setStroke|setColor: java.awt.Color[r=255,g=0,b=0]|drawLine: (10;610) - (10;598)|fillOval: (7;595) - w:6 h:6|drawLine: (10;598) - (410;370)|fillOval: (407;367) - w:6 h:6|drawLine: (410;370) - (810;10)|fillOval: (807;7) - w:6 h:6|setStroke|"; String result = g2d.getResult(); Assert.assertEquals(expResult, result); }
@Override protected void processPoint(Graphics2D g2d, int granulation) { if(chartSettings.getLineWidth() == 0) return; boolean valid = isChartPointValid(x, y); if (mustDrawFirstZeroingLine && valid) { mustDrawFirstZeroingLine = false; prevX = x; } if (prevX >= 0) { if (valid) { if (prevY >= chartRect.y && y >= chartRect.y) { g2d.drawLine(prevX, prevY, x, y); } else if (prevY >= chartRect.y && y < chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(prevX, prevY, x1, chartRect.y); } else if (prevY < chartRect.y && y >= chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(x1, chartRect.y, x, y); } } } }
LineRowPlotter extends AbstractRowPlotter { @Override protected void processPoint(Graphics2D g2d, int granulation) { if(chartSettings.getLineWidth() == 0) return; boolean valid = isChartPointValid(x, y); if (mustDrawFirstZeroingLine && valid) { mustDrawFirstZeroingLine = false; prevX = x; } if (prevX >= 0) { if (valid) { if (prevY >= chartRect.y && y >= chartRect.y) { g2d.drawLine(prevX, prevY, x, y); } else if (prevY >= chartRect.y && y < chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(prevX, prevY, x1, chartRect.y); } else if (prevY < chartRect.y && y >= chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(x1, chartRect.y, x, y); } } } } }
LineRowPlotter extends AbstractRowPlotter { @Override protected void processPoint(Graphics2D g2d, int granulation) { if(chartSettings.getLineWidth() == 0) return; boolean valid = isChartPointValid(x, y); if (mustDrawFirstZeroingLine && valid) { mustDrawFirstZeroingLine = false; prevX = x; } if (prevX >= 0) { if (valid) { if (prevY >= chartRect.y && y >= chartRect.y) { g2d.drawLine(prevX, prevY, x, y); } else if (prevY >= chartRect.y && y < chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(prevX, prevY, x1, chartRect.y); } else if (prevY < chartRect.y && y >= chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(x1, chartRect.y, x, y); } } } } LineRowPlotter(ChartSettings chartSettings, NumberRenderer labelRenderer); }
LineRowPlotter extends AbstractRowPlotter { @Override protected void processPoint(Graphics2D g2d, int granulation) { if(chartSettings.getLineWidth() == 0) return; boolean valid = isChartPointValid(x, y); if (mustDrawFirstZeroingLine && valid) { mustDrawFirstZeroingLine = false; prevX = x; } if (prevX >= 0) { if (valid) { if (prevY >= chartRect.y && y >= chartRect.y) { g2d.drawLine(prevX, prevY, x, y); } else if (prevY >= chartRect.y && y < chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(prevX, prevY, x1, chartRect.y); } else if (prevY < chartRect.y && y >= chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(x1, chartRect.y, x, y); } } } } LineRowPlotter(ChartSettings chartSettings, NumberRenderer labelRenderer);  }
LineRowPlotter extends AbstractRowPlotter { @Override protected void processPoint(Graphics2D g2d, int granulation) { if(chartSettings.getLineWidth() == 0) return; boolean valid = isChartPointValid(x, y); if (mustDrawFirstZeroingLine && valid) { mustDrawFirstZeroingLine = false; prevX = x; } if (prevX >= 0) { if (valid) { if (prevY >= chartRect.y && y >= chartRect.y) { g2d.drawLine(prevX, prevY, x, y); } else if (prevY >= chartRect.y && y < chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(prevX, prevY, x1, chartRect.y); } else if (prevY < chartRect.y && y >= chartRect.y) { int x1 = (x - prevX) * (chartRect.y - prevY) / (y - prevY) + prevX; g2d.drawLine(x1, chartRect.y, x, y); } } } } LineRowPlotter(ChartSettings chartSettings, NumberRenderer labelRenderer);   }