@deephaven/chart 0.63.1-beta.1 → 0.63.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Chart.d.ts +8 -98
- package/dist/Chart.d.ts.map +1 -1
- package/dist/Chart.js +56 -25
- package/dist/Chart.js.map +1 -1
- package/dist/ChartModelFactory.d.ts +2 -5
- package/dist/ChartModelFactory.d.ts.map +1 -1
- package/dist/ChartModelFactory.js +4 -6
- package/dist/ChartModelFactory.js.map +1 -1
- package/dist/ChartTestUtils.d.ts +6 -6
- package/dist/ChartTestUtils.d.ts.map +1 -1
- package/dist/ChartTestUtils.js.map +1 -1
- package/dist/ChartUtils.d.ts +20 -16
- package/dist/ChartUtils.d.ts.map +1 -1
- package/dist/ChartUtils.js +101 -71
- package/dist/ChartUtils.js.map +1 -1
- package/dist/FigureChartModel.d.ts +1 -4
- package/dist/FigureChartModel.d.ts.map +1 -1
- package/dist/FigureChartModel.js +7 -15
- package/dist/FigureChartModel.js.map +1 -1
- package/dist/MockChartModel.d.ts.map +1 -1
- package/dist/MockChartModel.js +9 -7
- package/dist/MockChartModel.js.map +1 -1
- package/dist/plotly/plotly-extends.d.js +6 -0
- package/dist/plotly/plotly-extends.d.js.map +1 -0
- package/package.json +11 -11
package/dist/ChartTestUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Axis, AxisFormatType, AxisPosition, AxisType, Chart, dh as DhType, Figure, Series, SeriesDataSource } from '@deephaven/jsapi-types';
|
|
1
|
+
import type { Axis, AxisFormatType, AxisPosition, AxisType, Chart, dh as DhType, Figure, Series, SeriesDataSource, SeriesPlotStyle } from '@deephaven/jsapi-types';
|
|
2
2
|
declare class ChartTestUtils {
|
|
3
3
|
static DEFAULT_FIGURE_TITLE: string;
|
|
4
4
|
static DEFAULT_CHART_TITLE: string;
|
|
@@ -21,11 +21,11 @@ declare class ChartTestUtils {
|
|
|
21
21
|
}): SeriesDataSource;
|
|
22
22
|
makeDefaultSources(): SeriesDataSource[];
|
|
23
23
|
makeSeries({ name, plotStyle, sources, lineColor, shapeColor, }?: {
|
|
24
|
-
name?: string |
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
name?: string | null;
|
|
25
|
+
lineColor?: string | null;
|
|
26
|
+
plotStyle?: SeriesPlotStyle | null;
|
|
27
|
+
shapeColor?: string | null;
|
|
28
|
+
sources?: SeriesDataSource[];
|
|
29
29
|
}): Series;
|
|
30
30
|
makeChart({ title, series, axes, showLegend, rowspan, colspan, row, column, }?: {
|
|
31
31
|
title?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartTestUtils.d.ts","sourceRoot":"","sources":["../src/ChartTestUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,EAAE,IAAI,MAAM,EACZ,MAAM,EACN,MAAM,EACN,gBAAgB,
|
|
1
|
+
{"version":3,"file":"ChartTestUtils.d.ts","sourceRoot":"","sources":["../src/ChartTestUtils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,IAAI,EACJ,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,EAAE,IAAI,MAAM,EACZ,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,eAAe,EAChB,MAAM,wBAAwB,CAAC;AAEhC,cAAM,cAAc;IAClB,MAAM,CAAC,oBAAoB,SAAkB;IAE7C,MAAM,CAAC,mBAAmB,SAAiB;IAE3C,MAAM,CAAC,eAAe,SAAY;IAElC,MAAM,CAAC,eAAe,SAAY;IAElC,MAAM,CAAC,mBAAmB,SAAc;IAExC,OAAO,CAAC,EAAE,CAAS;gBAEP,EAAE,EAAE,MAAM;IAItB,QAAQ,CAAC,EACP,KAAc,EACd,IAAgB,EAChB,QAAoB,EACpB,UAAsB,EACtB,aAA6B,EAC7B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,CAAC,EACT,KAA2C,EAC3C,MAA2B,EAC3B,IAAQ,EACR,IAAQ,EACR,MAAW,GACZ;;;;;;KAAK,GAAG,MAAM;CAUhB;AAED,eAAe,cAAc,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartTestUtils.js","names":["ChartTestUtils","constructor","dh","_defineProperty","makeAxis","label","type","undefined","position","formatType","formatPattern","log","arguments","length","Axis","plot","AxisType","X","AxisPosition","BOTTOM","FORMAT_TYPE_NUMBER","makeDefaultAxes","DEFAULT_X_TITLE","DEFAULT_Y_TITLE","Y","makeSource","_ref","axis","SeriesDataSource","makeDefaultSources","axes","map","makeSeries","name","DEFAULT_SERIES_NAME","plotStyle","sources","lineColor","shapeColor","Series","SeriesPlotStyle","SCATTER","makeChart","title","DEFAULT_CHART_TITLE","series","showLegend","rowspan","colspan","row","column","Chart","makeFigure","DEFAULT_FIGURE_TITLE","charts","rows","cols","errors","Figure"],"sources":["../src/ChartTestUtils.ts"],"sourcesContent":["import type {\n Axis,\n AxisFormatType,\n AxisPosition,\n AxisType,\n Chart,\n dh as DhType,\n Figure,\n Series,\n SeriesDataSource,\n} from '@deephaven/jsapi-types';\n\nclass ChartTestUtils {\n static DEFAULT_FIGURE_TITLE = 'Figure Title';\n\n static DEFAULT_CHART_TITLE = 'Chart Title';\n\n static DEFAULT_X_TITLE = 'X Axis';\n\n static DEFAULT_Y_TITLE = 'Y Axis';\n\n static DEFAULT_SERIES_NAME = 'MySeries';\n\n private dh: DhType;\n\n constructor(dh: DhType) {\n this.dh = dh;\n }\n\n makeAxis({\n label = 'Axis',\n type = undefined,\n position = undefined,\n formatType = undefined,\n formatPattern = '###,###0.00',\n log = false,\n }: {\n label?: string;\n type?: AxisType;\n position?: AxisPosition;\n formatType?: AxisFormatType;\n formatPattern?: string;\n log?: boolean;\n } = {}): Axis {\n const { dh } = this;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (dh as any).Axis({\n label,\n type: type ?? dh.plot.AxisType.X,\n position: position ?? dh.plot.AxisPosition.BOTTOM,\n formatType: formatType ?? dh.Axis.FORMAT_TYPE_NUMBER,\n formatPattern,\n log,\n });\n }\n\n makeDefaultAxes(): Axis[] {\n const { dh } = this;\n return [\n this.makeAxis({\n label: ChartTestUtils.DEFAULT_X_TITLE,\n type: dh.plot.AxisType.X,\n }),\n this.makeAxis({\n label: ChartTestUtils.DEFAULT_Y_TITLE,\n type: dh.plot.AxisType.Y,\n }),\n ];\n }\n\n makeSource({ axis = this.makeAxis() }: { axis: Axis }): SeriesDataSource {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.dh as any).SeriesDataSource({ axis, type: axis.type });\n }\n\n makeDefaultSources(): SeriesDataSource[] {\n const axes = this.makeDefaultAxes();\n return axes.map(axis => this.makeSource({ axis }));\n }\n\n makeSeries({\n name = ChartTestUtils.DEFAULT_SERIES_NAME,\n plotStyle = null,\n sources = this.makeDefaultSources(),\n lineColor = null,\n shapeColor = null,\n } = {}): Series {\n const { dh } = this;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (dh as any).Series(\n name,\n plotStyle ?? dh.plot.SeriesPlotStyle.SCATTER,\n sources,\n lineColor,\n shapeColor\n );\n }\n\n makeChart({\n title = ChartTestUtils.DEFAULT_CHART_TITLE,\n series = [this.makeSeries()],\n axes = this.makeDefaultAxes(),\n showLegend = null,\n rowspan = 1,\n colspan = 1,\n row = 0,\n column = 0,\n }: {\n title?: string;\n series?: Series[];\n axes?: Axis[];\n showLegend?: boolean | null;\n rowspan?: number;\n colspan?: number;\n row?: number;\n column?: number;\n } = {}): Chart {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.dh as any).Chart({\n title,\n series,\n axes,\n showLegend,\n row,\n column,\n rowspan,\n colspan,\n });\n }\n\n makeFigure({\n title = ChartTestUtils.DEFAULT_FIGURE_TITLE,\n charts = [this.makeChart()],\n rows = 1,\n cols = 1,\n errors = [],\n } = {}): Figure {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.dh as any).plot.Figure({\n title,\n charts,\n rows,\n cols,\n errors,\n });\n }\n}\n\nexport default ChartTestUtils;\n"],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ChartTestUtils.js","names":["ChartTestUtils","constructor","dh","_defineProperty","makeAxis","label","type","undefined","position","formatType","formatPattern","log","arguments","length","Axis","plot","AxisType","X","AxisPosition","BOTTOM","FORMAT_TYPE_NUMBER","makeDefaultAxes","DEFAULT_X_TITLE","DEFAULT_Y_TITLE","Y","makeSource","_ref","axis","SeriesDataSource","makeDefaultSources","axes","map","makeSeries","name","DEFAULT_SERIES_NAME","plotStyle","sources","lineColor","shapeColor","Series","SeriesPlotStyle","SCATTER","makeChart","title","DEFAULT_CHART_TITLE","series","showLegend","rowspan","colspan","row","column","Chart","makeFigure","DEFAULT_FIGURE_TITLE","charts","rows","cols","errors","Figure"],"sources":["../src/ChartTestUtils.ts"],"sourcesContent":["import type {\n Axis,\n AxisFormatType,\n AxisPosition,\n AxisType,\n Chart,\n dh as DhType,\n Figure,\n Series,\n SeriesDataSource,\n SeriesPlotStyle,\n} from '@deephaven/jsapi-types';\n\nclass ChartTestUtils {\n static DEFAULT_FIGURE_TITLE = 'Figure Title';\n\n static DEFAULT_CHART_TITLE = 'Chart Title';\n\n static DEFAULT_X_TITLE = 'X Axis';\n\n static DEFAULT_Y_TITLE = 'Y Axis';\n\n static DEFAULT_SERIES_NAME = 'MySeries';\n\n private dh: DhType;\n\n constructor(dh: DhType) {\n this.dh = dh;\n }\n\n makeAxis({\n label = 'Axis',\n type = undefined,\n position = undefined,\n formatType = undefined,\n formatPattern = '###,###0.00',\n log = false,\n }: {\n label?: string;\n type?: AxisType;\n position?: AxisPosition;\n formatType?: AxisFormatType;\n formatPattern?: string;\n log?: boolean;\n } = {}): Axis {\n const { dh } = this;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (dh as any).Axis({\n label,\n type: type ?? dh.plot.AxisType.X,\n position: position ?? dh.plot.AxisPosition.BOTTOM,\n formatType: formatType ?? dh.Axis.FORMAT_TYPE_NUMBER,\n formatPattern,\n log,\n });\n }\n\n makeDefaultAxes(): Axis[] {\n const { dh } = this;\n return [\n this.makeAxis({\n label: ChartTestUtils.DEFAULT_X_TITLE,\n type: dh.plot.AxisType.X,\n }),\n this.makeAxis({\n label: ChartTestUtils.DEFAULT_Y_TITLE,\n type: dh.plot.AxisType.Y,\n }),\n ];\n }\n\n makeSource({ axis = this.makeAxis() }: { axis: Axis }): SeriesDataSource {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.dh as any).SeriesDataSource({ axis, type: axis.type });\n }\n\n makeDefaultSources(): SeriesDataSource[] {\n const axes = this.makeDefaultAxes();\n return axes.map(axis => this.makeSource({ axis }));\n }\n\n makeSeries({\n name = ChartTestUtils.DEFAULT_SERIES_NAME,\n plotStyle = null,\n sources = this.makeDefaultSources(),\n lineColor = null,\n shapeColor = null,\n }: {\n name?: string | null;\n lineColor?: string | null;\n plotStyle?: SeriesPlotStyle | null;\n shapeColor?: string | null;\n sources?: SeriesDataSource[];\n } = {}): Series {\n const { dh } = this;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (dh as any).Series(\n name,\n plotStyle ?? dh.plot.SeriesPlotStyle.SCATTER,\n sources,\n lineColor,\n shapeColor\n );\n }\n\n makeChart({\n title = ChartTestUtils.DEFAULT_CHART_TITLE,\n series = [this.makeSeries()],\n axes = this.makeDefaultAxes(),\n showLegend = null,\n rowspan = 1,\n colspan = 1,\n row = 0,\n column = 0,\n }: {\n title?: string;\n series?: Series[];\n axes?: Axis[];\n showLegend?: boolean | null;\n rowspan?: number;\n colspan?: number;\n row?: number;\n column?: number;\n } = {}): Chart {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.dh as any).Chart({\n title,\n series,\n axes,\n showLegend,\n row,\n column,\n rowspan,\n colspan,\n });\n }\n\n makeFigure({\n title = ChartTestUtils.DEFAULT_FIGURE_TITLE,\n charts = [this.makeChart()],\n rows = 1,\n cols = 1,\n errors = [],\n } = {}): Figure {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n return new (this.dh as any).plot.Figure({\n title,\n charts,\n rows,\n cols,\n errors,\n });\n }\n}\n\nexport default ChartTestUtils;\n"],"mappings":";;;AAaA,MAAMA,cAAc,CAAC;EAanBC,WAAWA,CAACC,EAAU,EAAE;IAAAC,eAAA;IACtB,IAAI,CAACD,EAAE,GAAGA,EAAE;EACd;EAEAE,QAAQA,CAAA,EAcM;IAAA,IAdL;MACPC,KAAK,GAAG,MAAM;MACdC,IAAI,GAAGC,SAAS;MAChBC,QAAQ,GAAGD,SAAS;MACpBE,UAAU,GAAGF,SAAS;MACtBG,aAAa,GAAG,aAAa;MAC7BC,GAAG,GAAG;IAQR,CAAC,GAAAC,SAAA,CAAAC,MAAA,QAAAD,SAAA,QAAAL,SAAA,GAAAK,SAAA,MAAG,CAAC,CAAC;IACJ,IAAM;MAAEV;IAAG,CAAC,GAAG,IAAI;IACnB;IACA,OAAO,IAAKA,EAAE,CAASY,IAAI,CAAC;MAC1BT,KAAK;MACLC,IAAI,EAAEA,IAAI,aAAJA,IAAI,cAAJA,IAAI,GAAIJ,EAAE,CAACa,IAAI,CAACC,QAAQ,CAACC,CAAC;MAChCT,QAAQ,EAAEA,QAAQ,aAARA,QAAQ,cAARA,QAAQ,GAAIN,EAAE,CAACa,IAAI,CAACG,YAAY,CAACC,MAAM;MACjDV,UAAU,EAAEA,UAAU,aAAVA,UAAU,cAAVA,UAAU,GAAIP,EAAE,CAACY,IAAI,CAACM,kBAAkB;MACpDV,aAAa;MACbC;IACF,CAAC,CAAC;EACJ;EAEAU,eAAeA,CAAA,EAAW;IACxB,IAAM;MAAEnB;IAAG,CAAC,GAAG,IAAI;IACnB,OAAO,CACL,IAAI,CAACE,QAAQ,CAAC;MACZC,KAAK,EAAEL,cAAc,CAACsB,eAAe;MACrChB,IAAI,EAAEJ,EAAE,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C,eAAeA,cAAc"}
|
package/dist/ChartUtils.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Formatter } from '@deephaven/jsapi-utils';
|
|
2
2
|
import type { Axis, AxisPosition, AxisType, Chart, dh as DhType, Figure, Holiday, Series, SeriesDataSource, SeriesPlotStyle, SourceType, TableTemplate, TimeZone } from '@deephaven/jsapi-types';
|
|
3
|
-
import type { Layout, PlotData, PlotType, Axis as PlotlyAxis, ErrorBar, LayoutAxis, MarkerSymbol } from 'plotly.js';
|
|
3
|
+
import type { Layout, PlotData, PlotType, Axis as PlotlyAxis, ErrorBar, LayoutAxis, MarkerSymbol, Template } from 'plotly.js';
|
|
4
4
|
import { Range } from '@deephaven/utils';
|
|
5
5
|
import { ChartTheme } from './ChartTheme';
|
|
6
6
|
export type FilterColumnMap = Map<string, {
|
|
@@ -83,11 +83,10 @@ declare class ChartUtils {
|
|
|
83
83
|
* @param x The main data array
|
|
84
84
|
* @param xLow The absolute low values
|
|
85
85
|
* @param xHigh
|
|
86
|
-
* @param theme Theme properties for the chart
|
|
87
86
|
*
|
|
88
87
|
* @returns The error_x object required by plotly, or null if none is required
|
|
89
88
|
*/
|
|
90
|
-
static getPlotlyErrorBars(x: number[], xLow: number[], xHigh: number[]
|
|
89
|
+
static getPlotlyErrorBars(x: number[], xLow: number[], xHigh: number[]): ErrorBar;
|
|
91
90
|
static convertNumberPrefix(prefix: string): string;
|
|
92
91
|
static getPlotlyNumberFormat(formatter: Formatter | null, columnType: string, formatPattern: string): Partial<LayoutAxis> | null;
|
|
93
92
|
/**
|
|
@@ -169,12 +168,13 @@ declare class ChartUtils {
|
|
|
169
168
|
*/
|
|
170
169
|
static groupArray<T, P extends keyof T>(array: T[], property: P): Map<T[P], T[]>;
|
|
171
170
|
/**
|
|
172
|
-
* Parses the colorway
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
* @
|
|
171
|
+
* Parses the colorway value of a theme and returns an array of colors
|
|
172
|
+
* Value could be a single string with space separated colors or already be an
|
|
173
|
+
* array of strings representing the colorway
|
|
174
|
+
* @param colorway The colorway value to normalize
|
|
175
|
+
* @returns Colorway array for the theme or undefined
|
|
176
176
|
*/
|
|
177
|
-
static
|
|
177
|
+
static normalizeColorway(colorway?: string | string[]): string[] | undefined;
|
|
178
178
|
static titleFromSettings(settings: ChartModelSettings): string;
|
|
179
179
|
private dh;
|
|
180
180
|
private daysOfWeek;
|
|
@@ -212,12 +212,11 @@ declare class ChartUtils {
|
|
|
212
212
|
* @param series The series to create the series data with
|
|
213
213
|
* @param axisTypeMap The map of axes grouped by type
|
|
214
214
|
* @param seriesVisibility Visibility setting for the series
|
|
215
|
-
* @param theme The theme properties for the plot. See ChartTheme.js for an example
|
|
216
215
|
* @returns The series data (trace) object for use with plotly.
|
|
217
216
|
*/
|
|
218
|
-
makeSeriesDataFromSeries(series: Series, axisTypeMap: AxisTypeMap, seriesVisibility: boolean | 'legendonly',
|
|
217
|
+
makeSeriesDataFromSeries(series: Series, axisTypeMap: AxisTypeMap, seriesVisibility: boolean | 'legendonly', showLegend?: boolean | null): Partial<PlotData>;
|
|
219
218
|
addSourcesToSeriesData(seriesDataParam: Partial<PlotData>, plotStyle: SeriesPlotStyle, sources: SeriesDataSource[], axisTypeMap: AxisTypeMap): void;
|
|
220
|
-
addStylingToSeriesData(seriesDataParam: Partial<PlotData>, plotStyle: SeriesPlotStyle,
|
|
219
|
+
addStylingToSeriesData(seriesDataParam: Partial<PlotData>, plotStyle: SeriesPlotStyle, lineColor?: string | null, shapeColor?: string | null, shape?: string | null, shapeSize?: number | null, seriesVisibility?: 'legendonly' | boolean | null): void;
|
|
221
220
|
getChartType(plotStyle: SeriesPlotStyle, isBusinessTime: boolean): PlotType | undefined;
|
|
222
221
|
/**
|
|
223
222
|
* Return the plotly axis property name
|
|
@@ -233,12 +232,11 @@ declare class ChartUtils {
|
|
|
233
232
|
* Update the layout with all the axes information for the provided figure
|
|
234
233
|
* @param figure Figure to update the axes for
|
|
235
234
|
* @param layoutParam Layout object to update in place
|
|
236
|
-
* @param theme Theme used for displaying the plot
|
|
237
235
|
* @param chartAxisRangeParser Function to retrieve the axis range parser
|
|
238
236
|
* @param plotWidth Width of the plot in pixels
|
|
239
237
|
* @param plotHeight Height of the plot in pixels
|
|
240
238
|
*/
|
|
241
|
-
updateFigureAxes(layoutParam: Partial<Layout>, figure: Figure,
|
|
239
|
+
updateFigureAxes(layoutParam: Partial<Layout>, figure: Figure, chartAxisRangeParser?: ChartAxisRangeParser, plotWidth?: number, plotHeight?: number): void;
|
|
242
240
|
getChartBounds(figure: Figure, chart: Chart, plotWidth: number, plotHeight: number): ChartBounds;
|
|
243
241
|
getPlotlyDateFormat(formatter: Formatter | null, columnType: string, formatPattern: string): Partial<LayoutAxis>;
|
|
244
242
|
/**
|
|
@@ -255,13 +253,12 @@ declare class ChartUtils {
|
|
|
255
253
|
* @param layoutParam The layout object to update
|
|
256
254
|
* @param chartAxes The chart axes to update the layout with
|
|
257
255
|
* @param figureAxes All figure axes to update the layout with
|
|
258
|
-
* @param theme Theme used for displaying the plot
|
|
259
256
|
* @param plotWidth The width of the plot to calculate the axis sizes for
|
|
260
257
|
* @param plotHeight The height of the plot to calculate the axis sizes for
|
|
261
258
|
* @param bounds The bounds for this set of axes
|
|
262
259
|
* @param axisRangeParser A function to retrieve the range parser for a given axis
|
|
263
260
|
*/
|
|
264
|
-
updateLayoutAxes(layoutParam: Partial<Layout>, chartAxes: Axis[], figureAxes: Axis[],
|
|
261
|
+
updateLayoutAxes(layoutParam: Partial<Layout>, chartAxes: Axis[], figureAxes: Axis[], plotWidth?: number, plotHeight?: number, bounds?: ChartBounds, axisRangeParser?: AxisRangeParser): void;
|
|
265
262
|
/**
|
|
266
263
|
* Remove any axes from the layout param that no longer belong to any series
|
|
267
264
|
* @param layoutParam Layout object to remove stale axes from
|
|
@@ -377,7 +374,14 @@ declare class ChartUtils {
|
|
|
377
374
|
* @param timeZone The time zone if applicable
|
|
378
375
|
*/
|
|
379
376
|
wrapValue(value: unknown, columnType: string, timeZone?: TimeZone | null): unknown;
|
|
380
|
-
makeLayoutAxis(type: AxisType, theme: ChartTheme): Partial<LayoutAxis>;
|
|
377
|
+
makeLayoutAxis(type: AxisType, theme: Partial<ChartTheme>): Partial<LayoutAxis>;
|
|
378
|
+
/**
|
|
379
|
+
* Creates a plotly layout template object based on a given theme.
|
|
380
|
+
* See https://plotly.com/javascript/reference/layout/#layout-template
|
|
381
|
+
* @param theme The theme to use for the layout template
|
|
382
|
+
* @returns The layout template object
|
|
383
|
+
*/
|
|
384
|
+
makeDefaultTemplate(theme: ChartTheme): Template;
|
|
381
385
|
/**
|
|
382
386
|
* Creates a plotly layout object based on a given theme.
|
|
383
387
|
* See https://plotly.com/javascript/reference/layout/
|
package/dist/ChartUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartUtils.d.ts","sourceRoot":"","sources":["../src/ChartUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,SAAS,EAGV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,KAAK,EAEL,EAAE,IAAI,MAAM,EACZ,MAAM,EACN,OAAO,EAEP,MAAM,EACN,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,aAAa,EACb,QAAQ,EACT,MAAM,wBAAwB,CAAC;AAEhC,OAAO,KAAK,EACV,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,IAAI,UAAU,EAClB,QAAQ,EACR,UAAU,
|
|
1
|
+
{"version":3,"file":"ChartUtils.d.ts","sourceRoot":"","sources":["../src/ChartUtils.ts"],"names":[],"mappings":"AACA,OAAO,EAEL,SAAS,EAGV,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EACV,IAAI,EACJ,YAAY,EACZ,QAAQ,EACR,KAAK,EAEL,EAAE,IAAI,MAAM,EACZ,MAAM,EACN,OAAO,EAEP,MAA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E,MAAM,CAAC,GAAG;QAAE,IAAI,CAAC,EAAE,eAAe,CAAA;KAAE;CAUjE;AAED,eAAe,UAAU,CAAC"}
|
package/dist/ChartUtils.js
CHANGED
|
@@ -6,7 +6,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
|
6
6
|
import Log from '@deephaven/log';
|
|
7
7
|
import { TableUtils } from '@deephaven/jsapi-utils';
|
|
8
8
|
import set from 'lodash.set';
|
|
9
|
-
import { assertNotNull } from '@deephaven/utils';
|
|
9
|
+
import { assertNotNull, bindAllMethods } from '@deephaven/utils';
|
|
10
10
|
var log = Log.module('ChartUtils');
|
|
11
11
|
var BUSINESS_COLUMN_TYPE = 'io.deephaven.time.DateTime';
|
|
12
12
|
var MILLIS_PER_HOUR = 3600000;
|
|
@@ -30,19 +30,17 @@ class ChartUtils {
|
|
|
30
30
|
* @param x The main data array
|
|
31
31
|
* @param xLow The absolute low values
|
|
32
32
|
* @param xHigh
|
|
33
|
-
* @param theme Theme properties for the chart
|
|
34
33
|
*
|
|
35
34
|
* @returns The error_x object required by plotly, or null if none is required
|
|
36
35
|
*/
|
|
37
|
-
static getPlotlyErrorBars(x, xLow, xHigh
|
|
36
|
+
static getPlotlyErrorBars(x, xLow, xHigh) {
|
|
38
37
|
var array = xHigh.map((value, i) => value - x[i]);
|
|
39
38
|
var arrayminus = xLow.map((value, i) => x[i] - value);
|
|
40
39
|
return {
|
|
41
40
|
type: 'data',
|
|
42
41
|
symmetric: false,
|
|
43
42
|
array,
|
|
44
|
-
arrayminus
|
|
45
|
-
color: theme.error_band_line_color
|
|
43
|
+
arrayminus
|
|
46
44
|
};
|
|
47
45
|
}
|
|
48
46
|
static convertNumberPrefix(prefix) {
|
|
@@ -295,23 +293,23 @@ class ChartUtils {
|
|
|
295
293
|
}
|
|
296
294
|
|
|
297
295
|
/**
|
|
298
|
-
* Parses the colorway
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
* @
|
|
296
|
+
* Parses the colorway value of a theme and returns an array of colors
|
|
297
|
+
* Value could be a single string with space separated colors or already be an
|
|
298
|
+
* array of strings representing the colorway
|
|
299
|
+
* @param colorway The colorway value to normalize
|
|
300
|
+
* @returns Colorway array for the theme or undefined
|
|
302
301
|
*/
|
|
303
|
-
static
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
}
|
|
302
|
+
static normalizeColorway(colorway) {
|
|
303
|
+
if (colorway == null) {
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
if (Array.isArray(colorway)) {
|
|
307
|
+
return colorway;
|
|
308
|
+
}
|
|
309
|
+
if (typeof colorway === 'string') {
|
|
310
|
+
return colorway.split(' ');
|
|
313
311
|
}
|
|
314
|
-
|
|
312
|
+
log.warn("Unexpected colorway format: ".concat(colorway));
|
|
315
313
|
}
|
|
316
314
|
static titleFromSettings(settings) {
|
|
317
315
|
var {
|
|
@@ -326,6 +324,7 @@ class ChartUtils {
|
|
|
326
324
|
_defineProperty(this, "daysOfWeek", void 0);
|
|
327
325
|
this.dh = dh;
|
|
328
326
|
this.daysOfWeek = Object.freeze(dh.calendar.DayOfWeek.values());
|
|
327
|
+
bindAllMethods(this);
|
|
329
328
|
}
|
|
330
329
|
|
|
331
330
|
/**
|
|
@@ -608,11 +607,10 @@ class ChartUtils {
|
|
|
608
607
|
* @param series The series to create the series data with
|
|
609
608
|
* @param axisTypeMap The map of axes grouped by type
|
|
610
609
|
* @param seriesVisibility Visibility setting for the series
|
|
611
|
-
* @param theme The theme properties for the plot. See ChartTheme.js for an example
|
|
612
610
|
* @returns The series data (trace) object for use with plotly.
|
|
613
611
|
*/
|
|
614
|
-
makeSeriesDataFromSeries(series, axisTypeMap, seriesVisibility
|
|
615
|
-
var showLegend = arguments.length >
|
|
612
|
+
makeSeriesDataFromSeries(series, axisTypeMap, seriesVisibility) {
|
|
613
|
+
var showLegend = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
616
614
|
var {
|
|
617
615
|
name,
|
|
618
616
|
isLinesVisible,
|
|
@@ -633,7 +631,7 @@ class ChartUtils {
|
|
|
633
631
|
var orientation = this.getPlotlySeriesOrientation(series);
|
|
634
632
|
var seriesData = ChartUtils.makeSeriesData(type, mode, name, showLegend, orientation);
|
|
635
633
|
this.addSourcesToSeriesData(seriesData, plotStyle, sources, axisTypeMap);
|
|
636
|
-
this.addStylingToSeriesData(seriesData, plotStyle,
|
|
634
|
+
this.addStylingToSeriesData(seriesData, plotStyle, lineColor, shapeColor, shape, shapeSize, seriesVisibility);
|
|
637
635
|
return seriesData;
|
|
638
636
|
}
|
|
639
637
|
addSourcesToSeriesData(seriesDataParam, plotStyle, sources, axisTypeMap) {
|
|
@@ -657,12 +655,12 @@ class ChartUtils {
|
|
|
657
655
|
}
|
|
658
656
|
}
|
|
659
657
|
}
|
|
660
|
-
addStylingToSeriesData(seriesDataParam, plotStyle
|
|
661
|
-
var lineColor = arguments.length >
|
|
662
|
-
var shapeColor = arguments.length >
|
|
663
|
-
var shape = arguments.length >
|
|
664
|
-
var shapeSize = arguments.length >
|
|
665
|
-
var seriesVisibility = arguments.length >
|
|
658
|
+
addStylingToSeriesData(seriesDataParam, plotStyle) {
|
|
659
|
+
var lineColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
660
|
+
var shapeColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
|
|
661
|
+
var shape = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
|
|
662
|
+
var shapeSize = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
|
|
663
|
+
var seriesVisibility = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
|
|
666
664
|
var {
|
|
667
665
|
dh
|
|
668
666
|
} = this;
|
|
@@ -685,32 +683,8 @@ class ChartUtils {
|
|
|
685
683
|
// The default histfunc in plotly is 'count', but the data passed up from the API provides explicit x/y values and bins
|
|
686
684
|
// Since it's converted to bar, just set the widths of each bar
|
|
687
685
|
seriesData.width = [];
|
|
688
|
-
if (seriesData.marker.line !== undefined) {
|
|
689
|
-
Object.assign(seriesData.marker.line, {
|
|
690
|
-
color: theme.paper_bgcolor,
|
|
691
|
-
width: 1
|
|
692
|
-
});
|
|
693
|
-
}
|
|
694
|
-
} else if (plotStyle === dh.plot.SeriesPlotStyle.OHLC) {
|
|
695
|
-
seriesData.increasing = {
|
|
696
|
-
line: {
|
|
697
|
-
color: theme.ohlc_increasing
|
|
698
|
-
}
|
|
699
|
-
};
|
|
700
|
-
seriesData.decreasing = {
|
|
701
|
-
line: {
|
|
702
|
-
color: theme.ohlc_decreasing
|
|
703
|
-
}
|
|
704
|
-
};
|
|
705
686
|
} else if (plotStyle === dh.plot.SeriesPlotStyle.PIE) {
|
|
706
687
|
seriesData.textinfo = 'label+percent';
|
|
707
|
-
|
|
708
|
-
// TODO Open DefinitelyTyped/Plotly PR to mark family and size as optional
|
|
709
|
-
// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/plotly.js/lib/traces/pie.d.ts#L6
|
|
710
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
711
|
-
seriesData.outsidetextfont = {
|
|
712
|
-
color: theme.title_color
|
|
713
|
-
};
|
|
714
688
|
} else if (plotStyle === dh.plot.SeriesPlotStyle.TREEMAP) {
|
|
715
689
|
seriesData.hoverinfo = 'text';
|
|
716
690
|
seriesData.textinfo = 'label+text';
|
|
@@ -719,10 +693,6 @@ class ChartUtils {
|
|
|
719
693
|
pad: 0
|
|
720
694
|
};
|
|
721
695
|
seriesData.textposition = 'middle center';
|
|
722
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
723
|
-
seriesData.outsidetextfont = {
|
|
724
|
-
color: theme.title_color
|
|
725
|
-
};
|
|
726
696
|
}
|
|
727
697
|
if (lineColor != null) {
|
|
728
698
|
if (plotStyle === dh.plot.SeriesPlotStyle.BAR) {
|
|
@@ -809,21 +779,20 @@ class ChartUtils {
|
|
|
809
779
|
* Update the layout with all the axes information for the provided figure
|
|
810
780
|
* @param figure Figure to update the axes for
|
|
811
781
|
* @param layoutParam Layout object to update in place
|
|
812
|
-
* @param theme Theme used for displaying the plot
|
|
813
782
|
* @param chartAxisRangeParser Function to retrieve the axis range parser
|
|
814
783
|
* @param plotWidth Width of the plot in pixels
|
|
815
784
|
* @param plotHeight Height of the plot in pixels
|
|
816
785
|
*/
|
|
817
|
-
updateFigureAxes(layoutParam, figure,
|
|
818
|
-
var plotWidth = arguments.length >
|
|
819
|
-
var plotHeight = arguments.length >
|
|
786
|
+
updateFigureAxes(layoutParam, figure, chartAxisRangeParser) {
|
|
787
|
+
var plotWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
788
|
+
var plotHeight = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
820
789
|
var layout = layoutParam;
|
|
821
790
|
var figureAxes = ChartUtils.getAllAxes(figure);
|
|
822
791
|
for (var i = 0; i < figure.charts.length; i += 1) {
|
|
823
792
|
var _chart3 = figure.charts[i];
|
|
824
793
|
var axisRangeParser = chartAxisRangeParser === null || chartAxisRangeParser === void 0 ? void 0 : chartAxisRangeParser(_chart3);
|
|
825
794
|
var bounds = this.getChartBounds(figure, _chart3, plotWidth, plotHeight);
|
|
826
|
-
this.updateLayoutAxes(layout, _chart3.axes, figureAxes,
|
|
795
|
+
this.updateLayoutAxes(layout, _chart3.axes, figureAxes, plotWidth, plotHeight, bounds, axisRangeParser);
|
|
827
796
|
}
|
|
828
797
|
this.removeStaleAxes(layout, figureAxes);
|
|
829
798
|
}
|
|
@@ -934,22 +903,21 @@ class ChartUtils {
|
|
|
934
903
|
* @param layoutParam The layout object to update
|
|
935
904
|
* @param chartAxes The chart axes to update the layout with
|
|
936
905
|
* @param figureAxes All figure axes to update the layout with
|
|
937
|
-
* @param theme Theme used for displaying the plot
|
|
938
906
|
* @param plotWidth The width of the plot to calculate the axis sizes for
|
|
939
907
|
* @param plotHeight The height of the plot to calculate the axis sizes for
|
|
940
908
|
* @param bounds The bounds for this set of axes
|
|
941
909
|
* @param axisRangeParser A function to retrieve the range parser for a given axis
|
|
942
910
|
*/
|
|
943
|
-
updateLayoutAxes(layoutParam, chartAxes, figureAxes
|
|
944
|
-
var plotWidth = arguments.length >
|
|
945
|
-
var plotHeight = arguments.length >
|
|
946
|
-
var bounds = arguments.length >
|
|
911
|
+
updateLayoutAxes(layoutParam, chartAxes, figureAxes) {
|
|
912
|
+
var plotWidth = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
|
|
913
|
+
var plotHeight = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : 0;
|
|
914
|
+
var bounds = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {
|
|
947
915
|
left: 0,
|
|
948
916
|
top: 0,
|
|
949
917
|
right: 1,
|
|
950
918
|
bottom: 1
|
|
951
919
|
};
|
|
952
|
-
var axisRangeParser = arguments.length >
|
|
920
|
+
var axisRangeParser = arguments.length > 6 ? arguments[6] : undefined;
|
|
953
921
|
var {
|
|
954
922
|
dh
|
|
955
923
|
} = this;
|
|
@@ -975,7 +943,7 @@ class ChartUtils {
|
|
|
975
943
|
var figureAxisIndex = figureTypeAxes.indexOf(_axis2);
|
|
976
944
|
var axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, figureAxisIndex);
|
|
977
945
|
if (layout[axisLayoutProperty] == null) {
|
|
978
|
-
layout[axisLayoutProperty] =
|
|
946
|
+
layout[axisLayoutProperty] = {};
|
|
979
947
|
}
|
|
980
948
|
var layoutAxis = layout[axisLayoutProperty];
|
|
981
949
|
if (layoutAxis != null) {
|
|
@@ -1331,6 +1299,7 @@ class ChartUtils {
|
|
|
1331
1299
|
visible: false
|
|
1332
1300
|
},
|
|
1333
1301
|
showline: true,
|
|
1302
|
+
ticks: 'outside',
|
|
1334
1303
|
ticklen: 5,
|
|
1335
1304
|
// act as padding, can't find a tick padding
|
|
1336
1305
|
tickcolor: theme.paper_bgcolor,
|
|
@@ -1362,6 +1331,65 @@ class ChartUtils {
|
|
|
1362
1331
|
return axis;
|
|
1363
1332
|
}
|
|
1364
1333
|
|
|
1334
|
+
/**
|
|
1335
|
+
* Creates a plotly layout template object based on a given theme.
|
|
1336
|
+
* See https://plotly.com/javascript/reference/layout/#layout-template
|
|
1337
|
+
* @param theme The theme to use for the layout template
|
|
1338
|
+
* @returns The layout template object
|
|
1339
|
+
*/
|
|
1340
|
+
makeDefaultTemplate(theme) {
|
|
1341
|
+
/* eslint-disable camelcase */
|
|
1342
|
+
var {
|
|
1343
|
+
error_band_line_color,
|
|
1344
|
+
ohlc_increasing,
|
|
1345
|
+
ohlc_decreasing,
|
|
1346
|
+
title_color
|
|
1347
|
+
} = theme;
|
|
1348
|
+
return {
|
|
1349
|
+
data: {
|
|
1350
|
+
bar: [{
|
|
1351
|
+
marker: {
|
|
1352
|
+
line: {
|
|
1353
|
+
color: 'transparent'
|
|
1354
|
+
}
|
|
1355
|
+
}
|
|
1356
|
+
}],
|
|
1357
|
+
scatter: [{
|
|
1358
|
+
error_x: {
|
|
1359
|
+
color: error_band_line_color
|
|
1360
|
+
},
|
|
1361
|
+
error_y: {
|
|
1362
|
+
color: error_band_line_color
|
|
1363
|
+
}
|
|
1364
|
+
}],
|
|
1365
|
+
ohlc: [{
|
|
1366
|
+
increasing: {
|
|
1367
|
+
line: {
|
|
1368
|
+
color: ohlc_increasing
|
|
1369
|
+
}
|
|
1370
|
+
},
|
|
1371
|
+
decreasing: {
|
|
1372
|
+
line: {
|
|
1373
|
+
color: ohlc_decreasing
|
|
1374
|
+
}
|
|
1375
|
+
}
|
|
1376
|
+
}],
|
|
1377
|
+
pie: [{
|
|
1378
|
+
outsidetextfont: {
|
|
1379
|
+
color: title_color
|
|
1380
|
+
}
|
|
1381
|
+
}],
|
|
1382
|
+
treemap: [{
|
|
1383
|
+
outsidetextfont: {
|
|
1384
|
+
color: title_color
|
|
1385
|
+
}
|
|
1386
|
+
}]
|
|
1387
|
+
},
|
|
1388
|
+
/* eslint-enable camelcase */
|
|
1389
|
+
layout: this.makeDefaultLayout(theme)
|
|
1390
|
+
};
|
|
1391
|
+
}
|
|
1392
|
+
|
|
1365
1393
|
/**
|
|
1366
1394
|
* Creates a plotly layout object based on a given theme.
|
|
1367
1395
|
* See https://plotly.com/javascript/reference/layout/
|
|
@@ -1388,7 +1416,7 @@ class ChartUtils {
|
|
|
1388
1416
|
paper_bgcolor,
|
|
1389
1417
|
plot_bgcolor,
|
|
1390
1418
|
autosize: true,
|
|
1391
|
-
colorway: ChartUtils.
|
|
1419
|
+
colorway: ChartUtils.normalizeColorway(theme === null || theme === void 0 ? void 0 : theme.colorway),
|
|
1392
1420
|
font: {
|
|
1393
1421
|
family: "'Fira Sans', sans-serif",
|
|
1394
1422
|
color: title_color
|
|
@@ -1397,6 +1425,8 @@ class ChartUtils {
|
|
|
1397
1425
|
font: {
|
|
1398
1426
|
color: title_color
|
|
1399
1427
|
},
|
|
1428
|
+
xanchor: 'center',
|
|
1429
|
+
xref: 'paper',
|
|
1400
1430
|
yanchor: 'top',
|
|
1401
1431
|
pad: _objectSpread({}, ChartUtils.DEFAULT_TITLE_PADDING),
|
|
1402
1432
|
y: 1
|