@deephaven/chart 0.15.5-vite.12 → 0.15.6-vite.19

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.
Files changed (41) hide show
  1. package/dist/Chart.d.ts +84 -85
  2. package/dist/Chart.d.ts.map +1 -1
  3. package/dist/Chart.js +56 -49
  4. package/dist/Chart.js.map +1 -1
  5. package/dist/ChartModel.d.ts +30 -22
  6. package/dist/ChartModel.d.ts.map +1 -1
  7. package/dist/ChartModel.js +18 -9
  8. package/dist/ChartModel.js.map +1 -1
  9. package/dist/ChartModelFactory.d.ts +67 -43
  10. package/dist/ChartModelFactory.d.ts.map +1 -1
  11. package/dist/ChartModelFactory.js +27 -27
  12. package/dist/ChartModelFactory.js.map +1 -1
  13. package/dist/ChartTestUtils.d.ts +16 -15
  14. package/dist/ChartTestUtils.d.ts.map +1 -1
  15. package/dist/ChartTestUtils.js +5 -0
  16. package/dist/ChartTestUtils.js.map +1 -1
  17. package/dist/ChartTheme.d.ts +17 -17
  18. package/dist/ChartTheme.d.ts.map +1 -1
  19. package/dist/ChartTheme.js.map +1 -1
  20. package/dist/ChartUtils.d.ts +252 -225
  21. package/dist/ChartUtils.d.ts.map +1 -1
  22. package/dist/ChartUtils.js +219 -174
  23. package/dist/ChartUtils.js.map +1 -1
  24. package/dist/FigureChartModel.d.ts +70 -106
  25. package/dist/FigureChartModel.d.ts.map +1 -1
  26. package/dist/FigureChartModel.js +90 -36
  27. package/dist/FigureChartModel.js.map +1 -1
  28. package/dist/MockChartModel.d.ts +11 -209
  29. package/dist/MockChartModel.d.ts.map +1 -1
  30. package/dist/declaration.d.js +2 -0
  31. package/dist/declaration.d.js.map +1 -0
  32. package/dist/index.d.ts +2 -0
  33. package/dist/index.d.ts.map +1 -1
  34. package/dist/index.js +2 -0
  35. package/dist/index.js.map +1 -1
  36. package/dist/isFigureChartModel.d.ts +4 -0
  37. package/dist/isFigureChartModel.d.ts.map +1 -0
  38. package/dist/isFigureChartModel.js +4 -0
  39. package/dist/isFigureChartModel.js.map +1 -0
  40. package/dist/plotly/Plotly.d.ts +1 -0
  41. package/package.json +11 -8
