@Override public void paint(Graphics g) { super.paint(g); // set where inside the dialog, the chart needs to be drawn Rectangle clip = new Rectangle(PAD, PAD, getWidth() - (2 * PAD), getHeight() - (2 * PAD)); // draw the background of the chart drawChartBackground(g, clip); // set the position of the axis in case they moved if (yAxis.isLogScale()) { xAxis.setPosition(yAxis.dataValueToScreenPosition(1, clip)); } else { xAxis.setPosition(yAxis.dataValueToScreenPosition(0, clip)); } if (xAxis.isLogScale()) { yAxis.setPosition(xAxis.dataValueToScreenPosition(1, clip)); } else { yAxis.setPosition(xAxis.dataValueToScreenPosition(0, clip)); } // draw the grid xAxis.drawGrid(g, clip); yAxis.drawGrid(g, clip); // draw the curve drawGraphics(g, clip, chartType); // draw the axis xAxis.drawAxis(g, clip); yAxis.drawAxis(g, clip); // draw minor units xAxis.drawMinorUnit(g, clip); yAxis.drawMinorUnit(g, clip); // draw major units xAxis.drawMajorUnit(g, clip); yAxis.drawMajorUnit(g, clip); // draw the chart legend drawLegend(g); }