@deephaven/chart 0.38.0 → 0.38.1-beta.11
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/README.md +1 -1
- package/dist/Chart.d.ts +2 -0
- package/dist/Chart.d.ts.map +1 -1
- package/dist/Chart.js +4 -1
- package/dist/Chart.js.map +1 -1
- package/dist/ChartModelFactory.d.ts +7 -4
- package/dist/ChartModelFactory.d.ts.map +1 -1
- package/dist/ChartModelFactory.js +13 -11
- package/dist/ChartModelFactory.js.map +1 -1
- package/dist/ChartTestUtils.d.ts +17 -15
- package/dist/ChartTestUtils.d.ts.map +1 -1
- package/dist/ChartTestUtils.js +40 -28
- package/dist/ChartTestUtils.js.map +1 -1
- package/dist/ChartUtils.d.ts +157 -154
- package/dist/ChartUtils.d.ts.map +1 -1
- package/dist/ChartUtils.js +669 -607
- package/dist/ChartUtils.js.map +1 -1
- package/dist/FigureChartModel.d.ts +7 -4
- package/dist/FigureChartModel.d.ts.map +1 -1
- package/dist/FigureChartModel.js +28 -12
- package/dist/FigureChartModel.js.map +1 -1
- package/dist/MockChartModel.d.ts +3 -3
- package/dist/MockChartModel.d.ts.map +1 -1
- package/dist/MockChartModel.js +6 -6
- package/dist/MockChartModel.js.map +1 -1
- package/package.json +10 -9
package/README.md
CHANGED
package/dist/Chart.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Component, ReactElement, RefObject } from 'react';
|
|
2
2
|
import { IconDefinition } from '@deephaven/icons';
|
|
3
|
+
import type { dh as DhType } from '@deephaven/jsapi-types';
|
|
3
4
|
import { DateTimeColumnFormatterOptions, DecimalColumnFormatterOptions, IntegerColumnFormatterOptions, FormattingRule, ColumnFormatSettings, DateTimeFormatSettings } from '@deephaven/jsapi-utils';
|
|
4
5
|
import { Layout, Icon, PlotData } from 'plotly.js';
|
|
5
6
|
import Plot from './plotly/Plot';
|
|
@@ -11,6 +12,7 @@ type FormatterSettings = ColumnFormatSettings & DateTimeFormatSettings & {
|
|
|
11
12
|
integerFormatOptions?: IntegerColumnFormatterOptions;
|
|
12
13
|
};
|
|
13
14
|
interface ChartProps {
|
|
15
|
+
dh: DhType;
|
|
14
16
|
model: ChartModel;
|
|
15
17
|
settings: FormatterSettings;
|
|
16
18
|
isActive: boolean;
|
package/dist/Chart.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.d.ts","sourceRoot":"","sources":["../src/Chart.tsx"],"names":[],"mappings":"AAAA,OAAc,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,EAIL,cAAc,EACf,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIL,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,cAAc,EACd,oBAAoB,EACpB,sBAAsB,EACvB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEnD,OAAO,IAAI,MAAM,eAAe,CAAC;AACjC,OAAO,UAAU,MAAM,cAAc,CAAC;AACtC,OAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9D,OAAO,cAAc,CAAC;AAItB,KAAK,iBAAiB,GAAG,oBAAoB,GAC3C,sBAAsB,GAAG;IACvB,oBAAoB,CAAC,EAAE,6BAA6B,CAAC;IACrD,oBAAoB,CAAC,EAAE,6BAA6B,CAAC;CACtD,CAAC;AAEJ,UAAU,UAAU;IAClB,KAAK,EAAE,UAAU,CAAC;IAClB,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,QAAQ,EAAE,CAAC,GAAG,EAAE;QAAE,SAAS,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IAChD,O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IAAI;IAYhB,SAAS,IAAI,IAAI;IAcjB,WAAW,IAAI,IAAI;IAUnB,eAAe,IAAI,IAAI;IAMvB,qBAAqB,IAAI,IAAI;IAgB7B,gBAAgB,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI;IA0E1C,gBAAgB,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI;IAgBlD,cAAc,CAAC,OAAO,EAAE;QAAE,YAAY,CAAC,EAAE,MAAM,EAAE,CAAA;KAAE,GAAG,IAAI;IAa1D,aAAa,CAAC,CAAC,OAAO,EAAE,aAAa,CAAC,EAAE;QACtC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;QACvB,MAAM,EAAE;KACT,GAAG,IAAI;IAgBR;;;;;;;OAOG;IACH,qBAAqB,CAAC,KAAK,UAAQ,GAAG,IAAI;IAwB1C,aAAa,IAAI,IAAI;IAKrB,uBAAuB,CAAC,QAAQ,EAAE,iBAAiB,GAAG,IAAI;IAqB1D,eAAe,IAAI,IAAI;IAcvB,gBAAgB,IAAI,IAAI;IAkBxB,MAAM,IAAI,YAAY;CAsCvB;AAED,eAAe,KAAK,CAAC"}
|
package/dist/Chart.js
CHANGED
|
@@ -417,7 +417,10 @@ export class Chart extends Component {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
updateFormatter() {
|
|
420
|
-
var
|
|
420
|
+
var {
|
|
421
|
+
dh
|
|
422
|
+
} = this.props;
|
|
423
|
+
var formatter = new Formatter(dh, this.columnFormats, this.dateTimeFormatterOptions, this.decimalFormatOptions, this.integerFormatOptions);
|
|
421
424
|
var {
|
|
422
425
|
model
|
|
423
426
|
} = this.props;
|
package/dist/Chart.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Chart.js","names":["React","Component","deepEqual","memoize","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","Plotly","Plot","ChartModel","ChartUtils","log","module","Chart","convertIcon","faIcon","width","path","icon","stringPath","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","downsampleButtonAttr","undefined","constructor","props","downsamplingError","isDownsampleFinished","customButtons","hasDownsampleError","Boolean","push","name","click","attr","handleDownsampleClick","displaylogo","displayModeBar","modeBarButtons","handleAfterPlot","bind","handleModelEvent","handlePlotUpdate","handleRelayout","handleRestyle","plot","createRef","plotWrapper","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","isSubscribed","isLoadedFired","currentSeries","state","data","layout","datarevision","revision","componentDidMount","updateDimensions","updateModelDimensions","initData","initFormatter","isActive","subscribe","componentDidUpdate","prevProps","settings","updateFormatterSettings","unsubscribe","componentWillUnmount","getPlotRect","current","getBoundingClientRect","model","setState","getData","getLayout","rect","height","debug2","setDownsamplingDisabled","event","type","detail","EVENT_UPDATED","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","message","onError","Error","debug","figure","ranges","getLayoutRanges","isRangesChanged","changes","hiddenlabels","onSettingsChanged","hiddenSeries","seriesIndexes","Object","keys","includes","reduce","acc","visible","force","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","formatter","setFormatter","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","error","timeZone","defaultDateTimeFormat","FULL_DATE_FORMAT","showTimeZone","showTSeparator"],"sources":["../src/Chart.tsx"],"sourcesContent":["import React, { Component, ReactElement, RefObject } from 'react';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport {\n vsLoading,\n dhGraphLineDown,\n dhWarningFilled,\n IconDefinition,\n} from '@deephaven/icons';\nimport {\n Formatter,\n FormatterUtils,\n DateUtils,\n DateTimeColumnFormatterOptions,\n DecimalColumnFormatterOptions,\n IntegerColumnFormatterOptions,\n FormattingRule,\n ColumnFormatSettings,\n DateTimeFormatSettings,\n} from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport { Layout, Icon, PlotData } from 'plotly.js';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\nimport ChartModel from './ChartModel';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\ntype FormatterSettings = ColumnFormatSettings &\n DateTimeFormatSettings & {\n decimalFormatOptions?: DecimalColumnFormatterOptions;\n integerFormatOptions?: IntegerColumnFormatterOptions;\n };\n\ninterface ChartProps {\n model: ChartModel;\n settings: FormatterSettings;\n isActive: boolean;\n onDisconnect: () => void;\n onReconnect: () => void;\n onUpdate: (obj: { isLoading: boolean }) => void;\n onError: (error: Error) => void;\n onSettingsChanged: (settings: Partial<ChartModelSettings>) => void;\n}\n\ninterface ChartState {\n data: Partial<PlotData>[] | null;\n downsamplingError: unknown;\n isDownsampleFinished: boolean;\n isDownsampleInProgress: boolean;\n isDownsamplingDisabled: boolean;\n layout: Partial<Layout>;\n revision: number;\n}\n\nexport class Chart extends Component<ChartProps, ChartState> {\n static defaultProps = {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: [],\n },\n onDisconnect: (): void => undefined,\n onReconnect: (): void => undefined,\n onUpdate: (): void => undefined,\n onError: (): void => undefined,\n onSettingsChanged: (): void => undefined,\n };\n\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param faIcon The icon to convert\n */\n static convertIcon(faIcon: IconDefinition): Icon {\n const [width, , , , path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n const stringPath = `${path}`;\n return {\n width,\n path: stringPath,\n ascent: width,\n descent: 0,\n transform: `matrix(1, 0, 0, 1, 0, 0)`,\n };\n }\n\n static downsampleButtonTitle(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string {\n if (isDownsampleInProgress) {\n return 'Downsampling in progress...';\n }\n\n return isDownsamplingDisabled\n ? 'Downsampling disabled, click to enable'\n : 'Downsampling enabled, click to disable';\n }\n\n static downsampleButtonAttr(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string | undefined {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n\n constructor(props: ChartProps) {\n super(props);\n\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n\n this.plot = React.createRef();\n this.plotWrapper = React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.isSubscribed = false;\n this.isLoadedFired = false;\n this.currentSeries = 0;\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0,\n },\n revision: 0,\n };\n }\n\n componentDidMount(): void {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n\n this.initData();\n this.initFormatter();\n\n const { isActive } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n\n componentDidUpdate(prevProps: ChartProps): void {\n const { isActive, settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n\n componentWillUnmount(): void {\n this.unsubscribe();\n }\n\n currentSeries: number;\n\n plot: RefObject<typeof Plot>;\n\n plotWrapper: RefObject<HTMLDivElement>;\n\n columnFormats?: FormattingRule[];\n\n dateTimeFormatterOptions?: DateTimeColumnFormatterOptions;\n\n decimalFormatOptions: DecimalColumnFormatterOptions;\n\n integerFormatOptions: IntegerColumnFormatterOptions;\n\n rect?: DOMRect;\n\n ranges?: unknown;\n\n isSubscribed: boolean;\n\n isLoadedFired: boolean;\n\n getCachedConfig = memoize(\n (\n downsamplingError: unknown,\n isDownsampleFinished: boolean,\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ) => {\n const customButtons = [];\n const hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n click: () => undefined,\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n\n if (\n isDownsampleFinished ||\n isDownsampleInProgress ||\n isDownsamplingDisabled ||\n hasDownsampleError\n ) {\n const name = Chart.downsampleButtonTitle(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const attr = Chart.downsampleButtonAttr(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n\n const icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr,\n });\n }\n\n return {\n displaylogo: false,\n\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n isDownsampleInProgress || hasDownsampleError ? true : 'hover',\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n ['zoom2d', 'pan2d'],\n ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'],\n ],\n };\n }\n );\n\n getPlotRect(): DOMRect | null {\n return this.plotWrapper.current?.getBoundingClientRect() ?? null;\n }\n\n initData(): void {\n const { model } = this.props;\n const { layout } = this.state;\n this.setState({\n data: model.getData(),\n layout: {\n ...layout,\n ...model.getLayout(),\n },\n });\n }\n\n subscribe(): void {\n if (this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n\n unsubscribe(): void {\n if (!this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n\n handleAfterPlot(): void {\n if (this.plot.current != null) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n\n handleDownsampleClick(): void {\n this.setState(\n ({ isDownsamplingDisabled }) => ({\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled,\n }),\n () => {\n const { model } = this.props;\n const { isDownsamplingDisabled } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n }\n );\n }\n\n handleModelEvent(event: CustomEvent): void {\n const { type, detail } = event;\n log.debug2('Received data update', type, detail);\n\n switch (type) {\n case ChartModel.EVENT_UPDATED: {\n this.currentSeries += 1;\n this.setState(state => {\n const { layout, revision } = state;\n if (typeof layout.datarevision === 'number') {\n layout.datarevision += 1;\n }\n return {\n data: detail,\n layout,\n revision: revision + 1,\n };\n });\n\n const { onUpdate } = this.props;\n onUpdate({ isLoading: !this.isLoadedFired });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED: {\n const { onUpdate } = this.props;\n this.isLoadedFired = true;\n onUpdate({ isLoading: false });\n break;\n }\n case ChartModel.EVENT_DISCONNECT: {\n const { onDisconnect } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT: {\n const { onReconnect } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED: {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED: {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED: {\n const downsamplingError = detail.message ?? detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError,\n });\n\n const { onError } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure: { layout: Layout }): void {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n const { layout } = figure;\n const ranges = ChartUtils.getLayoutRanges(layout);\n\n const isRangesChanged = !deepEqual(ranges, this.ranges);\n\n if (isRangesChanged) {\n this.ranges = ranges;\n\n this.updateModelDimensions(true);\n }\n }\n\n handleRelayout(changes: { hiddenlabels?: string[] }): void {\n log.debug('handleRelayout', changes);\n if (changes.hiddenlabels != null) {\n const { onSettingsChanged } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n const hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({ hiddenSeries });\n }\n\n this.updateModelDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]: [\n Record<string, unknown>,\n number[]\n ]): void {\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n const { data } = this.state;\n const { onSettingsChanged } = this.props;\n if (data != null) {\n const hiddenSeries = data.reduce(\n (acc: string[], { name, visible }) =>\n name != null && visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\n }\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions(force = false): void {\n const rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n\n const isRectChanged =\n !this.rect ||\n this.rect.width !== rect.width ||\n this.rect.height !== rect.height;\n\n if (isRectChanged || force) {\n this.rect = rect;\n\n const { isActive, model } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n\n initFormatter(): void {\n const { settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n }\n\n updateFormatterSettings(settings: FormatterSettings): void {\n const columnFormats = FormatterUtils.getColumnFormats(settings);\n const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(\n settings\n );\n const { decimalFormatOptions = {}, integerFormatOptions = {} } = settings;\n\n if (\n !deepEqual(this.columnFormats, columnFormats) ||\n !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) ||\n !deepEqual(this.decimalFormatOptions, decimalFormatOptions) ||\n !deepEqual(this.integerFormatOptions, integerFormatOptions)\n ) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n\n updateFormatter(): void {\n const formatter = new Formatter(\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n\n const { model } = this.props;\n model.setFormatter(formatter);\n }\n\n updateDimensions(): void {\n const rect = this.getPlotRect();\n if (\n this.plot.current != null &&\n rect != null &&\n rect.width > 0 &&\n rect.height > 0\n ) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n Plotly.relayout(this.plot.current.el, { autosize: true }).catch(\n (e: unknown) => {\n log.debug('Unable to resize, promise rejected', e);\n }\n );\n }\n }\n\n render(): ReactElement {\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const isPlotShown = data != null;\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <Plot\n ref={this.plot}\n data={data}\n layout={layout}\n revision={revision}\n config={config}\n onAfterPlot={this.handleAfterPlot}\n onError={log.error}\n onRelayout={this.handleRelayout}\n onUpdate={this.handlePlotUpdate}\n onRestyle={this.handleRestyle}\n useResizeHandler\n style={{ height: '100%', width: '100%' }}\n />\n )}\n </div>\n );\n }\n}\n\nexport default Chart;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAiC,OAAO;AACjE,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,aAAa;AACjC,SACEC,SAAS,EACTC,eAAe,EACfC,eAAe,QAEV,kBAAkB;AACzB,SACEC,SAAS,EACTC,cAAc,EACdC,SAAS,QAOJ,wBAAwB;AAC/B,OAAOC,GAAG,MAAM,gBAAgB;AAAC,OAE1BC,MAAM;AAAA,OACNC,IAAI;AAAA,OACJC,UAAU;AAAA,OACVC,UAAU;AAAA;AAGjB,IAAMC,GAAG,GAAGL,GAAG,CAACM,MAAM,CAAC,OAAO,CAAC;AA6B/B,OAAO,MAAMC,KAAK,SAAShB,SAAS,CAAyB;EAiB3D;AACF;AACA;AACA;EACE,OAAOiB,WAAW,CAACC,MAAsB,EAAQ;IAC/C,IAAM,CAACC,KAAK,KAAQC,IAAI,CAAC,GAAGF,MAAM,CAACG,IAAI;IACvC;IACA;IACA,IAAMC,U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BC,cAAc,EAAE,IAAI;IACpBhB,SAAS,EAAE;EACb,CAAC;EACDjC,YAAY,EAAE,MAAYrE,SAAS;EACnCuE,WAAW,EAAE,MAAYvE,SAAS;EAClCiE,QAAQ,EAAE,MAAYjE,SAAS;EAC/B6E,OAAO,EAAE,MAAY7E,SAAS;EAC9BsF,iBAAiB,EAAE,MAAYtF;AACjC,CAAC;AAwfH,eAAed,KAAK"}
|
|
1
|
+
{"version":3,"file":"Chart.js","names":["React","Component","deepEqual","memoize","vsLoading","dhGraphLineDown","dhWarningFilled","Formatter","FormatterUtils","DateUtils","Log","Plotly","Plot","ChartModel","ChartUtils","log","module","Chart","convertIcon","faIcon","width","path","icon","stringPath","ascent","descent","transform","downsampleButtonTitle","isDownsampleInProgress","isDownsamplingDisabled","downsampleButtonAttr","undefined","constructor","props","downsamplingError","isDownsampleFinished","customButtons","hasDownsampleError","Boolean","push","name","click","attr","handleDownsampleClick","displaylogo","displayModeBar","modeBarButtons","handleAfterPlot","bind","handleModelEvent","handlePlotUpdate","handleRelayout","handleRestyle","plot","createRef","plotWrapper","columnFormats","dateTimeFormatterOptions","decimalFormatOptions","integerFormatOptions","isSubscribed","isLoadedFired","currentSeries","state","data","layout","datarevision","revision","componentDidMount","updateDimensions","updateModelDimensions","initData","initFormatter","isActive","subscribe","componentDidUpdate","prevProps","settings","updateFormatterSettings","unsubscribe","componentWillUnmount","getPlotRect","current","getBoundingClientRect","model","setState","getData","getLayout","rect","height","debug2","setDownsamplingDisabled","event","type","detail","EVENT_UPDATED","onUpdate","isLoading","EVENT_LOADFINISHED","EVENT_DISCONNECT","onDisconnect","EVENT_RECONNECT","onReconnect","EVENT_DOWNSAMPLESTARTED","EVENT_DOWNSAMPLEFINISHED","EVENT_DOWNSAMPLENEEDED","EVENT_DOWNSAMPLEFAILED","message","onError","Error","debug","figure","ranges","getLayoutRanges","isRangesChanged","changes","hiddenlabels","onSettingsChanged","hiddenSeries","seriesIndexes","Object","keys","includes","reduce","acc","visible","force","warn","isRectChanged","setDimensions","getColumnFormats","getDateTimeFormatterOptions","updateFormatter","dh","formatter","setFormatter","relayout","el","autosize","catch","e","render","config","getCachedConfig","isPlotShown","error","timeZone","defaultDateTimeFormat","FULL_DATE_FORMAT","showTimeZone","showTSeparator"],"sources":["../src/Chart.tsx"],"sourcesContent":["import React, { Component, ReactElement, RefObject } from 'react';\nimport deepEqual from 'deep-equal';\nimport memoize from 'memoize-one';\nimport {\n vsLoading,\n dhGraphLineDown,\n dhWarningFilled,\n IconDefinition,\n} from '@deephaven/icons';\nimport type { dh as DhType } from '@deephaven/jsapi-types';\nimport {\n Formatter,\n FormatterUtils,\n DateUtils,\n DateTimeColumnFormatterOptions,\n DecimalColumnFormatterOptions,\n IntegerColumnFormatterOptions,\n FormattingRule,\n ColumnFormatSettings,\n DateTimeFormatSettings,\n} from '@deephaven/jsapi-utils';\nimport Log from '@deephaven/log';\nimport { Layout, Icon, PlotData } from 'plotly.js';\nimport Plotly from './plotly/Plotly';\nimport Plot from './plotly/Plot';\nimport ChartModel from './ChartModel';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport './Chart.scss';\n\nconst log = Log.module('Chart');\n\ntype FormatterSettings = ColumnFormatSettings &\n DateTimeFormatSettings & {\n decimalFormatOptions?: DecimalColumnFormatterOptions;\n integerFormatOptions?: IntegerColumnFormatterOptions;\n };\n\ninterface ChartProps {\n dh: DhType;\n model: ChartModel;\n settings: FormatterSettings;\n isActive: boolean;\n onDisconnect: () => void;\n onReconnect: () => void;\n onUpdate: (obj: { isLoading: boolean }) => void;\n onError: (error: Error) => void;\n onSettingsChanged: (settings: Partial<ChartModelSettings>) => void;\n}\n\ninterface ChartState {\n data: Partial<PlotData>[] | null;\n downsamplingError: unknown;\n isDownsampleFinished: boolean;\n isDownsampleInProgress: boolean;\n isDownsamplingDisabled: boolean;\n layout: Partial<Layout>;\n revision: number;\n}\n\nexport class Chart extends Component<ChartProps, ChartState> {\n static defaultProps = {\n isActive: true,\n settings: {\n timeZone: 'America/New_York',\n defaultDateTimeFormat: DateUtils.FULL_DATE_FORMAT,\n showTimeZone: false,\n showTSeparator: true,\n formatter: [],\n },\n onDisconnect: (): void => undefined,\n onReconnect: (): void => undefined,\n onUpdate: (): void => undefined,\n onError: (): void => undefined,\n onSettingsChanged: (): void => undefined,\n };\n\n /**\n * Convert a font awesome icon definition to a plotly icon definition\n * @param faIcon The icon to convert\n */\n static convertIcon(faIcon: IconDefinition): Icon {\n const [width, , , , path] = faIcon.icon;\n // By default the icons are flipped upside down, so we need to add our own transform\n // https://github.com/plotly/plotly.js/issues/1335\n const stringPath = `${path}`;\n return {\n width,\n path: stringPath,\n ascent: width,\n descent: 0,\n transform: `matrix(1, 0, 0, 1, 0, 0)`,\n };\n }\n\n static downsampleButtonTitle(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string {\n if (isDownsampleInProgress) {\n return 'Downsampling in progress...';\n }\n\n return isDownsamplingDisabled\n ? 'Downsampling disabled, click to enable'\n : 'Downsampling enabled, click to disable';\n }\n\n static downsampleButtonAttr(\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ): string | undefined {\n if (isDownsampleInProgress) {\n return 'animation-spin';\n }\n\n return isDownsamplingDisabled ? undefined : 'fill-active';\n }\n\n constructor(props: ChartProps) {\n super(props);\n\n this.handleAfterPlot = this.handleAfterPlot.bind(this);\n this.handleDownsampleClick = this.handleDownsampleClick.bind(this);\n this.handleModelEvent = this.handleModelEvent.bind(this);\n this.handlePlotUpdate = this.handlePlotUpdate.bind(this);\n this.handleRelayout = this.handleRelayout.bind(this);\n this.handleRestyle = this.handleRestyle.bind(this);\n\n this.plot = React.createRef();\n this.plotWrapper = React.createRef();\n this.columnFormats = [];\n this.dateTimeFormatterOptions = {};\n this.decimalFormatOptions = {};\n this.integerFormatOptions = {};\n this.isSubscribed = false;\n this.isLoadedFired = false;\n this.currentSeries = 0;\n\n this.state = {\n data: null,\n downsamplingError: null,\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n layout: {\n datarevision: 0,\n },\n revision: 0,\n };\n }\n\n componentDidMount(): void {\n // Need to make sure the model dimensions are up to date before initializing the data\n this.updateDimensions();\n this.updateModelDimensions();\n\n this.initData();\n this.initFormatter();\n\n const { isActive } = this.props;\n if (isActive) {\n this.subscribe();\n }\n }\n\n componentDidUpdate(prevProps: ChartProps): void {\n const { isActive, settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n\n if (isActive !== prevProps.isActive) {\n if (isActive) {\n this.subscribe();\n } else {\n this.unsubscribe();\n }\n }\n }\n\n componentWillUnmount(): void {\n this.unsubscribe();\n }\n\n currentSeries: number;\n\n plot: RefObject<typeof Plot>;\n\n plotWrapper: RefObject<HTMLDivElement>;\n\n columnFormats?: FormattingRule[];\n\n dateTimeFormatterOptions?: DateTimeColumnFormatterOptions;\n\n decimalFormatOptions: DecimalColumnFormatterOptions;\n\n integerFormatOptions: IntegerColumnFormatterOptions;\n\n rect?: DOMRect;\n\n ranges?: unknown;\n\n isSubscribed: boolean;\n\n isLoadedFired: boolean;\n\n getCachedConfig = memoize(\n (\n downsamplingError: unknown,\n isDownsampleFinished: boolean,\n isDownsampleInProgress: boolean,\n isDownsamplingDisabled: boolean\n ) => {\n const customButtons = [];\n const hasDownsampleError = Boolean(downsamplingError);\n if (hasDownsampleError) {\n customButtons.push({\n name: `Downsampling failed: ${downsamplingError}`,\n click: () => undefined,\n icon: Chart.convertIcon(dhWarningFilled),\n attr: 'fill-warning',\n });\n }\n\n if (\n isDownsampleFinished ||\n isDownsampleInProgress ||\n isDownsamplingDisabled ||\n hasDownsampleError\n ) {\n const name = Chart.downsampleButtonTitle(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const attr = Chart.downsampleButtonAttr(\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n\n const icon = isDownsampleInProgress ? vsLoading : dhGraphLineDown;\n customButtons.push({\n name,\n icon: Chart.convertIcon(icon),\n click: this.handleDownsampleClick,\n attr,\n });\n }\n\n return {\n displaylogo: false,\n\n // Display the mode bar if there's an error or downsampling so user can see progress\n // Yes, the value is a boolean or the string 'hover': https://github.com/plotly/plotly.js/blob/master/src/plot_api/plot_config.js#L249\n displayModeBar:\n // eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n isDownsampleInProgress || hasDownsampleError ? true : 'hover',\n\n // Each array gets grouped together in the mode bar\n modeBarButtons: [\n customButtons,\n ['toImage'],\n ['zoom2d', 'pan2d'],\n ['zoomIn2d', 'zoomOut2d', 'autoScale2d', 'resetScale2d'],\n ],\n };\n }\n );\n\n getPlotRect(): DOMRect | null {\n return this.plotWrapper.current?.getBoundingClientRect() ?? null;\n }\n\n initData(): void {\n const { model } = this.props;\n const { layout } = this.state;\n this.setState({\n data: model.getData(),\n layout: {\n ...layout,\n ...model.getLayout(),\n },\n });\n }\n\n subscribe(): void {\n if (this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n if (!this.rect || this.rect.width === 0 || this.rect.height === 0) {\n log.debug2('Delaying subscription until model dimensions are set');\n return;\n }\n model.subscribe(this.handleModelEvent);\n this.isSubscribed = true;\n }\n\n unsubscribe(): void {\n if (!this.isSubscribed) {\n return;\n }\n\n const { model } = this.props;\n model.unsubscribe(this.handleModelEvent);\n this.isSubscribed = false;\n }\n\n handleAfterPlot(): void {\n if (this.plot.current != null) {\n // TODO: Translate whatever Don was doing in plotting.js in the afterplot here so that area graphs show up properly\n }\n }\n\n handleDownsampleClick(): void {\n this.setState(\n ({ isDownsamplingDisabled }) => ({\n downsamplingError: null,\n isDownsampleInProgress: false,\n isDownsampleFinished: false,\n isDownsamplingDisabled: !isDownsamplingDisabled,\n }),\n () => {\n const { model } = this.props;\n const { isDownsamplingDisabled } = this.state;\n model.setDownsamplingDisabled(isDownsamplingDisabled);\n }\n );\n }\n\n handleModelEvent(event: CustomEvent): void {\n const { type, detail } = event;\n log.debug2('Received data update', type, detail);\n\n switch (type) {\n case ChartModel.EVENT_UPDATED: {\n this.currentSeries += 1;\n this.setState(state => {\n const { layout, revision } = state;\n if (typeof layout.datarevision === 'number') {\n layout.datarevision += 1;\n }\n return {\n data: detail,\n layout,\n revision: revision + 1,\n };\n });\n\n const { onUpdate } = this.props;\n onUpdate({ isLoading: !this.isLoadedFired });\n break;\n }\n case ChartModel.EVENT_LOADFINISHED: {\n const { onUpdate } = this.props;\n this.isLoadedFired = true;\n onUpdate({ isLoading: false });\n break;\n }\n case ChartModel.EVENT_DISCONNECT: {\n const { onDisconnect } = this.props;\n onDisconnect();\n break;\n }\n case ChartModel.EVENT_RECONNECT: {\n const { onReconnect } = this.props;\n onReconnect();\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLESTARTED: {\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: true,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLEFINISHED: {\n this.setState({\n isDownsampleFinished: true,\n isDownsampleInProgress: false,\n downsamplingError: null,\n });\n break;\n }\n case ChartModel.EVENT_DOWNSAMPLENEEDED:\n case ChartModel.EVENT_DOWNSAMPLEFAILED: {\n const downsamplingError = detail.message ?? detail;\n this.setState({\n isDownsampleFinished: false,\n isDownsampleInProgress: false,\n isDownsamplingDisabled: false,\n downsamplingError,\n });\n\n const { onError } = this.props;\n onError(new Error(downsamplingError));\n break;\n }\n default:\n log.debug('Unknown event type', type, event);\n }\n }\n\n handlePlotUpdate(figure: { layout: Layout }): void {\n // User could have modified zoom/pan here, update the model dimensions\n // We don't need to update the datarevision, as we don't have any data changes\n // until an update comes back from the server anyway\n const { layout } = figure;\n const ranges = ChartUtils.getLayoutRanges(layout);\n\n const isRangesChanged = !deepEqual(ranges, this.ranges);\n\n if (isRangesChanged) {\n this.ranges = ranges;\n\n this.updateModelDimensions(true);\n }\n }\n\n handleRelayout(changes: { hiddenlabels?: string[] }): void {\n log.debug('handleRelayout', changes);\n if (changes.hiddenlabels != null) {\n const { onSettingsChanged } = this.props;\n // Pie charts store series visibility in layout.hiddenlabels and trigger relayout on changes\n // Series visibility for other types of charts is handled in handleRestyle\n const hiddenSeries = [...changes.hiddenlabels];\n onSettingsChanged({ hiddenSeries });\n }\n\n this.updateModelDimensions();\n }\n\n handleRestyle([changes, seriesIndexes]: [\n Record<string, unknown>,\n number[]\n ]): void {\n log.debug('handleRestyle', changes, seriesIndexes);\n if (Object.keys(changes).includes('visible')) {\n const { data } = this.state;\n const { onSettingsChanged } = this.props;\n if (data != null) {\n const hiddenSeries = data.reduce(\n (acc: string[], { name, visible }) =>\n name != null && visible === 'legendonly' ? [...acc, name] : acc,\n []\n );\n onSettingsChanged({ hiddenSeries });\n }\n }\n }\n\n /**\n * Update the models dimensions and ranges.\n * Note that this will update it all whether the plot size changes OR the range\n * the user is looking at has changed (eg. panning/zooming).\n * Could update each independently, but doing them at the same time keeps the\n * ChartModel API a bit cleaner.\n * @param force Force a change even if the chart dimensions haven't changed (eg. after pan/zoom)\n */\n updateModelDimensions(force = false): void {\n const rect = this.getPlotRect();\n if (!rect) {\n log.warn('Unable to get plotting rect');\n return;\n }\n\n const isRectChanged =\n !this.rect ||\n this.rect.width !== rect.width ||\n this.rect.height !== rect.height;\n\n if (isRectChanged || force) {\n this.rect = rect;\n\n const { isActive, model } = this.props;\n model.setDimensions(rect);\n // We may need to resubscribe if dimensions were too small before\n if (isActive) {\n this.subscribe();\n }\n }\n }\n\n initFormatter(): void {\n const { settings } = this.props;\n this.updateFormatterSettings(settings as FormatterSettings);\n }\n\n updateFormatterSettings(settings: FormatterSettings): void {\n const columnFormats = FormatterUtils.getColumnFormats(settings);\n const dateTimeFormatterOptions = FormatterUtils.getDateTimeFormatterOptions(\n settings\n );\n const { decimalFormatOptions = {}, integerFormatOptions = {} } = settings;\n\n if (\n !deepEqual(this.columnFormats, columnFormats) ||\n !deepEqual(this.dateTimeFormatterOptions, dateTimeFormatterOptions) ||\n !deepEqual(this.decimalFormatOptions, decimalFormatOptions) ||\n !deepEqual(this.integerFormatOptions, integerFormatOptions)\n ) {\n this.columnFormats = FormatterUtils.getColumnFormats(settings);\n this.dateTimeFormatterOptions = dateTimeFormatterOptions;\n this.decimalFormatOptions = decimalFormatOptions;\n this.integerFormatOptions = integerFormatOptions;\n this.updateFormatter();\n }\n }\n\n updateFormatter(): void {\n const { dh } = this.props;\n const formatter = new Formatter(\n dh,\n this.columnFormats,\n this.dateTimeFormatterOptions,\n this.decimalFormatOptions,\n this.integerFormatOptions\n );\n\n const { model } = this.props;\n model.setFormatter(formatter);\n }\n\n updateDimensions(): void {\n const rect = this.getPlotRect();\n if (\n this.plot.current != null &&\n rect != null &&\n rect.width > 0 &&\n rect.height > 0\n ) {\n // Call relayout to resize avoiding the debouncing plotly does\n // https://github.com/plotly/plotly.js/issues/2769#issuecomment-402099552\n Plotly.relayout(this.plot.current.el, { autosize: true }).catch(\n (e: unknown) => {\n log.debug('Unable to resize, promise rejected', e);\n }\n );\n }\n }\n\n render(): ReactElement {\n const {\n data,\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled,\n layout,\n revision,\n } = this.state;\n const config = this.getCachedConfig(\n downsamplingError,\n isDownsampleFinished,\n isDownsampleInProgress,\n isDownsamplingDisabled\n );\n const isPlotShown = data != null;\n return (\n <div className=\"h-100 w-100 chart-wrapper\" ref={this.plotWrapper}>\n {isPlotShown && (\n <Plot\n ref={this.plot}\n data={data}\n layout={layout}\n revision={revision}\n config={config}\n onAfterPlot={this.handleAfterPlot}\n onError={log.error}\n onRelayout={this.handleRelayout}\n onUpdate={this.handlePlotUpdate}\n onRestyle={this.handleRestyle}\n useResizeHandler\n style={{ height: '100%', width: '100%' }}\n />\n )}\n </div>\n );\n }\n}\n\nexport default Chart;\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,SAAS,QAAiC,OAAO;AACjE,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,OAAO,MAAM,aAAa;AACjC,SACEC,SAAS,EACTC,eAA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AAO;MACf,QAAQ,EAAEE,QAAS;MACnB,MAAM,EAAE2E,MAAO;MACf,WAAW,EAAE,IAAI,CAAC/F,eAAgB;MAClC,OAAO,EAAEhC,GAAG,CAACkI,KAAM;MACnB,UAAU,EAAE,IAAI,CAAC9F,cAAe;MAChC,QAAQ,EAAE,IAAI,CAACD,gBAAiB;MAChC,SAAS,EAAE,IAAI,CAACE,aAAc;MAC9B,gBAAgB;MAChB,KAAK,EAAE;QAAEqC,MAAM,EAAE,MAAM;QAAErE,KAAK,EAAE;MAAO;IAAE,EAE5C,CACG;EAEV;AACF;AAAC,gBAvgBYH,KAAK,kBACM;EACpBwD,QAAQ,EAAE,IAAI;EACdI,QAAQ,EAAE;IACRqE,QAAQ,EAAE,kBAAkB;IAC5BC,qBAAqB,EAAE1I,SAAS,CAAC2I,gBAAgB;IACjDC,YAAY,EAAE,KAAK;IACnBC,cAAc,EAAE,IAAI;IACpBhB,SAAS,EAAE;EACb,CAAC;EACDlC,YAAY,EAAE,MAAYrE,SAAS;EACnCuE,WAAW,EAAE,MAAYvE,SAAS;EAClCiE,QAAQ,EAAE,MAAYjE,SAAS;EAC/B6E,OAAO,EAAE,MAAY7E,SAAS;EAC9BsF,iBAAiB,EAAE,MAAYtF;AACjC,CAAC;AA0fH,eAAed,KAAK"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Figure, Table } from '@deephaven/jsapi-
|
|
1
|
+
import type { dh as DhType, Figure, Table } from '@deephaven/jsapi-types';
|
|
2
2
|
import { ChartModelSettings } from './ChartUtils';
|
|
3
3
|
import ChartModel from './ChartModel';
|
|
4
4
|
declare class ChartModelFactory {
|
|
5
5
|
/**
|
|
6
6
|
* Creates a model from the settings provided.
|
|
7
7
|
* Tries to create a Figure in the API with it.
|
|
8
|
+
* @param dh JSAPI instance
|
|
8
9
|
* @param settings The chart builder settings
|
|
9
10
|
* @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
|
|
10
11
|
* @param settings.series The column names to use for creating the series of this chart
|
|
@@ -17,7 +18,7 @@ declare class ChartModelFactory {
|
|
|
17
18
|
* CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel
|
|
18
19
|
* This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
|
|
19
20
|
*/
|
|
20
|
-
static makeModelFromSettings(settings: ChartModelSettings, table: Table, theme?: Readonly<{
|
|
21
|
+
static makeModelFromSettings(dh: DhType, settings: ChartModelSettings, table: Table, theme?: Readonly<{
|
|
21
22
|
paper_bgcolor: string;
|
|
22
23
|
plot_bgcolor: string;
|
|
23
24
|
title_color: string;
|
|
@@ -38,6 +39,7 @@ declare class ChartModelFactory {
|
|
|
38
39
|
/**
|
|
39
40
|
* Creates a model from the settings provided.
|
|
40
41
|
* Tries to create a Figure in the API with it.
|
|
42
|
+
* @param dh DH JSAPI instance
|
|
41
43
|
* @param settings The chart builder settings
|
|
42
44
|
* @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
|
|
43
45
|
* @param settings.series The column names to use for creating the series of this chart
|
|
@@ -47,10 +49,11 @@ declare class ChartModelFactory {
|
|
|
47
49
|
* @param table The table to build the model for
|
|
48
50
|
* @returns The Figure created with the settings provided
|
|
49
51
|
*/
|
|
50
|
-
static makeFigureFromSettings(settings: ChartModelSettings, table: Table): Promise<Figure>;
|
|
52
|
+
static makeFigureFromSettings(dh: DhType, settings: ChartModelSettings, table: Table): Promise<Figure>;
|
|
51
53
|
/**
|
|
52
54
|
* Creates a model from the settings provided.
|
|
53
55
|
* Tries to create a Figure in the API with it.
|
|
56
|
+
* @param dh DH JSAPI instance
|
|
54
57
|
* @param settings The chart builder settings
|
|
55
58
|
* @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
|
|
56
59
|
* @param settings.series The column names to use for creating the series of this chart
|
|
@@ -63,7 +66,7 @@ declare class ChartModelFactory {
|
|
|
63
66
|
* CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel
|
|
64
67
|
* This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
|
|
65
68
|
*/
|
|
66
|
-
static makeModel(settings: ChartModelSettings | undefined, figure: Figure, theme?: Readonly<{
|
|
69
|
+
static makeModel(dh: DhType, settings: ChartModelSettings | undefined, figure: Figure, theme?: Readonly<{
|
|
67
70
|
paper_bgcolor: string;
|
|
68
71
|
plot_bgcolor: string;
|
|
69
72
|
title_color: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartModelFactory.d.ts","sourceRoot":"","sources":["../src/ChartModelFactory.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"ChartModelFactory.d.ts","sourceRoot":"","sources":["../src/ChartModelFactory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,IAAI,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC1E,OAAmB,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAG9D,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,cAAM,iBAAiB;IACrB;;;;;;;;;;;;;;;OAeG;WACU,qBAAqB,CAChC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,KAAK,EACZ,KAAK;;;;;;;;;;;;;;;;;MAAa,GACjB,OAAO,CAAC,UAAU,CAAC;IAStB;;;;;;;;;;;;OAYG;WACU,sBAAsB,CACjC,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,kBAAkB,EAC5B,KAAK,EAAE,KAAK,GACX,OAAO,CAAC,MAAM,CAAC;IAelB;;;;;;;;;;;;;;;OAeG;WACU,SAAS,CACpB,EAAE,EAAE,MAAM,EACV,QAAQ,EAAE,kBAAkB,GAAG,SAAS,EACxC,MAAM,EAAE,MAAM,EACd,KAAK;;;;;;;;;;;;;;;;;MAAa,GACjB,OAAO,CAAC,UAAU,CAAC;CAGvB;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
2
2
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
3
|
-
import dh from '@deephaven/jsapi-shim';
|
|
4
3
|
import ChartUtils from "./ChartUtils.js";
|
|
5
4
|
import FigureChartModel from "./FigureChartModel.js";
|
|
6
5
|
import ChartTheme from "./ChartTheme.js";
|
|
@@ -8,6 +7,7 @@ class ChartModelFactory {
|
|
|
8
7
|
/**
|
|
9
8
|
* Creates a model from the settings provided.
|
|
10
9
|
* Tries to create a Figure in the API with it.
|
|
10
|
+
* @param dh JSAPI instance
|
|
11
11
|
* @param settings The chart builder settings
|
|
12
12
|
* @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
|
|
13
13
|
* @param settings.series The column names to use for creating the series of this chart
|
|
@@ -20,18 +20,19 @@ class ChartModelFactory {
|
|
|
20
20
|
* CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel
|
|
21
21
|
* This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
|
|
22
22
|
*/
|
|
23
|
-
static makeModelFromSettings(settings, table) {
|
|
23
|
+
static makeModelFromSettings(dh, settings, table) {
|
|
24
24
|
var _arguments = arguments;
|
|
25
25
|
return _asyncToGenerator(function* () {
|
|
26
|
-
var theme = _arguments.length >
|
|
27
|
-
var figure = yield ChartModelFactory.makeFigureFromSettings(settings, table);
|
|
28
|
-
return new FigureChartModel(figure, settings, theme);
|
|
26
|
+
var theme = _arguments.length > 3 && _arguments[3] !== undefined ? _arguments[3] : ChartTheme;
|
|
27
|
+
var figure = yield ChartModelFactory.makeFigureFromSettings(dh, settings, table);
|
|
28
|
+
return new FigureChartModel(dh, figure, settings, theme);
|
|
29
29
|
})();
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
/**
|
|
33
33
|
* Creates a model from the settings provided.
|
|
34
34
|
* Tries to create a Figure in the API with it.
|
|
35
|
+
* @param dh DH JSAPI instance
|
|
35
36
|
* @param settings The chart builder settings
|
|
36
37
|
* @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
|
|
37
38
|
* @param settings.series The column names to use for creating the series of this chart
|
|
@@ -41,23 +42,24 @@ class ChartModelFactory {
|
|
|
41
42
|
* @param table The table to build the model for
|
|
42
43
|
* @returns The Figure created with the settings provided
|
|
43
44
|
*/
|
|
44
|
-
static makeFigureFromSettings(settings, table) {
|
|
45
|
+
static makeFigureFromSettings(dh, settings, table) {
|
|
45
46
|
return _asyncToGenerator(function* () {
|
|
46
47
|
// Copy the table first and then re-apply the filters from the original table
|
|
47
|
-
// When we add
|
|
48
|
+
// When we add table linking we'll want to listen to the original table and update
|
|
48
49
|
// the copied table with any changes that occur.
|
|
49
50
|
// The table gets owned by the Figure that gets created, which closes the table
|
|
50
51
|
var tableCopy = yield table.copy();
|
|
51
52
|
tableCopy.applyCustomColumns(table.customColumns);
|
|
52
53
|
tableCopy.applyFilter(table.filter);
|
|
53
54
|
tableCopy.applySort(table.sort);
|
|
54
|
-
return dh.plot.Figure.create(ChartUtils.makeFigureSettings(settings, tableCopy));
|
|
55
|
+
return dh.plot.Figure.create(new ChartUtils(dh).makeFigureSettings(settings, tableCopy));
|
|
55
56
|
})();
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
/**
|
|
59
60
|
* Creates a model from the settings provided.
|
|
60
61
|
* Tries to create a Figure in the API with it.
|
|
62
|
+
* @param dh DH JSAPI instance
|
|
61
63
|
* @param settings The chart builder settings
|
|
62
64
|
* @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated
|
|
63
65
|
* @param settings.series The column names to use for creating the series of this chart
|
|
@@ -70,11 +72,11 @@ class ChartModelFactory {
|
|
|
70
72
|
* CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel
|
|
71
73
|
* This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel
|
|
72
74
|
*/
|
|
73
|
-
static makeModel(settings, figure) {
|
|
75
|
+
static makeModel(dh, settings, figure) {
|
|
74
76
|
var _arguments2 = arguments;
|
|
75
77
|
return _asyncToGenerator(function* () {
|
|
76
|
-
var theme = _arguments2.length >
|
|
77
|
-
return new FigureChartModel(figure, settings, theme);
|
|
78
|
+
var theme = _arguments2.length > 3 && _arguments2[3] !== undefined ? _arguments2[3] : ChartTheme;
|
|
79
|
+
return new FigureChartModel(dh, figure, settings, theme);
|
|
78
80
|
})();
|
|
79
81
|
}
|
|
80
82
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartModelFactory.js","names":["
|
|
1
|
+
{"version":3,"file":"ChartModelFactory.js","names":["ChartUtils","FigureChartModel","ChartTheme","ChartModelFactory","makeModelFromSettings","dh","settings","table","theme","figure","makeFigureFromSettings","tableCopy","copy","applyCustomColumns","customColumns","applyFilter","filter","applySort","sort","plot","Figure","create","makeFigureSettings","makeModel"],"sources":["../src/ChartModelFactory.ts"],"sourcesContent":["import type { dh as DhType, Figure, Table } from '@deephaven/jsapi-types';\nimport ChartUtils, { ChartModelSettings } from './ChartUtils';\nimport FigureChartModel from './FigureChartModel';\nimport ChartTheme from './ChartTheme';\nimport ChartModel from './ChartModel';\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 dh JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @param theme The theme for the figure. Defaults to ChartTheme\n * @returns The ChartModel Promise representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static async makeModelFromSettings(\n dh: DhType,\n settings: ChartModelSettings,\n table: Table,\n theme = ChartTheme\n ): Promise<ChartModel> {\n const figure = await ChartModelFactory.makeFigureFromSettings(\n dh,\n settings,\n table\n );\n return new FigureChartModel(dh, figure, settings, theme);\n }\n\n /**\n * Creates a model from the settings provided.\n * Tries to create a Figure in the API with it.\n * @param dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param table The table to build the model for\n * @returns The Figure created with the settings provided\n */\n static async makeFigureFromSettings(\n dh: DhType,\n settings: ChartModelSettings,\n table: Table\n ): Promise<Figure> {\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 const tableCopy = await table.copy();\n tableCopy.applyCustomColumns(table.customColumns);\n tableCopy.applyFilter(table.filter);\n tableCopy.applySort(table.sort);\n\n return dh.plot.Figure.create(\n new ChartUtils(dh).makeFigureSettings(settings, tableCopy)\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 dh DH JSAPI instance\n * @param settings The chart builder settings\n * @param settings.isLinked Whether the newly created chart should stay linked with the original table, update when filters are updated\n * @param settings.series The column names to use for creating the series of this chart\n * @param settings.type Chart builder type, from ChartBuilder.types\n * @param settings.xAxis The column name to use for the x-axis\n * @param [settings.hiddenSeries] Array of hidden series names\n * @param figure The figure to build the model for\n * @param theme The theme for the figure. Defaults to ChartTheme\n * @returns The FigureChartModel representing the figure\n * CRA sets tsconfig to type check JS based on jsdoc comments. It isn't able to figure out FigureChartModel extends ChartModel\n * This causes TS issues in 1 or 2 spots. Once this is TS it can be returned to just FigureChartModel\n */\n static async makeModel(\n dh: DhType,\n settings: ChartModelSettings | undefined,\n figure: Figure,\n theme = ChartTheme\n ): Promise<ChartModel> {\n return new FigureChartModel(dh, figure, settings, theme);\n }\n}\n\nexport default ChartModelFactory;\n"],"mappings":";;OACOA,UAAU;AAAA,OACVC,gBAAgB;AAAA,OAChBC,UAAU;AAGjB,MAAMC,iBAAiB,CAAC;EACtB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAaC,qBAAqB,CAChCC,EAAU,EACVC,QAA4B,EAC5BC,KAAY,EAES;IAAA;IAAA;MAAA,IADrBC,KAAK,0EAAGN,UAAU;MAElB,IAAMO,MAAM,SAASN,iBAAiB,CAACO,sBAAsB,CAC3DL,EAAE,EACFC,QAAQ,EACRC,KAAK,CACN;MACD,OAAO,IAAIN,gBAAgB,CAACI,EAAE,EAAEI,MAAM,EAAEH,QAAQ,EAAEE,KAAK,CAAC;IAAC;EAC3D;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAaE,sBAAsB,CACjCL,EAAU,EACVC,QAA4B,EAC5BC,KAAY,EACK;IAAA;MACjB;MACA;MACA;MACA;MACA,IAAMI,SAAS,SAASJ,KAAK,CAACK,IAAI,EAAE;MACpCD,SAAS,CAACE,kBAAkB,CAACN,KAAK,CAACO,aAAa,CAAC;MACjDH,SAAS,CAACI,WAAW,CAACR,KAAK,CAACS,MAAM,CAAC;MACnCL,SAAS,CAACM,SAAS,CAACV,KAAK,CAACW,IAAI,CAAC;MAE/B,OAAOb,EAAE,CAACc,IAAI,CAACC,MAAM,CAACC,MAAM,CAC1B,IAAIrB,UAAU,CAACK,EAAE,CAAC,CAACiB,kBAAkB,CAAChB,QAAQ,EAAEK,SAAS,CAAC,CAC3D;IAAC;EACJ;;EAEA;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;EACE,OAAaY,SAAS,CACpBlB,EAAU,EACVC,QAAwC,EACxCG,MAAc,EAEO;IAAA;IAAA;MAAA,IADrBD,KAAK,6EAAGN,UAAU;MAElB,OAAO,IAAID,gBAAgB,CAACI,EAAE,EAAEI,MAAM,EAAEH,QAAQ,EAAEE,KAAK,CAAC;IAAC;EAC3D;AACF;AAEA,eAAeL,iBAAiB"}
|
package/dist/ChartTestUtils.d.ts
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
import { Axis, Chart, Figure, Series, SeriesDataSource } from '@deephaven/jsapi-
|
|
1
|
+
import type { Axis, AxisFormatType, AxisPosition, AxisType, Chart, dh as DhType, Figure, Series, SeriesDataSource } from '@deephaven/jsapi-types';
|
|
2
2
|
declare class ChartTestUtils {
|
|
3
3
|
static DEFAULT_CHART_TITLE: string;
|
|
4
4
|
static DEFAULT_X_TITLE: string;
|
|
5
5
|
static DEFAULT_Y_TITLE: string;
|
|
6
6
|
static DEFAULT_SERIES_NAME: string;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
private dh;
|
|
8
|
+
constructor(dh: DhType);
|
|
9
|
+
makeAxis({ label, type, position, formatType, formatPattern, log, }?: {
|
|
10
|
+
label?: string;
|
|
11
|
+
type?: AxisType;
|
|
12
|
+
position?: AxisPosition;
|
|
13
|
+
formatType?: AxisFormatType;
|
|
14
|
+
formatPattern?: string;
|
|
15
|
+
log?: boolean;
|
|
14
16
|
}): Axis;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
makeDefaultAxes(): Axis[];
|
|
18
|
+
makeSource({ axis }: {
|
|
17
19
|
axis: Axis;
|
|
18
20
|
}): SeriesDataSource;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
makeDefaultSources(): SeriesDataSource[];
|
|
22
|
+
makeSeries({ name, plotStyle, sources, lineColor, shapeColor, }?: {
|
|
21
23
|
name?: string | undefined;
|
|
22
|
-
plotStyle?:
|
|
24
|
+
plotStyle?: null | undefined;
|
|
23
25
|
sources?: SeriesDataSource[] | undefined;
|
|
24
26
|
lineColor?: null | undefined;
|
|
25
27
|
shapeColor?: null | undefined;
|
|
26
28
|
}): Series;
|
|
27
|
-
|
|
29
|
+
makeChart({ title, series, axes, showLegend, rowspan, colspan, row, column, }?: {
|
|
28
30
|
title?: string;
|
|
29
31
|
series?: Series[];
|
|
30
32
|
axes?: Axis[];
|
|
@@ -34,7 +36,7 @@ declare class ChartTestUtils {
|
|
|
34
36
|
row?: number;
|
|
35
37
|
column?: number;
|
|
36
38
|
}): Chart;
|
|
37
|
-
|
|
39
|
+
makeFigure({ title, charts, rows, cols, }?: {
|
|
38
40
|
title?: string | undefined;
|
|
39
41
|
charts?: Chart[] | undefined;
|
|
40
42
|
rows?: number | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartTestUtils.d.ts","sourceRoot":"","sources":["../src/ChartTestUtils.ts"],"names":[],"mappings":"AAAA,
|
|
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,EACjB,MAAM,wBAAwB,CAAC;AAEhC,cAAM,cAAc;IAClB,MAAM,CAAC,mBAAmB,SAAiB;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CAAC,EACT,KAAgB,EAChB,MAA2B,EAC3B,IAAQ,EACR,IAAQ,GACT;;;;;KAAK,GAAG,MAAM;CAIhB;AAED,eAAe,cAAc,CAAC"}
|
package/dist/ChartTestUtils.js
CHANGED
|
@@ -1,68 +1,80 @@
|
|
|
1
1
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
2
2
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
3
3
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
4
|
-
import dh from '@deephaven/jsapi-shim';
|
|
5
4
|
class ChartTestUtils {
|
|
6
|
-
|
|
5
|
+
constructor(dh) {
|
|
6
|
+
_defineProperty(this, "dh", void 0);
|
|
7
|
+
this.dh = dh;
|
|
8
|
+
}
|
|
9
|
+
makeAxis() {
|
|
7
10
|
var {
|
|
8
11
|
label = 'Axis',
|
|
9
|
-
type =
|
|
10
|
-
position =
|
|
11
|
-
formatType =
|
|
12
|
+
type = undefined,
|
|
13
|
+
position = undefined,
|
|
14
|
+
formatType = undefined,
|
|
12
15
|
formatPattern = '###,###0.00',
|
|
13
16
|
log = false
|
|
14
17
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
18
|
+
var {
|
|
19
|
+
dh
|
|
20
|
+
} = this;
|
|
15
21
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
16
22
|
return new dh.Axis({
|
|
17
23
|
label,
|
|
18
|
-
type,
|
|
19
|
-
position,
|
|
20
|
-
formatType,
|
|
24
|
+
type: type !== null && type !== void 0 ? type : dh.plot.AxisType.X,
|
|
25
|
+
position: position !== null && position !== void 0 ? position : dh.plot.AxisPosition.BOTTOM,
|
|
26
|
+
formatType: formatType !== null && formatType !== void 0 ? formatType : dh.Axis.FORMAT_TYPE_NUMBER,
|
|
21
27
|
formatPattern,
|
|
22
28
|
log
|
|
23
29
|
});
|
|
24
30
|
}
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
makeDefaultAxes() {
|
|
32
|
+
var {
|
|
33
|
+
dh
|
|
34
|
+
} = this;
|
|
35
|
+
return [this.makeAxis({
|
|
27
36
|
label: ChartTestUtils.DEFAULT_X_TITLE,
|
|
28
37
|
type: dh.plot.AxisType.X
|
|
29
|
-
}),
|
|
38
|
+
}), this.makeAxis({
|
|
30
39
|
label: ChartTestUtils.DEFAULT_Y_TITLE,
|
|
31
40
|
type: dh.plot.AxisType.Y
|
|
32
41
|
})];
|
|
33
42
|
}
|
|
34
|
-
|
|
43
|
+
makeSource(_ref) {
|
|
35
44
|
var {
|
|
36
|
-
axis =
|
|
45
|
+
axis = this.makeAxis()
|
|
37
46
|
} = _ref;
|
|
38
47
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
return new dh.SeriesDataSource({
|
|
48
|
+
return new this.dh.SeriesDataSource({
|
|
40
49
|
axis,
|
|
41
50
|
type: axis.type
|
|
42
51
|
});
|
|
43
52
|
}
|
|
44
|
-
|
|
45
|
-
var axes =
|
|
46
|
-
return axes.map(axis =>
|
|
53
|
+
makeDefaultSources() {
|
|
54
|
+
var axes = this.makeDefaultAxes();
|
|
55
|
+
return axes.map(axis => this.makeSource({
|
|
47
56
|
axis
|
|
48
57
|
}));
|
|
49
58
|
}
|
|
50
|
-
|
|
59
|
+
makeSeries() {
|
|
51
60
|
var {
|
|
52
61
|
name = ChartTestUtils.DEFAULT_SERIES_NAME,
|
|
53
|
-
plotStyle =
|
|
54
|
-
sources =
|
|
62
|
+
plotStyle = null,
|
|
63
|
+
sources = this.makeDefaultSources(),
|
|
55
64
|
lineColor = null,
|
|
56
65
|
shapeColor = null
|
|
57
66
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
67
|
+
var {
|
|
68
|
+
dh
|
|
69
|
+
} = this;
|
|
58
70
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
59
|
-
return new dh.Series(name, plotStyle, sources, lineColor, shapeColor);
|
|
71
|
+
return new dh.Series(name, plotStyle !== null && plotStyle !== void 0 ? plotStyle : dh.plot.SeriesPlotStyle.SCATTER, sources, lineColor, shapeColor);
|
|
60
72
|
}
|
|
61
|
-
|
|
73
|
+
makeChart() {
|
|
62
74
|
var {
|
|
63
75
|
title = ChartTestUtils.DEFAULT_CHART_TITLE,
|
|
64
|
-
series = [
|
|
65
|
-
axes =
|
|
76
|
+
series = [this.makeSeries()],
|
|
77
|
+
axes = this.makeDefaultAxes(),
|
|
66
78
|
showLegend = null,
|
|
67
79
|
rowspan = 1,
|
|
68
80
|
colspan = 1,
|
|
@@ -70,7 +82,7 @@ class ChartTestUtils {
|
|
|
70
82
|
column = 0
|
|
71
83
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
72
84
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
73
|
-
return new dh.Chart({
|
|
85
|
+
return new this.dh.Chart({
|
|
74
86
|
title,
|
|
75
87
|
series,
|
|
76
88
|
axes,
|
|
@@ -81,15 +93,15 @@ class ChartTestUtils {
|
|
|
81
93
|
colspan
|
|
82
94
|
});
|
|
83
95
|
}
|
|
84
|
-
|
|
96
|
+
makeFigure() {
|
|
85
97
|
var {
|
|
86
98
|
title = 'Figure',
|
|
87
|
-
charts = [
|
|
99
|
+
charts = [this.makeChart()],
|
|
88
100
|
rows = 1,
|
|
89
101
|
cols = 1
|
|
90
102
|
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
91
103
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
92
|
-
return new dh.plot.Figure({
|
|
104
|
+
return new this.dh.plot.Figure({
|
|
93
105
|
title,
|
|
94
106
|
charts,
|
|
95
107
|
rows,
|