* This is a test for bug 1312066 - adding a new series should trigger a
* recalculation of the interval width, if it is being automatically
* calculated.
*/
public void testAddSeries() {
DefaultTableXYDataset d1 = new DefaultTableXYDataset();
d1.setAutoWidth(true);
XYSeries s1 = new XYSeries("Series 1", true, false);
s1.add(3.0, 1.1);
s1.add(7.0, 2.2);
d1.addSeries(s1);
assertEquals(3.0, d1.getXValue(0, 0), EPSILON);
assertEquals(7.0, d1.getXValue(0, 1), EPSILON);
assertEquals(1.0, d1.getStartXValue(0, 0), EPSILON);
assertEquals(5.0, d1.getStartXValue(0, 1), EPSILON);
assertEquals(5.0, d1.getEndXValue(0, 0), EPSILON);
assertEquals(9.0, d1.getEndXValue(0, 1), EPSILON);
// now add another series
XYSeries s2 = new XYSeries("Series 2", true, false);
s2.add(7.5, 1.1);
s2.add(9.0, 2.2);
d1.addSeries(s2);
assertEquals(3.0, d1.getXValue(1, 0), EPSILON);
assertEquals(7.0, d1.getXValue(1, 1), EPSILON);
assertEquals(7.5, d1.getXValue(1, 2), EPSILON);
assertEquals(9.0, d1.getXValue(1, 3), EPSILON);
assertEquals(7.25, d1.getStartXValue(1, 2), EPSILON);
assertEquals(8.75, d1.getStartXValue(1, 3), EPSILON);
assertEquals(7.75, d1.getEndXValue(1, 2), EPSILON);
assertEquals(9.25, d1.getEndXValue(1, 3), EPSILON);
// and check the first series too...
assertEquals(2.75, d1.getStartXValue(0, 0), EPSILON);
assertEquals(6.75, d1.getStartXValue(0, 1), EPSILON);
assertEquals(3.25, d1.getEndXValue(0, 0), EPSILON);
assertEquals(7.25, d1.getEndXValue(0, 1), EPSILON);
}