Class XYChart


  • public class XYChart
    extends org.knowm.xchart.internal.chartpart.Chart<XYStyler,​XYSeries>
    • Field Summary

      • Fields inherited from class org.knowm.xchart.internal.chartpart.Chart

        axisPair, chartTitle, legend, plot, seriesMap, styler
    • Constructor Summary

      Constructors 
      Constructor Description
      XYChart​(int width, int height)
      Constructor - the default Chart Theme will be used (XChartTheme)
      XYChart​(int width, int height, Styler.ChartTheme chartTheme)
      Constructor
      XYChart​(int width, int height, Theme theme)
      Constructor
      XYChart​(XYChartBuilder chartBuilder)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      XYSeries addSeries​(String seriesName, double[] yData)
      Add a series for a X-Y type chart using using double arrays
      XYSeries addSeries​(String seriesName, double[] xData, double[] yData)
      Add a series for a X-Y type chart using using double arrays
      XYSeries addSeries​(String seriesName, double[] xData, double[] yData, double[] errorBars)  
      XYSeries addSeries​(String seriesName, float[] yData)
      Add a series for a X-Y type chart using using float arrays
      XYSeries addSeries​(String seriesName, float[] xData, float[] yData)
      Add a series for a X-Y type chart using using float arrays
      XYSeries addSeries​(String seriesName, float[] xData, float[] yData, float[] errorBars)
      Add a series for a X-Y type chart using using float arrays with error bars
      XYSeries addSeries​(String seriesName, int[] yData)
      Add a series for a X-Y type chart using using int arrays
      XYSeries addSeries​(String seriesName, int[] xData, int[] yData)
      Add a series for a X-Y type chart using using int arrays
      XYSeries addSeries​(String seriesName, int[] xData, int[] yData, int[] errorBars)
      Add a series for a X-Y type chart using using int arrays with error bars
      XYSeries addSeries​(String seriesName, List<?> xData, List<? extends Number> yData)
      Add a series for a X-Y type chart using Lists
      XYSeries addSeries​(String seriesName, List<?> xData, List<? extends Number> yData, List<? extends Number> errorBars)
      Add a series for a X-Y type chart using Lists
      XYSeries addSeries​(String seriesName, List<? extends Number> yData)
      Add a series for a X-Y type chart using Lists
      void paint​(Graphics2D g, int width, int height)  
      XYSeries updateXYSeries​(String seriesName, double[] newXData, double[] newYData, double[] newErrorBarData)
      Update a series by updating the X-Axis, Y-Axis and error bar data
      XYSeries updateXYSeries​(String seriesName, List<?> newXData, List<? extends Number> newYData, List<? extends Number> newErrorBarData)
      Update a series by updating the X-Axis, Y-Axis and error bar data
      • Methods inherited from class org.knowm.xchart.internal.chartpart.Chart

        getHeight, getSeriesMap, getStyler, getTitle, getToolTips, getWidth, getXAxisTitle, getYAxisGroupTitle, getYAxisLabelOverrideMap, getYAxisTitle, paintBackground, removeSeries, setHeight, setTitle, setWidth, setXAxisLabelOverrideMap, setXAxisTitle, setYAxisGroupTitle, setYAxisLabelOverrideMap, setYAxisLabelOverrideMap, setYAxisTitle
    • Constructor Detail

      • XYChart

        public XYChart​(int width,
                       int height)
        Constructor - the default Chart Theme will be used (XChartTheme)
        Parameters:
        width -
        height -
      • XYChart

        public XYChart​(int width,
                       int height,
                       Theme theme)
        Constructor
        Parameters:
        width -
        height -
        theme - - pass in a instance of Theme class, probably a custom Theme.
      • XYChart

        public XYChart​(int width,
                       int height,
                       Styler.ChartTheme chartTheme)
        Constructor
        Parameters:
        width -
        height -
        chartTheme - - pass in the desired ChartTheme enum
      • XYChart

        public XYChart​(XYChartBuilder chartBuilder)
        Constructor
        Parameters:
        chartBuilder -
    • Method Detail

      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  double[] yData)
        Add a series for a X-Y type chart using using double arrays
        Parameters:
        seriesName -
        yData - the Y-Axis data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  double[] xData,
                                  double[] yData)
        Add a series for a X-Y type chart using using double arrays
        Parameters:
        seriesName -
        xData - the X-Axis data
        xData - the Y-Axis data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  float[] yData)
        Add a series for a X-Y type chart using using float arrays
        Parameters:
        seriesName -
        yData - the Y-Axis data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  float[] xData,
                                  float[] yData)
        Add a series for a X-Y type chart using using float arrays
        Parameters:
        seriesName -
        xData - the X-Axis data
        xData - the Y-Axis data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  float[] xData,
                                  float[] yData,
                                  float[] errorBars)
        Add a series for a X-Y type chart using using float arrays with error bars
        Parameters:
        seriesName -
        xData - the X-Axis data
        xData - the Y-Axis data
        errorBars - the error bar data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  int[] yData)
        Add a series for a X-Y type chart using using int arrays
        Parameters:
        seriesName -
        yData - the Y-Axis data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  int[] xData,
                                  int[] yData)
        Add a series for a X-Y type chart using using int arrays
        Parameters:
        seriesName -
        xData - the X-Axis data
        yData - the Y-Axis data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  int[] xData,
                                  int[] yData,
                                  int[] errorBars)
        Add a series for a X-Y type chart using using int arrays with error bars
        Parameters:
        seriesName -
        xData - the X-Axis data
        xData - the Y-Axis data
        errorBars - the error bar data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  List<?> xData,
                                  List<? extends Number> yData)
        Add a series for a X-Y type chart using Lists
        Parameters:
        seriesName -
        xData - the X-Axis data
        yData - the Y-Axis data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  List<? extends Number> yData)
        Add a series for a X-Y type chart using Lists
        Parameters:
        seriesName -
        yData - the Y-Axis data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  List<?> xData,
                                  List<? extends Number> yData,
                                  List<? extends Number> errorBars)
        Add a series for a X-Y type chart using Lists
        Parameters:
        seriesName -
        xData - the X-Axis data
        yData - the Y-Axis data
        errorBars - the error bar data
        Returns:
        A Series object that you can set properties on
      • addSeries

        public XYSeries addSeries​(String seriesName,
                                  double[] xData,
                                  double[] yData,
                                  double[] errorBars)
      • updateXYSeries

        public XYSeries updateXYSeries​(String seriesName,
                                       List<?> newXData,
                                       List<? extends Number> newYData,
                                       List<? extends Number> newErrorBarData)
        Update a series by updating the X-Axis, Y-Axis and error bar data
        Parameters:
        seriesName -
        newXData - - set null to be automatically generated as a list of increasing Integers starting from 1 and ending at the size of the new Y-Axis data list.
        newYData -
        newErrorBarData - - set null if there are no error bars
        Returns:
      • updateXYSeries

        public XYSeries updateXYSeries​(String seriesName,
                                       double[] newXData,
                                       double[] newYData,
                                       double[] newErrorBarData)
        Update a series by updating the X-Axis, Y-Axis and error bar data
        Parameters:
        seriesName -
        newXData - - set null to be automatically generated as a list of increasing Integers starting from 1 and ending at the size of the new Y-Axis data list.
        newYData -
        newErrorBarData - - set null if there are no error bars
        Returns:
      • paint

        public void paint​(Graphics2D g,
                          int width,
                          int height)
        Specified by:
        paint in class org.knowm.xchart.internal.chartpart.Chart<XYStyler,​XYSeries>