(right click and select open in new tab) - couldn't figure out how to embed this..
I have set the XY locations as follows for the WHITE points:
1 - -4.5, 4.5
2 - -0.5, 0.5
3 - -2.62, 2.62
4 - -1.31, 1.31
5 - -3.93, 3.93
Does anyone know why my points would be offset the way they are so they are not exactly on the intersections they should be on?
I customized my gridlines to try and match the other lines in my background plot image (if you see any white lines, that is actually in the background image).
When this program actually runs, I will hide the JFreechart gridlines and labels, so I don't need those to look pretty. I thought matching them to the background gridlines would make it easier to place the points in the correct locations.
My gridlines were customized using the following method:
Code: Select all
public void customizeGridLines(XYPlot xy)
{
//get x and y axis, set them to invisible
ValueAxis range = xy.getRangeAxis();
ValueAxis domain = xy.getDomainAxis();
NumberAxis numRange = (NumberAxis) range;
NumberAxis numDomain = (NumberAxis) domain;
//EDIT - COMMENT OUT LATER
xy.setDomainGridlinePaint(Color.BLACK);
xy.setRangeGridlinePaint(Color.BLACK);
//EDIT - CHANGE TO FALSE LATER
range.setVisible(true);
domain.setVisible(true);
xy.setDomainGridlinesVisible(true);
xy.setRangeGridlinesVisible(true);
//set range of entire plot
range.setLowerBound(plotRange*-1.0);
range.setUpperBound(plotRange);
domain.setLowerBound(plotRange*-1.0);
domain.setUpperBound(plotRange);
double upperValue = range.getUpperBound();
//set ticks
//numRange.setTickUnit(new NumberTickUnit(1.31,NumberFormat.getIntegerInstance()));
//numDomain.setTickUnit(new NumberTickUnit(1.31,NumberFormat.getIntegerInstance()));
numRange.setRange(-6.0, 6.0);
numRange.setTickUnit(new NumberTickUnit(1.31));
numDomain.setRange(-6.0, 6.0);
numDomain.setTickUnit(new NumberTickUnit(1.31));
}
Code: Select all
plot = ChartFactory.createScatterPlot(chartTitle, yString, xString, dataset, PlotOrientation.VERTICAL, true, true, true);