1- import dh , { Figure , Table } from '@deephaven/jsapi-shim ' ;
1+ import type { dh as DhType , Figure , Table } from '@deephaven/jsapi-types ' ;
22import ChartUtils , { ChartModelSettings } from './ChartUtils' ;
33import FigureChartModel from './FigureChartModel' ;
44import ChartTheme from './ChartTheme' ;
@@ -8,6 +8,7 @@ class ChartModelFactory {
88 /**
99 * Creates a model from the settings provided.
1010 * Tries to create a Figure in the API with it.
11+ * @param dh JSAPI instance
1112 * @param settings The chart builder settings
1213 * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
1314 * @param settings.series The column names to use for creating the series of this chart
@@ -21,20 +22,23 @@ class ChartModelFactory {
2122 * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
2223 */
2324 static async makeModelFromSettings (
25+ dh : DhType ,
2426 settings : ChartModelSettings ,
2527 table : Table ,
2628 theme = ChartTheme
2729 ) : Promise < ChartModel > {
2830 const figure = await ChartModelFactory . makeFigureFromSettings (
31+ dh ,
2932 settings ,
3033 table
3134 ) ;
32- return new FigureChartModel ( figure , settings , theme ) ;
35+ return new FigureChartModel ( dh , figure , settings , theme ) ;
3336 }
3437
3538 /**
3639 * Creates a model from the settings provided.
3740 * Tries to create a Figure in the API with it.
41+ * @param dh DH JSAPI instance
3842 * @param settings The chart builder settings
3943 * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
4044 * @param settings.series The column names to use for creating the series of this chart
@@ -45,11 +49,12 @@ class ChartModelFactory {
4549 * @returns The Figure created with the settings provided
4650 */
4751 static async makeFigureFromSettings (
52+ dh : DhType ,
4853 settings : ChartModelSettings ,
4954 table : Table
5055 ) : Promise < Figure > {
5156 // Copy the table first and then re-apply the filters from the original table
52- // When we add toable linking we'll want to listen to the original table and update
57+ // When we add table linking we'll want to listen to the original table and update
5358 // the copied table with any changes that occur.
5459 // The table gets owned by the Figure that gets created, which closes the table
5560 const tableCopy = await table . copy ( ) ;
@@ -58,13 +63,14 @@ class ChartModelFactory {
5863 tableCopy . applySort ( table . sort ) ;
5964
6065 return dh . plot . Figure . create (
61- ChartUtils . makeFigureSettings ( settings , tableCopy )
66+ new ChartUtils ( dh ) . makeFigureSettings ( settings , tableCopy )
6267 ) ;
6368 }
6469
6570 /**
6671 * Creates a model from the settings provided.
6772 * Tries to create a Figure in the API with it.
73+ * @param dh DH JSAPI instance
6874 * @param settings The chart builder settings
6975 * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
7076 * @param settings.series The column names to use for creating the series of this chart
@@ -78,11 +84,12 @@ class ChartModelFactory {
7884 * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
7985 */
8086 static async makeModel (
87+ dh : DhType ,
8188 settings : ChartModelSettings | undefined ,
8289 figure : Figure ,
8390 theme = ChartTheme
8491 ) : Promise < ChartModel > {
85- return new FigureChartModel ( figure , settings , theme ) ;
92+ return new FigureChartModel ( dh , figure , settings , theme ) ;
8693 }
8794}
8895
0 commit comments