Class PlotUtils

java.lang.Object
io.deephaven.plot.util.PlotUtils

public class PlotUtils extends Object
Utilities class for plotting.
  • Method Details

    • uniqueVarName

      public static String uniqueVarName(String root)
      Gets a variable name not already in the QueryScope by appending random integers to the end of root until a unique name is found.
      Parameters:
      root - base variable name
      Returns:
      unique randomized variable name based off root
    • intToColor

      @Deprecated public static Paint intToColor(ChartImpl chart, Integer color)
      Deprecated.
      Gets the color of the chart's color palette at the specified index color.
      Parameters:
      chart - chart
      color - index
      Returns:
      color of the chart at the index color
    • intToColor

      public static Paint intToColor(Integer color)
    • numberToDouble

      public static double numberToDouble(Number n)
      Gets the double equivalent of the Number. Null QueryConstants are converted to Double.NaN.
      Parameters:
      n - number
      Returns:
      double value of n
      Throws:
      UnsupportedOperationException - n isn't a supported data type
    • table

      public static <T> Table table(T[] x, String colName)
      Creates a new table with a column holding the specified data.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • table

      public static <T> Table table(List<T> x, String colName)
      Creates a new table with a column holding the specified data.
      Type Parameters:
      T - type of the data in x
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • table

      public static Table table(short[] x, String colName)
      Creates a new table with a column of shorts holding the specified data.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • table

      public static Table table(int[] x, String colName)
      Creates a new table with a column of ints holding the specified data.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • table

      public static Table table(long[] x, String colName)
      Creates a new table with a column of longs holding the specified data.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • table

      public static Table table(float[] x, String colName)
      Creates a new table with a column of floats holding the specified data.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • table

      public static Table table(double[] x, String colName)
      Creates a new table with a column of doubles holding the specified data.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static <T extends Number> Table doubleTable(T[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Type Parameters:
      T - type of the data in x
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static <T extends Number> Table doubleTable(List<T> x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Type Parameters:
      T - type of the data in x
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(short[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(int[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(long[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(float[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(double[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(Double[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(Short[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(Long[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(Float[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • doubleTable

      public static Table doubleTable(Integer[] x, String colName)
      Creates a new table with a column of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      colName - column name
      Returns:
      new table with column holding x
    • toFloat

      public static float[] toFloat(double[] x)
      Creates a new array of floats holding the specified data. Values of x are converted to their corresponding float values. Nulls are mapped to Float.NaN.
      Parameters:
      x - data
      Returns:
      new float array holding x
    • toFloat

      public static float[] toFloat(int[] x)
      Creates a new array of floats holding the specified data. Values of x are converted to their corresponding float values. Nulls are mapped to Float.NaN.
      Parameters:
      x - data
      Returns:
      new float array holding x
    • toFloat

      public static float[] toFloat(long[] x)
      Creates a new array of floats holding the specified data. Values of x are converted to their corresponding float values. Nulls are mapped to Float.NaN.
      Parameters:
      x - data
      Returns:
      new float array holding x
    • toFloat

      public static <T extends Number> float[] toFloat(T[] x)
      Creates a new array of floats holding the specified data. Values of x are converted to their corresponding float values. Nulls are mapped to Float.NaN.
      Type Parameters:
      T - type of the data in x
      Parameters:
      x - data
      Returns:
      new float array holding x
    • toDouble

      public static double[] toDouble(float[] x)
      Creates a new array of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      Returns:
      new float array holding x
    • toDouble

      public static double[] toDouble(int[] x)
      Creates a new array of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      Returns:
      new float array holding x
    • toDouble

      public static double[] toDouble(long[] x)
      Creates a new array of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Parameters:
      x - data
      Returns:
      new float array holding x
    • toDouble

      public static <T extends Number> double[] toDouble(T[] x)
      Creates a new array of doubles holding the specified data. Values of x are converted to their corresponding double values. Nulls are mapped to Double.NaN.
      Type Parameters:
      T - type of the data in x
      Parameters:
      x - data
      Returns:
      new float array holding x
    • getNColors

      public static Color[] getNColors(ColorPalette colorPalette, int n)
      Gets the Color array for this palette.
      Returns:
      Array of Color for this palette.
    • minIgnoreNaN

      public static double minIgnoreNaN(double... values)
    • minIgnoreNaN

      public static double minIgnoreNaN(double oldMin, double value)
    • maxIgnoreNaN

      public static double maxIgnoreNaN(double... values)
    • maxIgnoreNaN

      public static double maxIgnoreNaN(double oldMin, double value)
    • minIgnoreNaN

      public static float minIgnoreNaN(float oldMin, float value)
    • maxIgnoreNaN

      public static float maxIgnoreNaN(float oldMin, float value)
    • minIgnoreNull

      public static int minIgnoreNull(int oldMin, int value)
    • maxIgnoreNull

      public static int maxIgnoreNull(int oldMin, int value)
    • minIgnoreNull

      public static short minIgnoreNull(short oldMin, short value)
    • maxIgnoreNull

      public static short maxIgnoreNull(short oldMin, short value)
    • minIgnoreNull

      public static long minIgnoreNull(long oldMin, long value)
    • maxIgnoreNull

      public static long maxIgnoreNull(long oldMin, long value)
    • createCategoryTableHandle

      public static TableHandle createCategoryTableHandle(Table t, String catColumn, String... otherColumns)
    • createCategoryTableHandle

      public static TableHandle createCategoryTableHandle(Table t, String[] catColumns, String... otherColumns)
    • createCategoryPartitionedTableHandle

      public static TableBackedPartitionedTableHandle createCategoryPartitionedTableHandle(Table t, String catColumn, String[] otherColumns, String[] byColumns, PlotInfo plotInfo)
    • createCategoryPartitionedTableHandle

      public static TableBackedPartitionedTableHandle createCategoryPartitionedTableHandle(Table t, String[] catColumns, String[] otherColumns, String[] byColumns, PlotInfo plotInfo)
    • createCategoryTable

      public static Table createCategoryTable(Table t, String[] catColumns)
    • createCategoryHistogramTable

      public static Table createCategoryHistogramTable(Table t, String... byColumns)
    • createCategoryAggs

      public static Collection<? extends Aggregation> createCategoryAggs(Aggregation agg)
    • getColumnConditions

      public static List<Condition> getColumnConditions(Table arg, String column)
    • getNumberFromNumericOrTimeSource

      public static Function<Long,Number> getNumberFromNumericOrTimeSource(Table t, String numericCol, PlotInfo plotInfo)
    • createIndexableData

      public static <T> IndexableData createIndexableData(Table t, String column, PlotInfo plotInfo)
    • createIndexableData

      public static <T> IndexableData createIndexableData(Map<String,Object> snapshotData, @NotNull @NotNull TableDefinition tableDefinition, String column, PlotInfo plotInfo)
    • createIndexableData

      public static <T> IndexableData createIndexableData(Map<String,Object> snapshotData, Class<T> c, String column, PlotInfo plotInfo)
    • createEmptyIndexableData

      public static <T> IndexableData createEmptyIndexableData(Class<T> c, PlotInfo plotInfo)
    • createIndexableData

      public static <T> IndexableData createIndexableData(Object data, PlotInfo plotInfo)
    • createIndexableData

      public static <T> IndexableData createIndexableData(Object data, Class<T> c, PlotInfo plotInfo)
    • createIndexableData

      public static <T extends Comparable> IndexableData createIndexableData(T[] data, PlotInfo plotInfo)
    • createIndexableNumericDataArray

      public static IndexableNumericData createIndexableNumericDataArray(Map<String,Object> data, @NotNull @NotNull TableHandle th, String column, PlotInfo plotInfo)
    • createIndexableNumericDataArray

      public static IndexableNumericData createIndexableNumericDataArray(Map<String,Object> data, @NotNull @NotNull Table t, String column, PlotInfo plotInfo)
    • createIndexableNumericDataArray

      public static IndexableNumericData createIndexableNumericDataArray(Map<String,Object> data, @NotNull @NotNull TableDefinition tableDefinition, String column, PlotInfo plotInfo)
    • createEmptyIndexableNumericDataArray

      public static IndexableNumericData createEmptyIndexableNumericDataArray(Class dataType, PlotInfo plotInfo)
    • createIndexableNumericDataArray

      public static IndexableNumericData createIndexableNumericDataArray(Object data, Class dataType, PlotInfo plotInfo)