diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt.java b/xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt1.java similarity index 97% rename from xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt.java rename to xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt1.java index 7e8eb5df91cdf8e92de00871047ffe3dc4f85cfc..c41260f4e80705bdc8a9ca5a06d916cb465a18ed 100644 --- a/xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt.java +++ b/xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt1.java @@ -31,7 +31,7 @@ import com.xeiam.xchart.XChartPanel; /** * @author rossjourdain */ -public class RealtimeAttempt { +public class RealtimeAttempt1 { private Chart chart; private JPanel chartPanel; @@ -39,7 +39,7 @@ public class RealtimeAttempt { public static void main(String[] args) throws Exception { // Setup the panel - final RealtimeAttempt realtimeAttempt = new RealtimeAttempt(); + final RealtimeAttempt1 realtimeAttempt = new RealtimeAttempt1(); realtimeAttempt.buildPanel(); // Schedule a job for the event-dispatching thread: diff --git a/xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt3.java b/xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt3.java new file mode 100644 index 0000000000000000000000000000000000000000..8d011d895ff292d6a572ad803730d874d3cd9378 --- /dev/null +++ b/xchart-demo/src/main/java/com/xeiam/xchart/standalone/RealtimeAttempt3.java @@ -0,0 +1,140 @@ +/** + * Copyright 2011 - 2014 Xeiam LLC. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.xeiam.xchart.standalone; + +import java.util.ArrayList; +import java.util.List; +import java.util.Timer; +import java.util.TimerTask; + +import javax.swing.JFrame; +import javax.swing.JPanel; + +import com.xeiam.xchart.Chart; +import com.xeiam.xchart.XChartPanel; + +/** + * @author timmolter + */ +public class RealtimeAttempt3 { + + private Chart chart; + private XChartPanel chartPanel; + private static final String SERIES_NAME = "series1"; + private List<Integer> xData; + private List<Double> yData; + + public static void main(String[] args) throws Exception { + + // Setup the panel + final RealtimeAttempt3 realtimeAttempt = new RealtimeAttempt3(); + realtimeAttempt.buildPanel(); + + // Schedule a job for the event-dispatching thread: + // creating and showing this application's GUI. + javax.swing.SwingUtilities.invokeLater(new Runnable() { + + @Override + public void run() { + + // Create and set up the window. + JFrame frame = new JFrame("XChart"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.add(realtimeAttempt.getChartPanel()); + + // Display the window. + frame.pack(); + frame.setVisible(true); + } + }); + + // Simulate a data feed + TimerTask chartUpdaterTask = new TimerTask() { + + @Override + public void run() { + + realtimeAttempt.updateData(); + } + }; + + Timer timer = new Timer(); + timer.scheduleAtFixedRate(chartUpdaterTask, 0, 500); + + } + + public void buildPanel() { + + yData = getRandomData(5); + xData = getMonotonicallyIncreasingData(5); + + // Create Chart + chart = new Chart(500, 400); + chart.setChartTitle("Sample Real-time Chart"); + chart.setXAxisTitle("X"); + chart.setYAxisTitle("Y"); + chart.addSeries(SERIES_NAME, xData, yData); + + chartPanel = new XChartPanel(chart); + } + + public void updateData() { + + // Get some new data + List<Double> newYData = getRandomData(1); + yData.addAll(newYData); + + xData.add(xData.get(xData.size() - 1) + 1); + + // Limit the total number of points + while (yData.size() > 20) { + yData.remove(0); + } + while (xData.size() > 20) { + xData.remove(0); + } + + chartPanel.updateSeries(SERIES_NAME, xData, yData); + } + + public Chart getChart() { + + return chart; + } + + public JPanel getChartPanel() { + + return chartPanel; + } + + private List<Double> getRandomData(int numPoints) { + + List<Double> data = new ArrayList<Double>(); + for (int i = 0; i < numPoints; i++) { + data.add(Math.random() * 100); + } + return data; + } + + private List<Integer> getMonotonicallyIncreasingData(int numPoints) { + + List<Integer> data = new ArrayList<Integer>(); + for (int i = 0; i < numPoints; i++) { + data.add(i); + } + return data; + } +} diff --git a/xchart/src/main/java/com/xeiam/xchart/Chart.java b/xchart/src/main/java/com/xeiam/xchart/Chart.java index 39627f8d0f1b08e29631dc5dbe58c5d123174cd4..3c6f41565029c396a6b03f96402b24367f2ef0bc 100644 --- a/xchart/src/main/java/com/xeiam/xchart/Chart.java +++ b/xchart/src/main/java/com/xeiam/xchart/Chart.java @@ -233,7 +233,7 @@ public class Chart { */ public void setXAxisTitle(String title) { - chartPainter.getAxisPair().getxAxis().getAxisTitle().setText(title); + chartPainter.getAxisPair().getXAxis().getAxisTitle().setText(title); } /** @@ -243,7 +243,7 @@ public class Chart { */ public void setYAxisTitle(String title) { - chartPainter.getAxisPair().getyAxis().getAxisTitle().setText(title); + chartPainter.getAxisPair().getYAxis().getAxisTitle().setText(title); } /** diff --git a/xchart/src/main/java/com/xeiam/xchart/Series.java b/xchart/src/main/java/com/xeiam/xchart/Series.java index 49d7e90ce3616fa05b998a8102b8b7c11d905965..32df03311fce857a8fd6c4b05fde1dfda859d1a5 100644 --- a/xchart/src/main/java/com/xeiam/xchart/Series.java +++ b/xchart/src/main/java/com/xeiam/xchart/Series.java @@ -97,7 +97,6 @@ public class Series { stroke = seriesColorMarkerLineStyle.getStroke(); calculateMinMax(); - } /** @@ -259,22 +258,22 @@ public class Series { return errorBars; } - public double getxMin() { + public double getXMin() { return xMin; } - public double getxMax() { + public double getXMax() { return xMax; } - public double getyMin() { + public double getYMin() { return yMin; } - public double getyMax() { + public double getYMax() { return yMax; } @@ -304,13 +303,13 @@ public class Series { return name; } - void replaceXData(List<Number> newXData) { + void replaceXData(List<? extends Number> newXData) { xData = newXData; calculateMinMax(); } - void replaceYData(List<Number> newYData) { + void replaceYData(List<? extends Number> newYData) { yData = newYData; calculateMinMax(); @@ -322,6 +321,8 @@ public class Series { double[] xMinMax = findMinMax(xData, xAxisType); xMin = xMinMax[0]; xMax = xMinMax[1]; + // System.out.println(xMin); + // System.out.println(xMax); // yData double[] yMinMax = null; diff --git a/xchart/src/main/java/com/xeiam/xchart/XChartPanel.java b/xchart/src/main/java/com/xeiam/xchart/XChartPanel.java index a19923c4e00d2a73c3c87ea41b0abce3f32ca3d2..c4a25ab56f4b46e4d7ef996c9733b0a7b092cb18 100644 --- a/xchart/src/main/java/com/xeiam/xchart/XChartPanel.java +++ b/xchart/src/main/java/com/xeiam/xchart/XChartPanel.java @@ -244,12 +244,13 @@ public class XChartPanel extends JPanel { } /** - * update a series by only updating the Y-Axis data + * update a series by only updating the Y-Axis data. The X-Axis data will is automatically generated as a list of increasing Integers starting from 1 and ending at the size of the new Y-Axis data + * list. * * @param seriesName * @param newYData */ - public void updateSeries(String seriesName, List<Number> newYData) { + public void updateSeries(String seriesName, List<? extends Number> newYData) { Series series = chart.getSeriesMap().get(seriesName); if (series == null) { @@ -268,4 +269,24 @@ public class XChartPanel extends JPanel { revalidate(); repaint(); } + + /** + * update a series by only updating both the X-Axis and Y-Axis data + * + * @param seriesName + * @param newYData + */ + public void updateSeries(String seriesName, List<? extends Number> newXData, List<? extends Number> newYData) { + + Series series = chart.getSeriesMap().get(seriesName); + if (series == null) { + throw new IllegalArgumentException("Series name >" + seriesName + "< not found!!!"); + } + series.replaceXData(newXData); + series.replaceYData(newYData); + + // Re-display the chart + revalidate(); + repaint(); + } } diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java index ee940ec47424ffee1261a9b323208a8375f41fa3..56360dc9f072d38d0f92936629ff0d1f86816c48 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Axis.java @@ -49,9 +49,9 @@ public class Axis implements ChartPart { /** the axis direction */ private Direction direction; - private double min = Double.MAX_VALUE; + private double min;; - private double max = Double.MIN_VALUE; + private double max;; /** the bounds */ private Rectangle2D bounds; @@ -83,6 +83,15 @@ public class Axis implements ChartPart { axisTick = new AxisTick(this); } + /** + * Reset the default min and max values in preparation for calculating the actualy min and max + */ + void resetMinMax() { + + min = Double.MAX_VALUE; + max = Double.MIN_VALUE; + } + /** * @param min * @param max @@ -166,7 +175,7 @@ public class Axis implements ChartPart { double width = 80; // arbitrary, final width depends on Axis tick labels double height = - getChartPainter().getHeight() - yOffset - axisPair.getxAxis().getSizeHint() - getChartPainter().getStyleManager().getPlotPadding() - getChartPainter().getStyleManager().getChartPadding(); + getChartPainter().getHeight() - yOffset - axisPair.getXAxis().getSizeHint() - getChartPainter().getStyleManager().getPlotPadding() - getChartPainter().getStyleManager().getChartPadding(); Rectangle2D yAxisRectangle = new Rectangle2D.Double(xOffset, yOffset, width, height); this.paintZone = yAxisRectangle; @@ -193,9 +202,9 @@ public class Axis implements ChartPart { // |____________________| double xOffset = - axisPair.getyAxis().getBounds().getWidth() + (getChartPainter().getStyleManager().isYAxisTicksVisible() ? getChartPainter().getStyleManager().getPlotPadding() : 0) + axisPair.getYAxis().getBounds().getWidth() + (getChartPainter().getStyleManager().isYAxisTicksVisible() ? getChartPainter().getStyleManager().getPlotPadding() : 0) + getChartPainter().getStyleManager().getChartPadding(); - double yOffset = axisPair.getyAxis().getBounds().getY() + axisPair.getyAxis().getBounds().getHeight() + getChartPainter().getStyleManager().getPlotPadding(); + double yOffset = axisPair.getYAxis().getBounds().getY() + axisPair.getYAxis().getBounds().getHeight() + getChartPainter().getStyleManager().getPlotPadding(); double chartLegendWidth = 0; if (getChartPainter().getStyleManager().getLegendPosition() == LegendPosition.OutsideE) { @@ -206,7 +215,7 @@ public class Axis implements ChartPart { getChartPainter().getWidth() - - axisPair.getyAxis().getBounds().getWidth() + - axisPair.getYAxis().getBounds().getWidth() - chartLegendWidth diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java index ee95a148642878c8065cb09816f80d81bc479d3a..6cbab1c1e7189700c09c566480bba3de2aabb3e4 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisPair.java @@ -149,12 +149,12 @@ public class AxisPair implements ChartPart { return seriesMap; } - public Axis getxAxis() { + public Axis getXAxis() { return xAxis; } - public Axis getyAxis() { + public Axis getYAxis() { return yAxis; } diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickBarChartCalculator.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickBarChartCalculator.java index 0927a728be06eb75b66ee3db786a4b7c58d3f023..b290cef90208211a8f756bab91904e7644b6a50b 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickBarChartCalculator.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/AxisTickBarChartCalculator.java @@ -62,13 +62,13 @@ public class AxisTickBarChartCalculator extends AxisTickCalculator { Iterator<?> xItr = series.getXData().iterator(); while (xItr.hasNext()) { Object x = null; - if (chartPainter.getAxisPair().getxAxis().getAxisType() == AxisType.Number) { + if (chartPainter.getAxisPair().getXAxis().getAxisType() == AxisType.Number) { x = xItr.next(); } - else if (chartPainter.getAxisPair().getxAxis().getAxisType() == AxisType.Date) { + else if (chartPainter.getAxisPair().getXAxis().getAxisType() == AxisType.Date) { x = (double) (((Date) xItr.next()).getTime()); } - else if (chartPainter.getAxisPair().getxAxis().getAxisType() == AxisType.String) { + else if (chartPainter.getAxisPair().getXAxis().getAxisType() == AxisType.String) { x = xItr.next(); } categories.add(x); @@ -84,24 +84,24 @@ public class AxisTickBarChartCalculator extends AxisTickCalculator { NumberFormatter numberFormatter = null; DateFormatter dateFormatter = null; - if (chartPainter.getAxisPair().getxAxis().getAxisType() == AxisType.Number) { + if (chartPainter.getAxisPair().getXAxis().getAxisType() == AxisType.Number) { numberFormatter = new NumberFormatter(styleManager); } - else if (chartPainter.getAxisPair().getxAxis().getAxisType() == AxisType.Date) { + else if (chartPainter.getAxisPair().getXAxis().getAxisType() == AxisType.Date) { dateFormatter = new DateFormatter(chartPainter.getStyleManager()); } int counter = 0; for (Object category : categories) { - if (chartPainter.getAxisPair().getxAxis().getAxisType() == AxisType.Number) { + if (chartPainter.getAxisPair().getXAxis().getAxisType() == AxisType.Number) { tickLabels.add(numberFormatter.formatNumber((Double) category)); } - else if (chartPainter.getAxisPair().getxAxis().getAxisType() == AxisType.Date) { + else if (chartPainter.getAxisPair().getXAxis().getAxisType() == AxisType.Date) { long span = (long) Math.abs(maxValue - minValue); // in data space long gridStepHint = (long) (span / (double) tickSpace * styleManager.getXAxisTickMarkSpacingHint()); long timeUnit = dateFormatter.getTimeUnit(gridStepHint); tickLabels.add(dateFormatter.formatDate((Double) category, timeUnit)); } - else if (chartPainter.getAxisPair().getxAxis().getAxisType() == AxisType.String) { + else if (chartPainter.getAxisPair().getXAxis().getAxisType() == AxisType.String) { tickLabels.add(category.toString()); } int tickLabelPosition = margin + firstPosition + gridStep * counter++; diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartPainter.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartPainter.java index e0951cfa81e94473c4f97d3d30beaee8b65c17e8..ccc1e09db98bca490120d4e092cdf6fb625c5174 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartPainter.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/ChartPainter.java @@ -76,6 +76,9 @@ public class ChartPainter { public void paint(Graphics2D g) { // calc axis min and max + axisPair.getXAxis().resetMinMax(); + axisPair.getYAxis().resetMinMax(); + for (Series series : getAxisPair().getSeriesMap().values()) { // add min/max to axis // System.out.println(series.getxMin()); @@ -83,18 +86,18 @@ public class ChartPainter { // System.out.println(series.getyMin()); // System.out.println(series.getyMax()); // System.out.println("****"); - axisPair.getxAxis().addMinMax(series.getxMin(), series.getxMax()); - axisPair.getyAxis().addMinMax(series.getyMin(), series.getyMax()); + axisPair.getXAxis().addMinMax(series.getXMin(), series.getXMax()); + axisPair.getYAxis().addMinMax(series.getYMin(), series.getYMax()); } // Sanity checks if (axisPair.getSeriesMap().isEmpty()) { throw new RuntimeException("No series defined for Chart!!!"); } - if (getStyleManager().isXAxisLogarithmic() && axisPair.getxAxis().getMin() <= 0.0) { + if (getStyleManager().isXAxisLogarithmic() && axisPair.getXAxis().getMin() <= 0.0) { throw new IllegalArgumentException("Series data (accounting for error bars too) cannot be less or equal to zero for a logarithmic X-Axis!!!"); } - if (getStyleManager().isYAxisLogarithmic() && axisPair.getyAxis().getMin() <= 0.0) { + if (getStyleManager().isYAxisLogarithmic() && axisPair.getYAxis().getMin() <= 0.0) { // System.out.println(axisPair.getyAxis().getMin()); throw new IllegalArgumentException("Series data (accounting for error bars too) cannot be less or equal to zero for a logarithmic Y-Axis!!!"); } diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Plot.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Plot.java index a00d92acf2af9a93f8861e56c2e35351b78f3675..59be2c9fa4880d91e08a2dda15d15250dd591f20 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Plot.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/Plot.java @@ -59,17 +59,17 @@ public class Plot implements ChartPart { bounds = new Rectangle2D.Double(); // calculate bounds - double xOffset = chartPainter.getAxisPair().getyAxis().getBounds().getX() + double xOffset = chartPainter.getAxisPair().getYAxis().getBounds().getX() - + chartPainter.getAxisPair().getyAxis().getBounds().getWidth() + + chartPainter.getAxisPair().getYAxis().getBounds().getWidth() + (chartPainter.getStyleManager().isYAxisTicksVisible() ? (chartPainter.getStyleManager().getPlotPadding()) : 0) ; - double yOffset = chartPainter.getAxisPair().getyAxis().getBounds().getY(); - double width = chartPainter.getAxisPair().getxAxis().getBounds().getWidth(); - double height = chartPainter.getAxisPair().getyAxis().getBounds().getHeight(); + double yOffset = chartPainter.getAxisPair().getYAxis().getBounds().getY(); + double width = chartPainter.getAxisPair().getXAxis().getBounds().getWidth(); + double height = chartPainter.getAxisPair().getYAxis().getBounds().getHeight(); bounds = new Rectangle2D.Double(xOffset, yOffset, width, height); // g.setColor(Color.green); // g.draw(bounds); diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContentBarChart.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContentBarChart.java index 958ceee53da6c882437c91ddb3891c85a96b475c..41a31636130f79f4558837b55cc41d7a0d4ad1b5 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContentBarChart.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContentBarChart.java @@ -74,8 +74,8 @@ public class PlotContentBarChart extends PlotContent { Collection<?> xData = series.getXData(); Collection<? extends Number> yData = series.getYData(); - double yMin = getChartPainter().getAxisPair().getyAxis().getMin(); - double yMax = getChartPainter().getAxisPair().getyAxis().getMax(); + double yMin = getChartPainter().getAxisPair().getYAxis().getMin(); + double yMax = getChartPainter().getAxisPair().getYAxis().getMax(); // if min and max positive, set min to zero if (yMin > 0.0 && yMax > 0.0) { @@ -92,7 +92,7 @@ public class PlotContentBarChart extends PlotContent { } else if (getChartPainter().getStyleManager().isYAxisLogarithmic()) { // int logMin = (int) Math.floor(Math.log10(getChartPainter().getAxisPair().getyAxis().getMin().doubleValue())); - int logMin = (int) Math.floor(Math.log10(getChartPainter().getAxisPair().getyAxis().getMin())); + int logMin = (int) Math.floor(Math.log10(getChartPainter().getAxisPair().getYAxis().getMin())); // System.out.println("logMin: " + logMin); // System.out.println("min : " + getChartPainter().getAxisPair().getyAxis().getMin().doubleValue()); yMin = logMin; diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContentLineChart.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContentLineChart.java index 8dc99fc35a46183abda1a4085e7eee793c1744a6..f70c8bd61ba69527e78711f9293881a4d02cc6fe 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContentLineChart.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotContentLineChart.java @@ -61,12 +61,12 @@ public class PlotContentLineChart extends PlotContent { // data points Collection<?> xData = series.getXData(); - double xMin = getChartPainter().getAxisPair().getxAxis().getMin(); - double xMax = getChartPainter().getAxisPair().getxAxis().getMax(); + double xMin = getChartPainter().getAxisPair().getXAxis().getMin(); + double xMax = getChartPainter().getAxisPair().getXAxis().getMax(); Collection<? extends Number> yData = series.getYData(); - double yMin = getChartPainter().getAxisPair().getyAxis().getMin(); - double yMax = getChartPainter().getAxisPair().getyAxis().getMax(); + double yMin = getChartPainter().getAxisPair().getYAxis().getMin(); + double yMax = getChartPainter().getAxisPair().getYAxis().getMax(); // override min and maxValue if specified if (getChartPainter().getStyleManager().getXAxisMin() != null) { @@ -108,11 +108,11 @@ public class PlotContentLineChart extends PlotContent { while (xItr.hasNext()) { double x = 0.0; - if (getChartPainter().getAxisPair().getxAxis().getAxisType() == AxisType.Number) { + if (getChartPainter().getAxisPair().getXAxis().getAxisType() == AxisType.Number) { x = ((Number) xItr.next()).doubleValue(); // System.out.println(x); } - if (getChartPainter().getAxisPair().getxAxis().getAxisType() == AxisType.Date) { + if (getChartPainter().getAxisPair().getXAxis().getAxisType() == AxisType.Date) { x = ((Date) xItr.next()).getTime(); // System.out.println(x); } diff --git a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotSurface.java b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotSurface.java index 2889baffcc99521b5714821d61d569daf10474fb..ed57666dff6b43f8337ce209b9126ebd637c9af7 100644 --- a/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotSurface.java +++ b/xchart/src/main/java/com/xeiam/xchart/internal/chartpart/PlotSurface.java @@ -67,7 +67,7 @@ public class PlotSurface implements ChartPart { if (getChartPainter().getStyleManager().isPlotGridLinesVisible() || getChartPainter().getStyleManager().isPlotTicksMarksVisible()) { // horizontal - List<Integer> yAxisTickLocations = getChartPainter().getAxisPair().getyAxis().getAxisTick().getTickLocations(); + List<Integer> yAxisTickLocations = getChartPainter().getAxisPair().getYAxis().getAxisTick().getTickLocations(); for (int i = 0; i < yAxisTickLocations.size(); i++) { double tickLocation = yAxisTickLocations.get(i); @@ -97,7 +97,7 @@ public class PlotSurface implements ChartPart { if (getChartPainter().getStyleManager().getChartType() != ChartType.Bar && (getChartPainter().getStyleManager().isPlotGridLinesVisible() || getChartPainter().getStyleManager().isPlotTicksMarksVisible())) { - List<Integer> xAxisTickLocations = getChartPainter().getAxisPair().getxAxis().getAxisTick().getTickLocations(); + List<Integer> xAxisTickLocations = getChartPainter().getAxisPair().getXAxis().getAxisTick().getTickLocations(); for (int i = 0; i < xAxisTickLocations.size(); i++) { double tickLocation = xAxisTickLocations.get(i);