Class StandardCategoryDataset3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>>

java.lang.Object
org.jfree.chart3d.data.AbstractDataset3D
org.jfree.chart3d.data.category.StandardCategoryDataset3D<S,R,C>
All Implemented Interfaces:
Serializable, CategoryDataset3D<S,R,C>, Dataset3D, KeyedValues3D<S,R,C,Number>, Values3D<Number>

public final class StandardCategoryDataset3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>> extends AbstractDataset3D implements CategoryDataset3D<S,R,C>, Serializable
A standard implementation of the CategoryDataset3D interface. This dataset is typically used to create bar charts and stacked bar charts.

NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
See Also:
  • Constructor Details

  • Method Details

    • getSeriesCount

      public int getSeriesCount()
      Returns the number of data series in the dataset.
      Specified by:
      getSeriesCount in interface Values3D<S extends Comparable<S>>
      Returns:
      The number of data series.
    • getRowCount

      public int getRowCount()
      Returns the number of rows in the dataset.
      Specified by:
      getRowCount in interface Values3D<S extends Comparable<S>>
      Returns:
      The number of rows.
    • getColumnCount

      public int getColumnCount()
      Returns the number of columns in the dataset.
      Specified by:
      getColumnCount in interface Values3D<S extends Comparable<S>>
      Returns:
      The number of columns.
    • getSeriesKey

      public S getSeriesKey(int seriesIndex)
      Returns the key for the specified series.
      Specified by:
      getSeriesKey in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Parameters:
      seriesIndex - the series index.
      Returns:
      The series key.
    • getRowKey

      public R getRowKey(int rowIndex)
      Returns the key for the specified row.
      Specified by:
      getRowKey in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Parameters:
      rowIndex - The row index.
      Returns:
      The row key.
    • getColumnKey

      public C getColumnKey(int columnIndex)
      Returns the key for the specified column.
      Specified by:
      getColumnKey in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Parameters:
      columnIndex - the column index.
      Returns:
      The column key.
    • getSeriesIndex

      public int getSeriesIndex(S serieskey)
      Returns the index for the specified series key, or -1 if the key is not defined in the dataset.
      Specified by:
      getSeriesIndex in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Parameters:
      serieskey - the series key (null not permitted).
      Returns:
      The series index or -1.
    • getRowIndex

      public int getRowIndex(R rowkey)
      Returns the index of the specified row key, or -1 if there is no matching key.
      Specified by:
      getRowIndex in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Parameters:
      rowkey - the row key (null not permitted).
      Returns:
      The row index or -1.
    • getColumnIndex

      public int getColumnIndex(C columnkey)
      Returns the index of the specified column key, or -1 if there is no matching key.
      Specified by:
      getColumnIndex in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Parameters:
      columnkey - the column key (null not permitted).
      Returns:
      The column index or -1.
    • getSeriesKeys

      public List<S> getSeriesKeys()
      Returns a list of the series keys for the dataset. Modifying this list will have no impact on the underlying dataset.
      Specified by:
      getSeriesKeys in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Returns:
      A list of the series keys (possibly empty, but never null).
    • getRowKeys

      public List<R> getRowKeys()
      Returns a list of the row keys for the dataset. Modifying this list will have no impact on the underlying dataset.
      Specified by:
      getRowKeys in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Returns:
      A list of the row keys (possibly empty, but never null).
    • getColumnKeys

      public List<C> getColumnKeys()
      Returns a list of the column keys for the dataset. Modifying this list will have no impact on the underlying dataset.
      Specified by:
      getColumnKeys in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Returns:
      A list of the column keys (possibly empty, but never null).
    • getValue

      public Number getValue(S seriesKey, R rowKey, C columnKey)
      Returns the value for a series at the specified cell (referenced by row key and column key).
      Specified by:
      getValue in interface KeyedValues3D<S extends Comparable<S>,R extends Comparable<R>,C extends Comparable<C>,Number>
      Parameters:
      seriesKey - the series key (null not permitted).
      rowKey - the row key (null not permitted).
      columnKey - the column key (null not permitted).
      Returns:
      The value (possibly null).
    • getValue

      public Number getValue(int seriesIndex, int rowIndex, int columnIndex)
      Returns the value for a series at the specified cell (referenced by row index and column index).
      Specified by:
      getValue in interface Values3D<S extends Comparable<S>>
      Parameters:
      seriesIndex - the series index.
      rowIndex - the row index.
      columnIndex - the column index.
      Returns:
      The value (possibly null).
    • setValue

      public void setValue(Number n, S seriesKey, R rowKey, C columnKey)
      Sets the value for a series at the specified cell (referenced by row key and column key).
      Parameters:
      n - the value (null permitted).
      seriesKey - the series key (null not permitted).
      rowKey - the row key (null not permitted).
      columnKey - the column key (null not permitted).
    • addValue

      public void addValue(Number n, S seriesKey, R rowKey, C columnKey)
      Adds a value for a series at the specified cell (referenced by row key and column key). This method simply calls setValue(java.lang.Number, java.lang.Comparable, java.lang.Comparable, java.lang.Comparable).
      Parameters:
      n - the value (null permitted).
      seriesKey - the series key (null not permitted).
      rowKey - the row key (null not permitted).
      columnKey - the column key (null not permitted).
    • getDoubleValue

      public double getDoubleValue(int seriesIndex, int rowIndex, int columnIndex)
      Returns the value for a series at the specified cell (referenced by row index and column index) as a double primitive. If the stored data value is null, this method returns Double.NaN.
      Specified by:
      getDoubleValue in interface Values3D<S extends Comparable<S>>
      Parameters:
      seriesIndex - the series index.
      rowIndex - the row index.
      columnIndex - the column index.
      Returns:
      The value (possibly Double.NaN).
    • addSeriesAsRow

      public void addSeriesAsRow(S seriesKey, KeyedValues<C,? extends Number> data)
      Adds a data series as a single row in the dataset.
      Parameters:
      seriesKey - the series key (null not permitted).
      data - the data (null not permitted).
    • addSeriesAsRow

      public void addSeriesAsRow(S seriesKey, R rowKey, KeyedValues<C,? extends Number> data)
      Adds a data series as a single row in the dataset.
      Parameters:
      seriesKey - the series key (null not permitted).
      rowKey - the row key (null not permitted).
      data - the data (null not permitted).
    • equals

      public boolean equals(Object obj)
      Tests this instance for equality with an arbitrary object.
      Overrides:
      equals in class Object
      Parameters:
      obj - the object to test against (null permitted).
      Returns:
      A boolean.
    • toString

      public String toString()
      Returns a string representation of this instance, primarily for debugging purposes.

      Implementation note: the current implementation (which is subject to change) writes the dataset in JSON format using JSONUtils.writeKeyedValues3D(org.jfree.chart3d.data.KeyedValues3D).
      Overrides:
      toString in class Object
      Returns:
      A string.