@deephaven/chart 0.6.1-fixed-deps.2 → 0.6.3-alpha.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.js CHANGED
@@ -1,4 +1,4 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2
2
 
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
4
 
@@ -195,7 +195,7 @@ export class Chart extends Component {
195
195
  }
196
196
 
197
197
  handleDownsampleClick() {
198
- this.setState((_ref) => {
198
+ this.setState(_ref => {
199
199
  var {
200
200
  isDownsamplingDisabled
201
201
  } = _ref;
@@ -11,6 +11,7 @@ declare class ChartModelFactory {
11
11
  * @param {string} settings.xAxis The column name to use for the x-axis
12
12
  * @param {string[]} settings.hiddenSeries Array of hidden series names
13
13
  * @param {dh.Table} table The table to build the model for
14
+ * @param {Object} theme The theme for the figure. Defaults to ChartTheme
14
15
  * @returns {Promise<FigureChartModel>} The FigureChartModel representing the figure
15
16
  */
16
17
  static makeModelFromSettings(settings: {
@@ -20,7 +21,7 @@ declare class ChartModelFactory {
20
21
  type: string;
21
22
  xAxis: string;
22
23
  hiddenSeries: string[];
23
- }, table: any): Promise<FigureChartModel>;
24
+ }, table: any, theme?: Object): Promise<FigureChartModel>;
24
25
  /**
25
26
  * Creates a model from the settings provided.
26
27
  * Tries to create a Figure in the API with it.
@@ -32,6 +33,7 @@ declare class ChartModelFactory {
32
33
  * @param {string} settings.xAxis The column name to use for the x-axis
33
34
  * @param {string[]} settings.hiddenSeries Array of hidden series names
34
35
  * @param {dh.Figure} figure The figure to build the model for
36
+ * @param {Object} theme The theme for the figure. Defaults to ChartTheme
35
37
  * @returns {Promise<FigureChartModel>} The FigureChartModel representing the figure
36
38
  */
37
39
  static makeModel(settings: {
@@ -41,7 +43,7 @@ declare class ChartModelFactory {
41
43
  type: string;
42
44
  xAxis: string;
43
45
  hiddenSeries: string[];
44
- }, figure: any): Promise<FigureChartModel>;
46
+ }, figure: any, theme?: Object): Promise<FigureChartModel>;
45
47
  }
46
48
  import FigureChartModel from "./FigureChartModel";
47
49
  //# sourceMappingURL=ChartModelFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ChartModelFactory.d.ts","sourceRoot":"","sources":["../src/ChartModelFactory.js"],"names":[],"mappings":";AAIA;IACE;;;;;;;;;;;;OAYG;IACH;QAT6B,QAAQ,EAA1B,OAAO;QACY,MAAM,EAAzB,MAAM,EAAE;QACS,aAAa,EAA9B,MAAM;QACW,IAAI,EAArB,MAAM;QACW,KAAK,EAAtB,MAAM;QACa,YAAY,EAA/B,MAAM,EAAE;oBAEN,QAAQ,gBAAgB,CAAC,CAgBrC;IAED;;;;;;;;;;;;OAYG;IACH;QAT6B,QAAQ,EAA1B,OAAO;QACY,MAAM,EAAzB,MAAM,EAAE;QACS,aAAa,EAA9B,MAAM;QACW,IAAI,EAArB,MAAM;QACW,KAAK,EAAtB,MAAM;QACa,YAAY,EAA/B,MAAM,EAAE;qBAEN,QAAQ,gBAAgB,CAAC,CAIrC;CACF"}
1
+ {"version":3,"file":"ChartModelFactory.d.ts","sourceRoot":"","sources":["../src/ChartModelFactory.js"],"names":[],"mappings":";AAKA;IACE;;;;;;;;;;;;;OAaG;IACH;QAV6B,QAAQ,EAA1B,OAAO;QACY,MAAM,EAAzB,MAAM,EAAE;QACS,aAAa,EAA9B,MAAM;QACW,IAAI,EAArB,MAAM;QACW,KAAK,EAAtB,MAAM;QACa,YAAY,EAA/B,MAAM,EAAE;2BAER,MAAM,GACJ,QAAQ,gBAAgB,CAAC,CAgBrC;IAED;;;;;;;;;;;;;OAaG;IACH;QAV6B,QAAQ,EAA1B,OAAO;QACY,MAAM,EAAzB,MAAM,EAAE;QACS,aAAa,EAA9B,MAAM;QACW,IAAI,EAArB,MAAM;QACW,KAAK,EAAtB,MAAM;QACa,YAAY,EAA/B,MAAM,EAAE;4BAER,MAAM,GACJ,QAAQ,gBAAgB,CAAC,CAIrC;CACF"}
@@ -5,6 +5,7 @@ function _asyncToGenerator(fn) { return function () { var self = this, args = ar
5
5
  import dh from '@deephaven/jsapi-shim';
6
6
  import ChartUtils from "./ChartUtils.js";
7
7
  import FigureChartModel from "./FigureChartModel.js";
8
+ import ChartTheme from "./ChartTheme.js";
8
9
 
9
10
  class ChartModelFactory {
10
11
  /**
@@ -18,10 +19,13 @@ class ChartModelFactory {
18
19
  * @param {string} settings.xAxis The column name to use for the x-axis
19
20
  * @param {string[]} settings.hiddenSeries Array of hidden series names
20
21
  * @param {dh.Table} table The table to build the model for
22
+ * @param {Object} theme The theme for the figure. Defaults to ChartTheme
21
23
  * @returns {Promise<FigureChartModel>} The FigureChartModel representing the figure
22
24
  */
23
25
  static makeModelFromSettings(settings, table) {
26
+ var _arguments = arguments;
24
27
  return _asyncToGenerator(function* () {
28
+ var theme = _arguments.length > 2 && _arguments[2] !== undefined ? _arguments[2] : ChartTheme;
25
29
  // Copy the table first and then re-apply the filters from the original table
26
30
  // When we add table linking we'll want to listen to the original table and update
27
31
  // the copied table with any changes that occur.
@@ -30,7 +34,7 @@ class ChartModelFactory {
30
34
  tableCopy.applyCustomColumns(table.customColumns);
31
35
  tableCopy.applyFilter(table.filter);
32
36
  tableCopy.applySort(table.sort);
33
- return dh.plot.Figure.create(ChartUtils.makeFigureSettings(settings, tableCopy)).then(figure => new FigureChartModel(figure, settings));
37
+ return dh.plot.Figure.create(ChartUtils.makeFigureSettings(settings, tableCopy)).then(figure => new FigureChartModel(figure, settings, theme));
34
38
  });
35
39
  })();
36
40
  }
@@ -45,13 +49,16 @@ class ChartModelFactory {
45
49
  * @param {string} settings.xAxis The column name to use for the x-axis
46
50
  * @param {string[]} settings.hiddenSeries Array of hidden series names
47
51
  * @param {dh.Figure} figure The figure to build the model for
52
+ * @param {Object} theme The theme for the figure. Defaults to ChartTheme
48
53
  * @returns {Promise<FigureChartModel>} The FigureChartModel representing the figure
49
54
  */
50
55
 
51
56
 
52
57
  static makeModel(settings, figure) {
58
+ var _arguments2 = arguments;
53
59
  return _asyncToGenerator(function* () {
54
- return new FigureChartModel(figure, settings);
60
+ var theme = _arguments2.length > 2 && _arguments2[2] !== undefined ? _arguments2[2] : ChartTheme;
61
+ return new FigureChartModel(figure, settings, theme);
55
62
  })();
56
63
  }
57
64
 
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/ChartModelFactory.js"],"names":["dh","ChartUtils","FigureChartModel","ChartModelFactory","makeModelFromSettings","settings","table","copy","then","tableCopy","applyCustomColumns","customColumns","applyFilter","filter","applySort","sort","plot","Figure","create","makeFigureSettings","figure","makeModel"],"mappings":";;;;AAAA,OAAOA,EAAP,MAAe,uBAAf;OACOC,U;OACAC,gB;;AAEP,MAAMC,iBAAN,CAAwB;AACtB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACoC,SAArBC,qBAAqB,CAACC,QAAD,EAAWC,KAAX,EAAkB;AAAA;AAClD;AACA;AACA;AACA;AACA,aAAOA,KAAK,CAACC,IAAN,GAAaC,IAAb,CAAkBC,SAAS,IAAI;AACpCA,QAAAA,SAAS,CAACC,kBAAV,CAA6BJ,KAAK,CAACK,aAAnC;AACAF,QAAAA,SAAS,CAACG,WAAV,CAAsBN,KAAK,CAACO,MAA5B;AACAJ,QAAAA,SAAS,CAACK,SAAV,CAAoBR,KAAK,CAACS,IAA1B;AAEA,eAAOf,EAAE,CAACgB,IAAH,CAAQC,MAAR,CAAeC,MAAf,CACLjB,UAAU,CAACkB,kBAAX,CAA8Bd,QAA9B,EAAwCI,SAAxC,CADK,EAELD,IAFK,CAEAY,MAAM,IAAI,IAAIlB,gBAAJ,CAAqBkB,MAArB,EAA6Bf,QAA7B,CAFV,CAAP;AAGD,OARM,CAAP;AALkD;AAcnD;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACwB,SAATgB,SAAS,CAAChB,QAAD,EAAWe,MAAX,EAAmB;AAAA;AACvC,aAAO,IAAIlB,gBAAJ,CAAqBkB,MAArB,EAA6Bf,QAA7B,CAAP;AADuC;AAExC;;AA7CqB;;AAgDxB,eAAeF,iBAAf","sourcesContent":["import dh from '@deephaven/jsapi-shim';\nimport ChartUtils from './ChartUtils';\nimport FigureChartModel from './FigureChartModel';\n\nclass ChartModelFactory {\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param {Object} settings The chart builder settings\n * @param {boolean} settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param {string[]} settings.series The column names to use for creating the series of this chart\n * @param {string} settings.sourcePanelId The panel ID the chart was created from\n * @param {string} settings.type Chart builder type, from ChartBuilder.types\n * @param {string} settings.xAxis The column name to use for the x-axis\n * @param {string[]} settings.hiddenSeries Array of hidden series names\n * @param {dh.Table} table The table to build the model for\n * @returns {Promise<FigureChartModel>} The FigureChartModel representing the figure\n */\n static async makeModelFromSettings(settings, table) {\n // Copy the table first and then re-apply the filters from the original table\n // When we add table linking we'll want to listen to the original table and update\n // the copied table with any changes that occur.\n // The table gets owned by the Figure that gets created, which closes the table\n return table.copy().then(tableCopy => {\n tableCopy.applyCustomColumns(table.customColumns);\n tableCopy.applyFilter(table.filter);\n tableCopy.applySort(table.sort);\n\n return dh.plot.Figure.create(\n ChartUtils.makeFigureSettings(settings, tableCopy)\n ).then(figure => new FigureChartModel(figure, settings));\n });\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param {Object} settings The chart builder settings\n * @param {boolean} settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param {string[]} settings.series The column names to use for creating the series of this chart\n * @param {string} settings.sourcePanelId The panel ID the chart was created from\n * @param {string} settings.type Chart builder type, from ChartBuilder.types\n * @param {string} settings.xAxis The column name to use for the x-axis\n * @param {string[]} settings.hiddenSeries Array of hidden series names\n * @param {dh.Figure} figure The figure to build the model for\n * @returns {Promise<FigureChartModel>} The FigureChartModel representing the figure\n */\n static async makeModel(settings, figure) {\n return new FigureChartModel(figure, settings);\n }\n}\n\nexport default ChartModelFactory;\n"],"file":"ChartModelFactory.js"}
1
+ {"version":3,"sources":["../src/ChartModelFactory.js"],"names":["dh","ChartUtils","FigureChartModel","ChartTheme","ChartModelFactory","makeModelFromSettings","settings","table","theme","copy","then","tableCopy","applyCustomColumns","customColumns","applyFilter","filter","applySort","sort","plot","Figure","create","makeFigureSettings","figure","makeModel"],"mappings":";;;;AAAA,OAAOA,EAAP,MAAe,uBAAf;OACOC,U;OACAC,gB;OACAC,U;;AAEP,MAAMC,iBAAN,CAAwB;AACtB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACoC,SAArBC,qBAAqB,CAACC,QAAD,EAAWC,KAAX,EAAsC;AAAA;AAAA;AAAA,UAApBC,KAAoB,0EAAZL,UAAY;AACtE;AACA;AACA;AACA;AACA,aAAOI,KAAK,CAACE,IAAN,GAAaC,IAAb,CAAkBC,SAAS,IAAI;AACpCA,QAAAA,SAAS,CAACC,kBAAV,CAA6BL,KAAK,CAACM,aAAnC;AACAF,QAAAA,SAAS,CAACG,WAAV,CAAsBP,KAAK,CAACQ,MAA5B;AACAJ,QAAAA,SAAS,CAACK,SAAV,CAAoBT,KAAK,CAACU,IAA1B;AAEA,eAAOjB,EAAE,CAACkB,IAAH,CAAQC,MAAR,CAAeC,MAAf,CACLnB,UAAU,CAACoB,kBAAX,CAA8Bf,QAA9B,EAAwCK,SAAxC,CADK,EAELD,IAFK,CAEAY,MAAM,IAAI,IAAIpB,gBAAJ,CAAqBoB,MAArB,EAA6BhB,QAA7B,EAAuCE,KAAvC,CAFV,CAAP;AAGD,OARM,CAAP;AALsE;AAcvE;AAED;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACwB,SAATe,SAAS,CAACjB,QAAD,EAAWgB,MAAX,EAAuC;AAAA;AAAA;AAAA,UAApBd,KAAoB,6EAAZL,UAAY;AAC3D,aAAO,IAAID,gBAAJ,CAAqBoB,MAArB,EAA6BhB,QAA7B,EAAuCE,KAAvC,CAAP;AAD2D;AAE5D;;AA/CqB;;AAkDxB,eAAeJ,iBAAf","sourcesContent":["import dh from '@deephaven/jsapi-shim';\nimport ChartUtils from './ChartUtils';\nimport FigureChartModel from './FigureChartModel';\nimport ChartTheme from './ChartTheme';\n\nclass ChartModelFactory {\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param {Object} settings The chart builder settings\n * @param {boolean} settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param {string[]} settings.series The column names to use for creating the series of this chart\n * @param {string} settings.sourcePanelId The panel ID the chart was created from\n * @param {string} settings.type Chart builder type, from ChartBuilder.types\n * @param {string} settings.xAxis The column name to use for the x-axis\n * @param {string[]} settings.hiddenSeries Array of hidden series names\n * @param {dh.Table} table The table to build the model for\n * @param {Object} theme The theme for the figure. Defaults to ChartTheme\n * @returns {Promise<FigureChartModel>} The FigureChartModel representing the figure\n */\n static async makeModelFromSettings(settings, table, theme = ChartTheme) {\n // Copy the table first and then re-apply the filters from the original table\n // When we add table linking we'll want to listen to the original table and update\n // the copied table with any changes that occur.\n // The table gets owned by the Figure that gets created, which closes the table\n return table.copy().then(tableCopy => {\n tableCopy.applyCustomColumns(table.customColumns);\n tableCopy.applyFilter(table.filter);\n tableCopy.applySort(table.sort);\n\n return dh.plot.Figure.create(\n ChartUtils.makeFigureSettings(settings, tableCopy)\n ).then(figure => new FigureChartModel(figure, settings, theme));\n });\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param {Object} settings The chart builder settings\n * @param {boolean} settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param {string[]} settings.series The column names to use for creating the series of this chart\n * @param {string} settings.sourcePanelId The panel ID the chart was created from\n * @param {string} settings.type Chart builder type, from ChartBuilder.types\n * @param {string} settings.xAxis The column name to use for the x-axis\n * @param {string[]} settings.hiddenSeries Array of hidden series names\n * @param {dh.Figure} figure The figure to build the model for\n * @param {Object} theme The theme for the figure. Defaults to ChartTheme\n * @returns {Promise<FigureChartModel>} The FigureChartModel representing the figure\n */\n static async makeModel(settings, figure, theme = ChartTheme) {\n return new FigureChartModel(figure, settings, theme);\n }\n}\n\nexport default ChartModelFactory;\n"],"file":"ChartModelFactory.js"}
@@ -38,7 +38,7 @@ declare class ChartUtils {
38
38
  * @param {dh.plot.SeriesPlotStyle} plotStyle The plot style of the series
39
39
  * @param {dh.plot.SourceType} sourceType The source type for the series
40
40
  */
41
- static getPlotlyProperty(plotStyle: any, sourceType: any): "labels" | "values" | "x" | "y" | "z" | "xLow" | "xHigh" | "yLow" | "yHigh" | "time" | "open" | "high" | "low" | "shape" | "size" | "label" | "color";
41
+ static getPlotlyProperty(plotStyle: any, sourceType: any): "labels" | "values" | "x" | "y" | "z" | "xLow" | "xHigh" | "yLow" | "yHigh" | "time" | "open" | "high" | "low" | "close" | "shape" | "size" | "label" | "color";
42
42
  static getPlotlySeriesOrientation(series: any): string;
43
43
  /**
44
44
  * Generate the plotly error bar data from the passed in data.
@@ -106,11 +106,12 @@ declare class ChartUtils {
106
106
  * @param {dh.plot.Series} series The series to create the series data with
107
107
  * @param {Map<dh.plot.AxisType, dh.plot.Axis[]>} axisTypeMap The map of axes grouped by type
108
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
109
110
  * @returns {Object} The series data (trace) object for use with plotly.
110
111
  */
111
- static makeSeriesDataFromSeries(series: any, axisTypeMap: Map<any, any[]>, seriesVisibility: boolean | string): Object;
112
+ static makeSeriesDataFromSeries(series: any, axisTypeMap: Map<any, any[]>, seriesVisibility: boolean | string, theme: Object): Object;
112
113
  static addSourcesToSeriesData(seriesDataParam: any, plotStyle: any, sources: any, axisTypeMap: any): void;
113
- static addStylingToSeriesData(seriesDataParam: any, plotStyle: any, lineColor?: any, shapeColor?: any, seriesVisibility?: any): void;
114
+ static addStylingToSeriesData(seriesDataParam: any, plotStyle: any, theme?: {}, lineColor?: any, shapeColor?: any, seriesVisibility?: any): void;
114
115
  /**
115
116
  * Retrieve the axis formats from the provided figure.
116
117
  * Currently defaults to just the x/y axes.
@@ -153,7 +154,7 @@ declare class ChartUtils {
153
154
  * @param {number} plotHeight The height of the plot to calculate the axis sizes for
154
155
  * @param {func} getRangeParser A function to retrieve the range parser for a given axis
155
156
  */
156
- static updateLayoutAxes(layoutParam: object, axes: any[], plotWidth?: number, plotHeight?: number, getRangeParser?: any): void;
157
+ static updateLayoutAxes(layoutParam: object, axes: any[], plotWidth?: number, plotHeight?: number, getRangeParser?: any, theme?: {}): void;
157
158
  static getAxisLayoutProperty(axisProperty: any, axisIndex: any): string;
158
159
  /**
159
160
  * Updates the layout axis object in place
@@ -239,7 +240,7 @@ declare class ChartUtils {
239
240
  * @param {dh.i18n.TimeZone} timeZone The time zone if applicable
240
241
  */
241
242
  static wrapValue(value: any, columnType: string, timeZone?: any): any;
242
- static makeLayoutAxis(type: any): {
243
+ static makeLayoutAxis(type: any, theme?: {}): {
243
244
  automargin: boolean;
244
245
  gridcolor: any;
245
246
  linecolor: any;
@@ -258,9 +259,16 @@ declare class ChartUtils {
258
259
  };
259
260
  };
260
261
  };
261
- static makeDefaultLayout(): {
262
+ /**
263
+ * Parses the colorway property of a theme and returns an array of colors
264
+ * 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
267
+ */
268
+ static getColorwayFromTheme(theme: any): string[];
269
+ static makeDefaultLayout(theme?: {}): {
262
270
  autosize: boolean;
263
- colorway: any;
271
+ colorway: string[];
264
272
  font: {
265
273
  family: string;
266
274
  };
@@ -273,7 +281,6 @@ declare class ChartUtils {
273
281
  t: number;
274
282
  };
275
283
  y: number;
276
- text: string;
277
284
  };
278
285
  legend: {
279
286
  font: {
@@ -325,21 +332,6 @@ declare class ChartUtils {
325
332
  };
326
333
  };
327
334
  };
328
- paper_bgcolor: any;
329
- plot_bgcolor: any;
330
- title_color: any;
331
- gridcolor: any;
332
- linecolor: any;
333
- zerolinecolor: any;
334
- activecolor: any;
335
- rangebgcolor: any;
336
- area_color: any;
337
- trend_color: any;
338
- line_color: any;
339
- error_band_line_color: any;
340
- error_band_fill_color: any;
341
- ohlc_increasing: any;
342
- ohlc_decreasing: any;
343
335
  };
344
336
  /**
345
337
  * Dehydrate settings so they can be JSONified
@@ -1 +1 @@
1
- {"version":3,"file":"ChartUtils.d.ts","sourceRoot":"","sources":["../src/ChartUtils.js"],"names":[],"mappings":";AAeA;IACE,iCAAgC;IAEhC,6BAA6B;IAE7B,6BAA2B;IAE3B,4BAAyB;IAEzB,+BAA4B;IAE5B,+BAA8B;IAE9B;;;OAGG;IAEH,2BAAkD;IAElD;;;;;;OAA8E;IAE9E;;OAAuD;IAEvD,oCAAiC;IAEjC;;;;OAIG;IACH,6DAFW,OAAO,yEA4BjB;IAED;;;OAGG;IACH,yEASC;IAED;;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AU/B;IAED;;OAEG;IACH,4BAAwB;IAExB;;;OAGG;IACH,oDAgBC;IAED;;;;;OAKG;IACH,wBAJW,GAAG,cACH,MAAM,uBAqChB;IAED;;;;;;;;;;;;;;;;;;MA+BC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA4BC;IAED;;;OAGG;IACH,mCAFW,MAAM;;MAOhB;IAED;;;OAGG;IACH,iCAFW,MAAM;;MAOhB;IAED,6CAQC;IAED;;;;;;;;;;;OAWG;IACH;QAL4B,KAAK,EAAtB,MAAM;QACW,KAAK,EAAtB,MAAM;QACa,MAAM,EAAzB,MAAM,EAAE;QAC0B,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;MA2ChD;CACF"}
1
+ {"version":3,"file":"ChartUtils.d.ts","sourceRoot":"","sources":["../src/ChartUtils.js"],"names":[],"mappings":";AAcA;IACE,iCAAgC;IAEhC,6BAA6B;IAE7B,6BAA2B;IAE3B,4BAAyB;IAEzB,+BAA4B;IAE5B,+BAA8B;IAE9B;;;OAGG;IAEH,2BAAkD;IAElD;;;;;;OAA8E;IAE9E;;OAAuD;IAEvD,oCAAiC;IAEjC;;;;OAIG;IACH,6DAFW,OAAO,yEA4BjB;IAED;;;OAGG;IACH,yEASC;IAED;;;;OAIG;IACH,2NA4DC;IAED,uDAOC;IAED;;;;;;;;OAQG;IACH,6BANW,aAAa,QACb,aAAa,SACb,aAAa,GAEX,MAAM,CAWlB;IAED;;;;MA4CC;IAED,6CAEC;IAED;;;;;aA2CC;IAED;;;;OAIG;IACH,wEA8BC;IAED;;;;;;OAMG;IACH,kCAJW,MAAM,QACN,MAAM,cACN,OAAO,UAqBjB;IAED;;;;;OAKG;IACH,oDAYC;IAED;;;;;OAKG;IACH,iCAJW,MAAM,YACN,MAAM,GACJ,OAAO,GAAC,MAAM,CAO1B;IAED;;;;OAIG;IACH,iCAHW,MAAM,GACJ,MA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;;;;;OAWG;IACH;QAL4B,KAAK,EAAtB,MAAM;QACW,KAAK,EAAtB,MAAM;QACa,MAAM,EAAzB,MAAM,EAAE;QAC0B,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;MA2ChD;CACF"}
@@ -1,13 +1,12 @@
1
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
1
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
2
2
 
3
3
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
4
4
 
5
5
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
 
7
7
  import Log from '@deephaven/log';
8
- import { TableUtils } from '@deephaven/iris-grid';
8
+ import TableUtils from '@deephaven/iris-grid/dist/TableUtils.js';
9
9
  import dh from '@deephaven/jsapi-shim';
10
- import ChartTheme from "./ChartTheme.js";
11
10
  var log = Log.module('ChartUtils');
12
11
  var DAYS = Object.freeze(dh.calendar.DayOfWeek.values());
13
12
  var BUSINESS_COLUMN_TYPE = 'io.deephaven.db.tables.utils.DBDateTime';
@@ -140,6 +139,9 @@ class ChartUtils {
140
139
  return 'low';
141
140
 
142
141
  case dh.plot.SourceType.CLOSE:
142
+ return 'close';
143
+
144
+ case dh.plot.SourceType.SHAPE:
143
145
  return 'shape';
144
146
 
145
147
  case dh.plot.SourceType.SIZE:
@@ -391,11 +393,12 @@ class ChartUtils {
391
393
  * @param {dh.plot.Series} series The series to create the series data with
392
394
  * @param {Map<dh.plot.AxisType, dh.plot.Axis[]>} axisTypeMap The map of axes grouped by type
393
395
  * @param {boolean|string} seriesVisibility Visibility setting for the series
396
+ * @param {Object} theme The theme properties for the plot. See ChartTheme.js for an example
394
397
  * @returns {Object} The series data (trace) object for use with plotly.
395
398
  */
396
399
 
397
400
 
398
- static makeSeriesDataFromSeries(series, axisTypeMap, seriesVisibility) {
401
+ static makeSeriesDataFromSeries(series, axisTypeMap, seriesVisibility, theme) {
399
402
  var {
400
403
  name,
401
404
  plotStyle,
@@ -409,7 +412,7 @@ class ChartUtils {
409
412
  var orientation = ChartUtils.getPlotlySeriesOrientation(series);
410
413
  var seriesData = ChartUtils.makeSeriesData(type, mode, name, orientation);
411
414
  ChartUtils.addSourcesToSeriesData(seriesData, plotStyle, sources, axisTypeMap);
412
- ChartUtils.addStylingToSeriesData(seriesData, plotStyle, lineColor, shapeColor, seriesVisibility);
415
+ ChartUtils.addStylingToSeriesData(seriesData, plotStyle, theme, lineColor, shapeColor, seriesVisibility);
413
416
  return seriesData;
414
417
  }
415
418
 
@@ -436,9 +439,10 @@ class ChartUtils {
436
439
  }
437
440
 
438
441
  static addStylingToSeriesData(seriesDataParam, plotStyle) {
439
- var lineColor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
440
- var shapeColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
441
- var seriesVisibility = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
442
+ var theme = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
443
+ var lineColor = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : null;
444
+ var shapeColor = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
445
+ var seriesVisibility = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
442
446
  var seriesData = seriesDataParam; // Add some empty objects so we can fill them in later with details without checking for existence
443
447
 
444
448
  seriesData.marker = {
@@ -461,24 +465,24 @@ class ChartUtils {
461
465
  // Since it's converted to bar, just set the widths of each bar
462
466
  seriesData.width = [];
463
467
  Object.assign(seriesData.marker.line, {
464
- color: ChartTheme.paper_bgcolor,
468
+ color: theme.paper_bgcolor,
465
469
  width: 1
466
470
  });
467
471
  } else if (plotStyle === dh.plot.SeriesPlotStyle.OHLC) {
468
472
  seriesData.increasing = {
469
473
  line: {
470
- color: ChartTheme.ohlc_increasing
474
+ color: theme.ohlc_increasing
471
475
  }
472
476
  };
473
477
  seriesData.decreasing = {
474
478
  line: {
475
- color: ChartTheme.ohlc_decreasing
479
+ color: theme.ohlc_decreasing
476
480
  }
477
481
  };
478
482
  } else if (plotStyle === dh.plot.SeriesPlotStyle.PIE) {
479
483
  seriesData.textinfo = 'label+percent';
480
484
  seriesData.outsidetextfont = {
481
- color: ChartTheme.title_color
485
+ color: theme.title_color
482
486
  };
483
487
  }
484
488
 
@@ -720,6 +724,7 @@ class ChartUtils {
720
724
  var plotWidth = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;
721
725
  var plotHeight = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
722
726
  var getRangeParser = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : null;
727
+ var theme = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : {};
723
728
  var xAxisSize = plotWidth > 0 ? Math.max(ChartUtils.MIN_AXIS_SIZE, Math.min(ChartUtils.AXIS_SIZE_PX / plotHeight, ChartUtils.MAX_AXIS_SIZE)) : ChartUtils.DEFAULT_AXIS_SIZE;
724
729
  var yAxisSize = plotHeight > 0 ? Math.max(ChartUtils.MIN_AXIS_SIZE, Math.min(ChartUtils.AXIS_SIZE_PX / plotWidth, ChartUtils.MAX_AXIS_SIZE)) : ChartUtils.DEFAULT_AXIS_SIZE; // Adjust the bounds based on where the legend is
725
730
  // For now, always assume the legend is shown on the right
@@ -761,7 +766,7 @@ class ChartUtils {
761
766
  var _axisLayoutProperty = ChartUtils.getAxisLayoutProperty(axisProperty, axisIndex);
762
767
 
763
768
  if (layout[_axisLayoutProperty] == null) {
764
- layout[_axisLayoutProperty] = ChartUtils.makeLayoutAxis(axisType);
769
+ layout[_axisLayoutProperty] = ChartUtils.makeLayoutAxis(axisType, theme);
765
770
  }
766
771
 
767
772
  var layoutAxis = layout[_axisLayoutProperty];
@@ -1076,24 +1081,25 @@ class ChartUtils {
1076
1081
  }
1077
1082
 
1078
1083
  static makeLayoutAxis(type) {
1084
+ var theme = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
1079
1085
  var axis = {
1080
1086
  automargin: true,
1081
- gridcolor: ChartTheme.gridcolor,
1082
- linecolor: ChartTheme.linecolor,
1087
+ gridcolor: theme.gridcolor,
1088
+ linecolor: theme.linecolor,
1083
1089
  rangeslider: {
1084
1090
  visible: false
1085
1091
  },
1086
1092
  showline: true,
1087
1093
  ticklen: 5,
1088
1094
  // act as padding, can't find a tick padding
1089
- tickcolor: ChartTheme.paper_bgcolor,
1095
+ tickcolor: theme.paper_bgcolor,
1090
1096
  // hide ticks as padding
1091
1097
  tickfont: {
1092
- color: ChartTheme.zerolinecolor
1098
+ color: theme.zerolinecolor
1093
1099
  },
1094
1100
  title: {
1095
1101
  font: {
1096
- color: ChartTheme.title_color
1102
+ color: theme.title_color
1097
1103
  }
1098
1104
  }
1099
1105
  };
@@ -1104,38 +1110,62 @@ class ChartUtils {
1104
1110
  });
1105
1111
  } else if (type === dh.plot.AxisType.Y) {
1106
1112
  Object.assign(axis, {
1107
- zerolinecolor: ChartTheme.zerolinecolor,
1113
+ zerolinecolor: theme.zerolinecolor,
1108
1114
  zerolinewidth: 2
1109
1115
  });
1110
1116
  }
1111
1117
 
1112
1118
  return axis;
1113
1119
  }
1120
+ /**
1121
+ * Parses the colorway property of a theme and returns an array of colors
1122
+ * Theme could have a single string with space separated colors or an array of strings representing the colorway
1123
+ * @param {ChartTheme} theme The theme to get colorway from
1124
+ * @returns {string[]} Colorway array for the theme
1125
+ */
1126
+
1127
+
1128
+ static getColorwayFromTheme(theme) {
1129
+ var colorway = [];
1130
+
1131
+ if (theme.colorway) {
1132
+ if (Array.isArray(theme.colorway)) {
1133
+ colorway = theme.colorway;
1134
+ } else if (typeof theme.colorway === 'string') {
1135
+ colorway = theme.colorway.split(' ');
1136
+ } else {
1137
+ log.warn("Unable to handle colorway property: ".concat(theme.colorway));
1138
+ }
1139
+ }
1140
+
1141
+ return colorway;
1142
+ }
1114
1143
 
1115
1144
  static makeDefaultLayout() {
1116
- var layout = _objectSpread(_objectSpread({}, ChartTheme), {}, {
1145
+ var theme = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1146
+
1147
+ var layout = _objectSpread(_objectSpread({}, theme), {}, {
1117
1148
  autosize: true,
1118
- colorway: ChartTheme.colorway ? ChartTheme.colorway.split(' ') : [],
1149
+ colorway: ChartUtils.getColorwayFromTheme(theme),
1119
1150
  font: {
1120
1151
  family: "'Fira Sans', sans-serif"
1121
1152
  },
1122
1153
  title: {
1123
1154
  font: {
1124
- color: ChartTheme.title_color
1155
+ color: theme.title_color
1125
1156
  },
1126
1157
  yanchor: 'top',
1127
1158
  pad: _objectSpread({}, ChartUtils.DEFAULT_TITLE_PADDING),
1128
- y: 1,
1129
- text: 'Untitled'
1159
+ y: 1
1130
1160
  },
1131
1161
  legend: {
1132
1162
  font: {
1133
- color: ChartTheme.title_color
1163
+ color: theme.title_color
1134
1164
  }
1135
1165
  },
1136
1166
  margin: _objectSpread({}, ChartUtils.DEFAULT_MARGIN),
1137
- xaxis: ChartUtils.makeLayoutAxis(dh.plot.AxisType.X),
1138
- yaxis: ChartUtils.makeLayoutAxis(dh.plot.AxisType.Y)
1167
+ xaxis: ChartUtils.makeLayoutAxis(dh.plot.AxisType.X, theme),
1168
+ yaxis: ChartUtils.makeLayoutAxis(dh.plot.AxisType.Y, theme)
1139
1169
  });
1140
1170
 
1141
1171
  layout.datarevision = 0;