@@ -1,4 +1,42 @@
1
- export default ChartUtils;
1
+ import { Formatter } from '@deephaven/jsapi-utils';
2
+ import { Axis, AxisPosition, AxisType, Chart, Figure, Holiday, Series, SeriesDataSource, SeriesPlotStyle, SourceType, TableTemplate, TimeZone } from '@deephaven/jsapi-shim';
3
+ import { Layout, PlotData, PlotType, Axis as PlotlyAxis, ErrorBar, LayoutAxis } from 'plotly.js';
4
+ import { Range } from '@deephaven/utils';
5
+ import ChartTheme from './ChartTheme';
6
+ export interface ChartModelSettings {
7
+ hiddenSeries?: string[];
8
+ type: keyof SeriesPlotStyle;
9
+ series: string[];
10
+ xAxis: string;
11
+ title?: string;
12
+ }
13
+ export interface SeriesData {
14
+ type: string | null;
15
+ mode: string | null;
16
+ name: string;
17
+ orientation: string;
18
+ xaxis?: number;
19
+ marker?: unknown;
20
+ xLow?: number;
21
+ xHigh?: number;
22
+ }
23
+ declare type LayoutAxisKey = 'xaxis' | 'xaxis2' | 'xaxis3' | 'xaxis4' | 'xaxis5' | 'xaxis6' | 'xaxis7' | 'xaxis8' | 'xaxis9' | 'yaxis' | 'yaxis2' | 'yaxis3' | 'yaxis4' | 'yaxis5' | 'yaxis6' | 'yaxis7' | 'yaxis8' | 'yaxis9';
24
+ export interface TreeMapData extends PlotData {
25
+ tiling: {
26
+ packing: 'squarify';
27
+ pad: 0;
28
+ };
29
+ }
30
+ interface Rangebreaks {
31
+ bounds?: number[];
32
+ dvalue?: number;
33
+ enable?: boolean;
34
+ name?: string;
35
+ pattern?: 'day of week' | 'hour' | '';
36
+ values?: string[];
37
+ }
38
+ export declare type AxisTypeMap = Map<AxisType, Axis[]>;
39
+ declare type AxisPositionMap = Map<AxisPosition, Axis[]>;
2
40
  declare class ChartUtils {
3
41
  static DEFAULT_AXIS_SIZE: number;
4
42
  static MIN_AXIS_SIZE: number;
@@ -7,8 +45,8 @@ declare class ChartUtils {
7
45
  static LEGEND_WIDTH_PX: number;
8
46
  static MAX_LEGEND_SIZE: number;
9
47
  static ORIENTATION: Readonly<{
10
- HORIZONTAL: string;
11
- VERTICAL: string;
48
+ readonly HORIZONTAL: "h";
49
+ readonly VERTICAL: "v";
12
50
  }>;
13
51
  static DATE_FORMAT: string;
14
52
  static DEFAULT_MARGIN: Readonly<{
@@ -24,152 +62,182 @@ declare class ChartUtils {
24
62
  static SUBTITLE_LINE_HEIGHT: number;
25
63
  /**
26
64
  * Converts the Iris plot style into a plotly chart type
27
- * @param {String} plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle
28
- * @param {boolean} isBusinessTime If the plot is using business time for an axis
65
+ * @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle
66
+ * @param isBusinessTime If the plot is using business time for an axis
29
67
  */
30
- static getPlotlyChartType(plotStyle: string, isBusinessTime: boolean): "scattergl" | "scatter" | "bar" | "pie" | "treemap" | "histogram" | "ohlc" | null;
68
+ static getPlotlyChartType(plotStyle: SeriesPlotStyle, isBusinessTime: boolean): PlotType | undefined;
31
69
  /**
32
70
  * Converts the Iris plot style into a plotly chart mode
33
- * @param {String} plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle.*
71
+ * @param plotStyle The plotStyle to use, see dh.plot.SeriesPlotStyle.*
34
72
  */
35
- static getPlotlyChartMode(plotStyle: string): "markers" | "lines" | null;
73
+ static getPlotlyChartMode(plotStyle: SeriesPlotStyle): PlotData['mode'] | undefined;
36
74
  /**
37
75
  * Get the property to set on the series data for plotly
38
- * @param {dh.plot.SeriesPlotStyle} plotStyle The plot style of the series
39
- * @param {dh.plot.SourceType} sourceType The source type for the series
76
+ * @param plotStyle The plot style of the series
77
+ * @param sourceType The source type for the series
40
78
  */
41
- static getPlotlyProperty(plotStyle: dh.plot.SeriesPlotStyle, sourceType: dh.plot.SourceType): "labels" | "values" | "x" | "ids" | "parents" | "marker.colors" | "y" | "z" | "xLow" | "xHigh" | "yLow" | "yHigh" | "time" | "open" | "high" | "low" | "close" | "shape" | "size" | "label" | "color" | "parent" | "hovertext" | "text";
42
- static getPlotlySeriesOrientation(series: any): string;
79
+ static getPlotlyProperty(plotStyle: SeriesPlotStyle, sourceType: SourceType): string;
80
+ static getPlotlySeriesOrientation(series: Series): 'h' | 'v' | undefined;
43
81
  /**
44
82
  * Generate the plotly error bar data from the passed in data.
45
83
  * Iris passes in the values as absolute, plotly needs them as relative.
46
- * @param {Array[Number]} x The main data array
47
- * @param {Array[Number]} xLow The absolute low values
48
- * @param {Array[Number]} xHigh
84
+ * @param x The main data array
85
+ * @param xLow The absolute low values
86
+ * @param xHigh
49
87
  *
50
- * @returns {Object} The error_x object required by plotly, or null if none is required
88
+ * @returns The error_x object required by plotly, or null if none is required
51
89
  */
52
- static getPlotlyErrorBars(x: any[][number], xLow: any[][number], xHigh: any[][number]): Object;
53
- static getPlotlyDateFormat(formatter: any, columnType: any, formatPattern: any): {
54
- tickformat: any;
55
- ticksuffix: string | null;
56
- automargin: boolean;
57
- };
58
- static convertNumberPrefix(prefix: any): any;
59
- static getPlotlyNumberFormat(formatter: any, columnType: any, formatPattern: any): {
60
- tickformat: string;
61
- tickprefix: any;
62
- ticksuffix: any;
63
- automargin: boolean;
64
- } | null;
90
+ static getPlotlyErrorBars(x: number[], xLow: number[], xHigh: number[]): ErrorBar;
91
+ static getPlotlyDateFormat(formatter: Formatter | null, columnType: string, formatPattern: string): Partial<LayoutAxis>;
92
+ static convertNumberPrefix(prefix: string): string;
93
+ static getPlotlyNumberFormat(formatter: Formatter | null, columnType: string, formatPattern: string): Partial<LayoutAxis> | null;
65
94
  /**
66
95
  * Gets the plotly axis formatting information from the source passed in
67
- * @param {dh.plot.Source} source The Source to get the formatter information from
68
- * @param {Formatter} formatter The current formatter for formatting data
96
+ * @param source The Source to get the formatter information from
97
+ * @param formatter The current formatter for formatting data
69
98
  */
70
- static getPlotlyAxisFormat(source: dh.plot.Source, formatter?: Formatter): object | null;
99
+ static getPlotlyAxisFormat(source: SeriesDataSource, formatter?: Formatter | null): Partial<PlotlyAxis> | null;
71
100
  /**
72
101
  * Adds tick spacing for an axis that has gapBetweenMajorTicks defined.
73
102
  *
74
- * @param {object} axisFormat the current axis format, may be null
75
- * @param {object} axis the current axis
76
- * @param {boolean} isDateType indicates if the columns is a date type
103
+ * @param axisFormat the current axis format, may be null
104
+ * @param axis the current axis
105
+ * @param isDateType indicates if the columns is a date type
77
106
  */
78
- static addTickSpacing(axisFormat: object, axis: object, isDateType: boolean): object;
107
+ static addTickSpacing(axisFormat: Partial<LayoutAxis> | null, axis: Axis, isDateType: boolean): Partial<PlotlyAxis> | null;
79
108
  /**
80
109
  * Retrieve the data source for a given axis in a chart
81
- * @param {dh.plot.Chart} chart The chart to get the source for
82
- * @param {dh.plot.Axis} axis The axis to find the source for
83
- * @returns {dh.plot.Source} The first source matching this axis
110
+ * @param chart The chart to get the source for
111
+ * @param axis The axis to find the source for
112
+ * @returns The first source matching this axis
84
113
  */
85
- static getSourceForAxis(chart: dh.plot.Chart, axis: dh.plot.Axis): dh.plot.Source;
114
+ static getSourceForAxis(chart: Chart, axis: Axis): SeriesDataSource | null;
86
115
  /**
87
116
  * Get visibility setting for the series object
88
- * @param {string} name The series name to get the visibility for
89
- * @param {object} settings Chart settings
90
- * @returns {boolean|string} True for visible series and 'legendonly' for hidden
117
+ * @param name The series name to get the visibility for
118
+ * @param settings Chart settings
119
+ * @returns True for visible series and 'legendonly' for hidden
91
120
  */
92
- static getSeriesVisibility(name: string, settings: object): boolean | string;
121
+ static getSeriesVisibility(name: string, settings?: Partial<ChartModelSettings>): boolean | 'legendonly';
93
122
  /**
94
123
  * Get hidden labels array from chart settings
95
- * @param {object} settings Chart settings
96
- * @returns {string[]} Array of hidden series names
124
+ * @param settings Chart settings
125
+ * @returns Array of hidden series names
97
126
  */
98
- static getHiddenLabels(settings: object): string[];
127
+ static getHiddenLabels(settings: Partial<ChartModelSettings>): string[];
99
128
  /**
100
129
  * Create a default series data object. Apply styling to the object afterward.
101
- * @returns {Object} A simple series data object with no styling
130
+ * @returns A simple series data object with no styling
102
131
  */
103
- static makeSeriesData(type: any, mode: any, name: any, orientation?: string): Object;
132
+ static makeSeriesData(type: PlotType | undefined, mode: PlotData['mode'] | undefined, name: string, orientation?: 'h' | 'v'): Partial<PlotData>;
104
133
  /**
105
134
  * Create a data series (trace) for use with plotly
106
- * @param {dh.plot.Series} series The series to create the series data with
107
- * @param {Map<dh.plot.AxisType, dh.plot.Axis[]>} axisTypeMap The map of axes grouped by type
108
- * @param {boolean|string} seriesVisibility Visibility setting for the series
109
- * @param {Object} theme The theme properties for the plot. See ChartTheme.js for an example
110
- * @returns {Object} The series data (trace) object for use with plotly.
135
+ * @param series The series to create the series data with
136
+ * @param axisTypeMap The map of axes grouped by type
137
+ * @param seriesVisibility Visibility setting for the series
138
+ * @param theme The theme properties for the plot. See ChartTheme.js for an example
139
+ * @returns The series data (trace) object for use with plotly.
111
140
  */
112
- static makeSeriesDataFromSeries(series: dh.plot.Series, axisTypeMap: Map<dh.plot.AxisType, dh.plot.Axis[]>, seriesVisibility: boolean | string, theme: Object): Object;
113
- static addSourcesToSeriesData(seriesDataParam: any, plotStyle: any, sources: any, axisTypeMap: any): void;
114
- static addStylingToSeriesData(seriesDataParam: any, plotStyle: any, theme?: {}, lineColor?: null, shapeColor?: null, seriesVisibility?: null): void;
141
+ static makeSeriesDataFromSeries(series: Series, axisTypeMap: AxisTypeMap, seriesVisibility: boolean | 'legendonly', theme?: Readonly<{
142
+ paper_bgcolor: string;
143
+ plot_bgcolor: string;
144
+ title_color: string;
145
+ colorway: string;
146
+ gridcolor: string;
147
+ linecolor: string;
148
+ zerolinecolor: string;
149
+ activecolor: string;
150
+ rangebgcolor: string;
151
+ area_color: string;
152
+ trend_color: string;
153
+ line_color: string;
154
+ error_band_line_color: string;
155
+ error_band_fill_color: string;
156
+ ohlc_increasing: string;
157
+ ohlc_decreasing: string;
158
+ }>): Partial<PlotData>;
159
+ static addSourcesToSeriesData(seriesDataParam: Partial<PlotData>, plotStyle: SeriesPlotStyle, sources: SeriesDataSource[], axisTypeMap: AxisTypeMap): void;
160
+ static addStylingToSeriesData(seriesDataParam: Partial<PlotData>, plotStyle: SeriesPlotStyle, theme?: typeof ChartTheme, lineColor?: string | null, shapeColor?: string | null, seriesVisibility?: 'legendonly' | boolean | null): void;
115
161
  /**
116
162
  * Retrieve the axis formats from the provided figure.
117
163
  * Currently defaults to just the x/y axes.
118
- * @param {dh.plot.Figure} figure The figure to get the axis formats for
119
- * @param {Formatter} formatter The formatter to use when getting the axis format
120
- * @returns {Map<string, object>} A map of axis layout property names to axis formats
164
+ * @param figure The figure to get the axis formats for
165
+ * @param formatter The formatter to use when getting the axis format
166
+ * @returns A map of axis layout property names to axis formats
121
167
  */
122
- static getAxisFormats(figure: dh.plot.Figure, formatter: Formatter): Map<string, object>;
123
- static getChartType(plotStyle: any, isBusinessTime: any): "scattergl" | "scatter" | "bar" | "pie" | "treemap" | "histogram" | "ohlc" | null;
168
+ static getAxisFormats(figure: Figure, formatter: Formatter): Map<LayoutAxisKey, Partial<PlotlyAxis>>;
169
+ static getChartType(plotStyle: SeriesPlotStyle, isBusinessTime: boolean): PlotType | undefined;
124
170
  /**
125
171
  * Return the plotly axis property name
126
- * @param {dh.plot.AxisType} axisType The axis type to get the property name for
172
+ * @param axisType The axis type to get the property name for
127
173
  */
128
- static getAxisPropertyName(axisType: dh.plot.AxisType): "x" | "y" | null;
174
+ static getAxisPropertyName(axisType: AxisType): 'x' | 'y' | null;
129
175
  /**
130
176
  * Returns the plotly "side" value for the provided axis position
131
- * @param {dh.plot.AxisPosition} axisPosition The Iris AxisPosition of the axis
177
+ * @param axisPosition The Iris AxisPosition of the axis
132
178
  */
133
- static getAxisSide(axisPosition: dh.plot.AxisPosition): "bottom" | "top" | "left" | "right" | null;
179
+ static getAxisSide(axisPosition: AxisPosition): LayoutAxis['side'] | undefined;
134
180
  /**
135
181
  * Retrieve the chart that contains the passed in series from the figure
136
- * @param {dh.plot.Figure} figure The figure to retrieve the chart from
137
- * @param {dh.plot.Series} series The series to get the chart for
182
+ * @param figure The figure to retrieve the chart from
183
+ * @param series The series to get the chart for
138
184
  */
139
- static getChartForSeries(figure: dh.plot.Figure, series: dh.plot.Series): any;
185
+ static getChartForSeries(figure: Figure, series: Series): Chart | null;
140
186
  /**
141
187
  * Get an object mapping axis to their ranges
142
- * @param {object} layout The plotly layout object to get the ranges from
143
- * @returns {object} An object mapping the axis name to it's range
188
+ * @param layout The plotly layout object to get the ranges from
189
+ * @returns An object mapping the axis name to it's range
144
190
  */
145
- static getLayoutRanges(layout: object): object;
191
+ static getLayoutRanges(layout: Layout): Record<string, Range[]>;
146
192
  /**
147
193
  * Updates the axes positions and sizes in the layout object provided.
148
194
  * If the axis did not exist in the layout previously, it is created and added.
149
195
  * Any axis that no longer exists in axes is removed.
150
196
  * With Downsampling enabled, will also update the range on the axis itself as appropriate
151
- * @param {object} layoutParam The layout object to update
152
- * @param {dh.plot.Axis[]} axes The axes to update the layout with
153
- * @param {number} plotWidth The width of the plot to calculate the axis sizes for
154
- * @param {number} plotHeight The height of the plot to calculate the axis sizes for
155
- * @param {func} getRangeParser A function to retrieve the range parser for a given axis
197
+ * @param layoutParam The layout object to update
198
+ * @param axes The axes to update the layout with
199
+ * @param plotWidth The width of the plot to calculate the axis sizes for
200
+ * @param plotHeight The height of the plot to calculate the axis sizes for
201
+ * @param getRangeParser A function to retrieve the range parser for a given axis
156
202
  */
157
- static updateLayoutAxes(layoutParam: object, axes: dh.plot.Axis[], plotWidth?: number, plotHeight?: number, getRangeParser?: func, theme?: {}): void;
158
- static getAxisLayoutProperty(axisProperty: any, axisIndex: any): string;
203
+ static updateLayoutAxes(layoutParam: Partial<Layout>, axes: Axis[], plotWidth?: number, plotHeight?: number, getRangeParser?: ((axis: Axis) => (range: Range) => unknown[]) | null, theme?: Readonly<{
204
+ paper_bgcolor: string;
205
+ plot_bgcolor: string;
206
+ title_color: string;
207
+ colorway: string;
208
+ gridcolor: string;
209
+ linecolor: string;
210
+ zerolinecolor: string;
211
+ activecolor: string;
212
+ rangebgcolor: string;
213
+ area_color: string;
214
+ trend_color: string;
215
+ line_color: string;
216
+ error_band_line_color: string;
217
+ error_band_fill_color: string;
218
+ ohlc_increasing: string;
219
+ ohlc_decreasing: string;
220
+ }>): void;
221
+ static getAxisLayoutProperty(axisProperty: 'x' | 'y', axisIndex: number): LayoutAxisKey;
159
222
  /**
160
223
  * Updates the layout axis object in place
161
- * @param {object} layoutAxisParam The plotly layout axis param
162
- * @param {dh.plot.Axis} axis The Iris Axis to update the plotly layout with
163
- * @param {number} axisIndex The type index for this axis
164
- * @param {Map<dh.plot.AxisPosition, dh.plot.Axis>} axisPositionMap All the axes mapped by position
165
- * @param {number} axisSize The size of each axis in percent
166
- * @param {object} bounds The bounds of the axes domains
224
+ * @param layoutAxisParam The plotly layout axis param
225
+ * @param axis The Iris Axis to update the plotly layout with
226
+ * @param axisIndex The type index for this axis
227
+ * @param axisPositionMap All the axes mapped by position
228
+ * @param axisSize The size of each axis in percent
229
+ * @param bounds The bounds of the axes domains
167
230
  */
168
- static updateLayoutAxis(layoutAxisParam: object, axis: dh.plot.Axis, axisIndex: number, axisPositionMap: Map<dh.plot.AxisPosition, dh.plot.Axis>, xAxisSize: any, yAxisSize: any, bounds: object): void;
231
+ static updateLayoutAxis(layoutAxisParam: Partial<LayoutAxis>, axis: Axis, axisIndex: number, axisPositionMap: AxisPositionMap, xAxisSize: number, yAxisSize: number, bounds: {
232
+ left: number;
233
+ bottom: number;
234
+ top: number;
235
+ right: number;
236
+ }): void;
169
237
  /**
170
238
  * Converts an open or close period to a declimal. e.g '09:30" to 9.5
171
239
  *
172
- * @param {String} period the open or close value of the period
240
+ * @param period the open or close value of the period
173
241
  */
174
242
  static periodToDecimal(period: string): number;
175
243
  /**
@@ -178,187 +246,145 @@ declare class ChartUtils {
178
246
  * will result in [[6,1]] meaning close on Saturday and open on Monday.
179
247
  * If you remove Wednesday from the array, then you get two closures [[6, 1], [3, 4]]
180
248
  *
181
- * @param {Array} businessDays the days to display on the x-axis
249
+ * @param businessDays the days to display on the x-axis
182
250
  */
183
- static createBoundsFromDays(businessDays: any[]): any[];
251
+ static createBoundsFromDays(businessDays: string[]): Range[];
184
252
  /**
185
253
  * Creates an array of range breaks for all holidays.
186
254
  *
187
- * @param {Array} holidays an array of holidays
188
- * @param {TimeZone} calendarTimeZone the time zone for the business calendar
189
- * @param {TimeZone} formatterTimeZone the time zone for the formatter
255
+ * @param holidays an array of holidays
256
+ * @param calendarTimeZone the time zone for the business calendar
257
+ * @param formatterTimeZone the time zone for the formatter
190
258
  */
191
- static createRangeBreakValuesFromHolidays(holidays: any[], calendarTimeZone: TimeZone, formatterTimeZone: TimeZone): any[];
259
+ static createRangeBreakValuesFromHolidays(holidays: Holiday[], calendarTimeZone: TimeZone, formatterTimeZone?: TimeZone): Rangebreaks[];
192
260
  /**
193
261
  * Creates the range break value for a full holiday. A full holiday is day that has no business periods.
194
262
  *
195
- * @param {Holiday} holiday the full holiday
196
- * @param {TimeZone} calendarTimeZone the time zone for the business calendar
197
- * @param {TimeZone} formatterTimeZone the time zone for the formatter
263
+ * @param holiday the full holiday
264
+ * @param calendarTimeZone the time zone for the business calendar
265
+ * @param formatterTimeZone the time zone for the formatter
198
266
  */
199
- static createFullHoliday(holiday: Holiday, calendarTimeZone: TimeZone, formatterTimeZone: TimeZone): any;
267
+ static createFullHoliday(holiday: Holiday, calendarTimeZone: TimeZone, formatterTimeZone?: TimeZone): string;
200
268
  /**
201
269
  * Creates the range break for a partial holiday. A partial holiday is holiday with business periods
202
270
  * that are different than the default business periods.
203
271
  *
204
- * @param {Holiday} holiday the partial holiday
205
- * @param {TimeZone} calendarTimeZone the time zone for the business calendar
206
- * @param {TimeZone} formatterTimeZone the time zone for the formatter
272
+ * @param holiday the partial holiday
273
+ * @param calendarTimeZone the time zone for the business calendar
274
+ * @param formatterTimeZone the time zone for the formatter
207
275
  */
208
- static createPartialHoliday(holiday: Holiday, calendarTimeZone: TimeZone, formatterTimeZone: TimeZone): {
209
- values: any[];
276
+ static createPartialHoliday(holiday: Holiday, calendarTimeZone: TimeZone, formatterTimeZone?: TimeZone): {
277
+ values: string[];
210
278
  dvalue: number;
211
279
  }[];
212
280
  /**
213
281
  * Adjusts a date string from the calendar time zone to the formatter time zone.
214
282
  *
215
- * @param {string} dateString the date string
216
- * @param {TimeZone} calendarTimeZone the time zone for the business calendar
217
- * @param {TimeZone} formatterTimeZone the time zone for the formatter
283
+ * @param dateString the date string
284
+ * @param calendarTimeZone the time zone for the business calendar
285
+ * @param formatterTimeZone the time zone for the formatter
218
286
  */
219
- static adjustDateForTimeZone(dateString: string, calendarTimeZone: TimeZone, formatterTimeZone: TimeZone): any;
287
+ static adjustDateForTimeZone(dateString: string, calendarTimeZone: TimeZone, formatterTimeZone?: TimeZone): string;
220
288
  /**
221
289
  * Groups an array and returns a map
222
- * @param {object[]} array The object to group
223
- * @param {string} property The property name to group by
224
- * @returns {Map<object, object>} A map containing the items grouped by their values for the property
290
+ * @param array The object to group
291
+ * @param property The property name to group by
292
+ * @returns A map containing the items grouped by their values for the property
225
293
  */
226
- static groupArray(array: object[], property: string): Map<object, object>;
227
- /**
228
- * Update
229
- */
230
- static updateRanges(): void;
294
+ static groupArray<T, P extends keyof T>(array: T[], property: P): Map<T[P], T[]>;
231
295
  /**
232
296
  * Unwraps a value provided from API to a value plotly can understand
233
297
  * Eg. Unwraps DateWrapper, LongWrapper objects.
234
298
  */
235
- static unwrapValue(value: any, timeZone?: null): any;
299
+ static unwrapValue(value: unknown, timeZone?: TimeZone): unknown;
236
300
  /**
237
301
  *
238
- * @param {any} value The value to wrap up
239
- * @param {string} columnType The type of column this value is from
240
- * @param {dh.i18n.TimeZone} timeZone The time zone if applicable
302
+ * @param value The value to wrap up
303
+ * @param columnType The type of column this value is from
304
+ * @param timeZone The time zone if applicable
241
305
  */
242
- static wrapValue(value: any, columnType: string, timeZone?: dh.i18n.TimeZone): any;
243
- static makeLayoutAxis(type: any, theme?: {}): {
244
- automargin: boolean;
245
- gridcolor: any;
246
- linecolor: any;
247
- rangeslider: {
248
- visible: boolean;
249
- };
250
- showline: boolean;
251
- ticklen: number;
252
- tickcolor: any;
253
- tickfont: {
254
- color: any;
255
- };
256
- title: {
257
- font: {
258
- color: any;
259
- };
260
- };
261
- };
306
+ static wrapValue(value: unknown, columnType: string, timeZone?: TimeZone | null): unknown;
307
+ static makeLayoutAxis(type: AxisType, theme?: Readonly<{
308
+ paper_bgcolor: string;
309
+ plot_bgcolor: string;
310
+ title_color: string;
311
+ colorway: string;
312
+ gridcolor: string;
313
+ linecolor: string;
314
+ zerolinecolor: string;
315
+ activecolor: string;
316
+ rangebgcolor: string;
317
+ area_color: string;
318
+ trend_color: string;
319
+ line_color: string;
320
+ error_band_line_color: string;
321
+ error_band_fill_color: string;
322
+ ohlc_increasing: string;
323
+ ohlc_decreasing: string;
324
+ }>): Partial<LayoutAxis>;
262
325
  /**
263
326
  * Parses the colorway property of a theme and returns an array of colors
264
327
  * Theme could have a single string with space separated colors or an array of strings representing the colorway
265
- * @param {ChartTheme} theme The theme to get colorway from
266
- * @returns {string[]} Colorway array for the theme
328
+ * @param theme The theme to get colorway from
329
+ * @returns Colorway array for the theme
267
330
  */
268
- static getColorwayFromTheme(theme: ChartTheme): string[];
269
- static makeDefaultLayout(theme?: {}): {
270
- autosize: boolean;
271
- colorway: string[];
272
- font: {
273
- family: string;
274
- };
275
- title: {
276
- font: {
277
- color: any;
278
- };
279
- yanchor: string;
280
- pad: {
281
- t: number;
282
- };
283
- y: number;
284
- };
285
- legend: {
286
- font: {
287
- color: any;
288
- };
289
- };
290
- margin: {
291
- l: number;
292
- r: number;
293
- t: number;
294
- b: number;
295
- pad: number;
296
- };
297
- xaxis: {
298
- automargin: boolean;
299
- gridcolor: any;
300
- linecolor: any;
301
- rangeslider: {
302
- visible: boolean;
303
- };
304
- showline: boolean;
305
- ticklen: number;
306
- tickcolor: any;
307
- tickfont: {
308
- color: any;
309
- };
310
- title: {
311
- font: {
312
- color: any;
313
- };
314
- };
315
- };
316
- yaxis: {
317
- automargin: boolean;
318
- gridcolor: any;
319
- linecolor: any;
320
- rangeslider: {
321
- visible: boolean;
322
- };
323
- showline: boolean;
324
- ticklen: number;
325
- tickcolor: any;
326
- tickfont: {
327
- color: any;
328
- };
329
- title: {
330
- font: {
331
- color: any;
332
- };
333
- };
334
- };
335
- };
331
+ static getColorwayFromTheme(theme?: Readonly<{
332
+ paper_bgcolor: string;
333
+ plot_bgcolor: string;
334
+ title_color: string;
335
+ colorway: string;
336
+ gridcolor: string;
337
+ linecolor: string;
338
+ zerolinecolor: string;
339
+ activecolor: string;
340
+ rangebgcolor: string;
341
+ area_color: string;
342
+ trend_color: string;
343
+ line_color: string;
344
+ error_band_line_color: string;
345
+ error_band_fill_color: string;
346
+ ohlc_increasing: string;
347
+ ohlc_decreasing: string;
348
+ }>): string[];
349
+ static makeDefaultLayout(theme?: Readonly<{
350
+ paper_bgcolor: string;
351
+ plot_bgcolor: string;
352
+ title_color: string;
353
+ colorway: string;
354
+ gridcolor: string;
355
+ linecolor: string;
356
+ zerolinecolor: string;
357
+ activecolor: string;
358
+ rangebgcolor: string;
359
+ area_color: string;
360
+ trend_color: string;
361
+ line_color: string;
362
+ error_band_line_color: string;
363
+ error_band_fill_color: string;
364
+ ohlc_increasing: string;
365
+ ohlc_decreasing: string;
366
+ }>): Partial<Layout>;
336
367
  /**
337
368
  * Hydrate settings from a JSONable object
338
- * @param {object} settings Dehydrated settings
369
+ * @param settings Dehydrated settings
339
370
  */
340
- static hydrateSettings(settings: object): {
341
- type: any;
371
+ static hydrateSettings(settings: ChartModelSettings): Omit<ChartModelSettings, 'type'> & {
372
+ type: SeriesPlotStyle;
342
373
  };
343
- static titleFromSettings(settings: any): any;
374
+ static titleFromSettings(settings: ChartModelSettings): string;
344
375
  /**
345
376
  * Creates the Figure settings from the Chart Builder settings
346
377
  * This should be deprecated at some point, and have Chart Builder create the figure settings directly.
347
378
  * This logic will still need to exist to translate existing charts, but could be part of a migration script
348
379
  * to translate the data.
349
380
  * Change when we decide to add more functionality to the Chart Builder.
350
- * @param {object} settings The chart builder settings
351
- * @param {string} settings.title The title for this figure
352
- * @param {string} settings.xAxis The name of the column to use for the x-axis
353
- * @param {string[]} settings.series The name of the columns to use for the series of this figure
354
- * @param {dh.plot.SeriesPlotStyle} settings.type The plot style for this figure
381
+ * @param settings The chart builder settings
382
+ * @param settings.title The title for this figure
383
+ * @param settings.xAxis The name of the column to use for the x-axis
384
+ * @param settings.series The name of the columns to use for the series of this figure
385
+ * @param settings.type The plot style for this figure
355
386
  */
356
- static makeFigureSettings(settings: {
357
- title: string;
358
- xAxis: string;
359
- series: string[];
360
- type: dh.plot.SeriesPlotStyle;
361
- }, table: any): {
387
+ static makeFigureSettings(settings: ChartModelSettings, table: TableTemplate): {
362
388
  charts: {
363
389
  chartType: string;
364
390
  axes: {
@@ -377,11 +403,12 @@ declare class ChartUtils {
377
403
  type: string;
378
404
  position: string;
379
405
  };
380
- table: any;
406
+ table: TableTemplate;
381
407
  }[];
382
408
  }[];
383
409
  }[];
384
- title: any;
410
+ title: string;
385
411
  };
386
412
  }
413
+ export default ChartUtils;
387
414
  //# sourceMappingURL=ChartUtils.d.ts.map