Package com.illumon.iris.db.plot.util
Class PlotUtils
java.lang.Object
com.illumon.iris.db.plot.util.PlotUtils
Utilities class for plotting.
-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionstatic org.jfree.data.RangecombineRangeIgnoreNaN(org.jfree.data.Range... ranges) static org.jfree.data.RangecombineRangeIgnoreNaN(org.jfree.data.Range r1, org.jfree.data.Range r2) static ComboAggregateFactorystatic TablecreateCategoryHistogramTable(Table t, String... byColumns) static TablecreateCategoryTable(Table t, String[] catColumns) static TableHandlecreateCategoryTableHandle(Table t, String[] catColumns, String... otherColumns) static TableHandlecreateCategoryTableHandle(Table t, String catColumn, String... otherColumns) static TableBackedTableMapHandlecreateCategoryTableMapHandle(Table t, String[] catColumns, String[] otherColumns, String[] byColumns, PlotInfo plotInfo) static TableBackedTableMapHandlecreateCategoryTableMapHandle(Table t, String catColumn, String[] otherColumns, String[] byColumns, PlotInfo plotInfo) static <T> IndexableDatacreateEmptyIndexableData(Class<T> c, PlotInfo plotInfo) static IndexableNumericDatacreateEmptyIndexableNumericDataArray(Class dataType, PlotInfo plotInfo) static <T> IndexableDatacreateIndexableData(Table t, String column, PlotInfo plotInfo) static <T> IndexableDatacreateIndexableData(Object data, PlotInfo plotInfo) static <T> IndexableDatacreateIndexableData(Object data, Class<T> c, PlotInfo plotInfo) static <T> IndexableDatacreateIndexableData(Map<String, Object> snapshotData, TableDefinition tableDefinition, String column, PlotInfo plotInfo) static <T> IndexableDatastatic <T extends Comparable>
IndexableDatacreateIndexableData(T[] data, PlotInfo plotInfo) static IndexableNumericDatacreateIndexableNumericDataArray(Object data, Class dataType, PlotInfo plotInfo) static IndexableNumericDatacreateIndexableNumericDataArray(Map<String, Object> data, TableHandle th, String column, PlotInfo plotInfo) static IndexableNumericDatacreateIndexableNumericDataArray(Map<String, Object> data, TableDefinition tableDefinition, String column, PlotInfo plotInfo) static IndexableNumericDatastatic TabledoubleTable(double[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(float[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(int[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(long[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(short[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(Double[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(Float[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(Integer[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(Long[] x, String colName) Creates a new table with a column of doubles holding the specified data.static TabledoubleTable(Short[] x, String colName) Creates a new table with a column of doubles holding the specified data.doubleTable(List<T> x, String colName) Creates a new table with a column of doubles holding the specified data.doubleTable(T[] x, String colName) Creates a new table with a column of doubles holding the specified data.static voidWaits for all existing threads in the pool to run.static voidWaits for all existingRunnables in the sequential pool to run.getColumnConditions(Table arg, String column) static Color[]getNColors(ColorPalette colorPalette, int n) Gets theColorarray for this palette.getNumberFromNumericOrTimeSource(Table t, String numericCol, PlotInfo plotInfo) static PaintintToColor(ChartImpl chart, Integer color) Gets the color of thechart's color palette at the specified indexcolor.static voidinvokeLater(Runnable runnable) Adds theRunnableto the pool to execute later.static voidinvokeOffEDT(Runnable runnable) If not EventDispatchThread, executes theRunnablein-line, else willinvokeLater(Runnable)static doublemaxIgnoreNaN(double... values) static doublemaxIgnoreNaN(double oldMin, double value) static floatmaxIgnoreNaN(float oldMin, float value) static intmaxIgnoreNull(int oldMin, int value) static longmaxIgnoreNull(long oldMin, long value) static shortmaxIgnoreNull(short oldMin, short value) static doubleminIgnoreNaN(double... values) static doubleminIgnoreNaN(double oldMin, double value) static floatminIgnoreNaN(float oldMin, float value) static intminIgnoreNull(int oldMin, int value) static longminIgnoreNull(long oldMin, long value) static shortminIgnoreNull(short oldMin, short value) static doubleGets the double equivalent of theNumber.static voidsequentialInvokeLater(Runnable runnable) Adds theRunnableto the sequential pool to execute later.static voidsetPoolThreadCount(int n) Sets the number of threads for the thread pool.static TableCreates a new table with a column of doubles holding the specified data.static TableCreates a new table with a column of floats holding the specified data.static TableCreates a new table with a column of ints holding the specified data.static TableCreates a new table with a column of longs holding the specified data.static TableCreates a new table with a column of shorts holding the specified data.static <T> TableCreates a new table with a column holding the specified data.static <T> TableCreates a new table with a column holding the specified data.static double[]toDouble(float[] x) Creates a new array of doubles holding the specified data.static double[]toDouble(int[] x) Creates a new array of doubles holding the specified data.static double[]toDouble(long[] x) Creates a new array of doubles holding the specified data.static <T extends Number>
double[]toDouble(T[] x) Creates a new array of doubles holding the specified data.static float[]toFloat(double[] x) Creates a new array of floats holding the specified data.static float[]toFloat(int[] x) Creates a new array of floats holding the specified data.static float[]toFloat(long[] x) Creates a new array of floats holding the specified data.static <T extends Number>
float[]toFloat(T[] x) Creates a new array of floats holding the specified data.static StringuniqueVarName(String root) Gets a variable name not already in theQueryScopeby appending random integers to the end ofrootuntil a unique name is found.
-
Method Details
-
uniqueVarName
Gets a variable name not already in theQueryScopeby appending random integers to the end ofrootuntil a unique name is found.- Parameters:
root- base variable name- Returns:
- unique randomized variable name based off
root
-
invokeLater
Adds theRunnableto the pool to execute later.- Parameters:
runnable- runnable
-
invokeOffEDT
If not EventDispatchThread, executes theRunnablein-line, else willinvokeLater(Runnable)- Parameters:
runnable- runnable
-
sequentialInvokeLater
Adds theRunnableto the sequential pool to execute later.- Parameters:
runnable- runnable
-
setPoolThreadCount
public static void setPoolThreadCount(int n) Sets the number of threads for the thread pool.- Parameters:
n- number of threads
-
emptyPoolQueue
public static void emptyPoolQueue()Waits for all existing threads in the pool to run.- Throws:
UnsupportedOperationException- if the pool has more than one thread.
-
emptySequentialPoolQueue
public static void emptySequentialPoolQueue()Waits for all existingRunnables in the sequential pool to run. -
intToColor
Gets the color of thechart's color palette at the specified indexcolor.- Parameters:
chart- chartcolor- index- Returns:
- color of the
chartat the indexcolor
-
numberToDouble
Gets the double equivalent of theNumber. NullQueryConstantsare converted to Double.NaN.- Parameters:
n- number- Returns:
- double value of
n - Throws:
UnsupportedOperationException-nisn't a supported data type
-
table
Creates a new table with a column holding the specified data.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
table
Creates a new table with a column holding the specified data.- Type Parameters:
T- type of the data inx- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
table
Creates a new table with a column of shorts holding the specified data.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
table
Creates a new table with a column of ints holding the specified data.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
table
Creates a new table with a column of longs holding the specified data.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
table
Creates a new table with a column of floats holding the specified data.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
table
Creates a new table with a column of doubles holding the specified data.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Type Parameters:
T- type of the data inx- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Type Parameters:
T- type of the data inx- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- column name- Returns:
- new table with column holding
x
-
doubleTable
Creates a new table with a column of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- datacolName- 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 ofxare 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 ofxare 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 ofxare converted to their corresponding float values. Nulls are mapped to Float.NaN.- Parameters:
x- data- Returns:
- new float array holding
x
-
toFloat
Creates a new array of floats holding the specified data. Values ofxare converted to their corresponding float values. Nulls are mapped to Float.NaN.- Type Parameters:
T- type of the data inx- 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 ofxare 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 ofxare 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 ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Parameters:
x- data- Returns:
- new float array holding
x
-
toDouble
Creates a new array of doubles holding the specified data. Values ofxare converted to their corresponding double values. Nulls are mapped to Double.NaN.- Type Parameters:
T- type of the data inx- Parameters:
x- data- Returns:
- new float array holding
x
-
getNColors
Gets theColorarray for this palette.- Returns:
- Array of
Colorfor this palette.
-
combineRangeIgnoreNaN
public static org.jfree.data.Range combineRangeIgnoreNaN(@NotNull org.jfree.data.Range... ranges) -
combineRangeIgnoreNaN
public static org.jfree.data.Range combineRangeIgnoreNaN(org.jfree.data.Range r1, org.jfree.data.Range r2) -
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) -
createCategoryTableMapHandle
-
createCategoryTableMapHandle
-
createCategoryTable
-
createCategoryHistogramTable
-
createCategoryComboAgg
-
getColumnConditions
-
getNumberFromNumericOrTimeSource
-
createIndexableData
-
createIndexableData
public static <T> IndexableData createIndexableData(Map<String, Object> snapshotData, @NotNull TableDefinition tableDefinition, String column, PlotInfo plotInfo) -
createIndexableData
-
createEmptyIndexableData
-
createIndexableData
-
createIndexableData
-
createIndexableData
-
createIndexableNumericDataArray
public static IndexableNumericData createIndexableNumericDataArray(Map<String, Object> data, @NotNull TableHandle th, String column, PlotInfo plotInfo) -
createIndexableNumericDataArray
-
createIndexableNumericDataArray
public static IndexableNumericData createIndexableNumericDataArray(Map<String, Object> data, @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)
-