Skip to content

Commit

Permalink
fix(interactive-chart): export chart interface (#809)
Browse files Browse the repository at this point in the history
* fix(interactive-chart): import extension

Co-authored-by: wattachai <[email protected]>

---------

Co-authored-by: wattachai <[email protected]>
  • Loading branch information
Nantawat-Poothong and wattachai-lseg authored Jul 12, 2023
1 parent ded5e94 commit d930d5d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
2 changes: 2 additions & 0 deletions packages/elements/src/interactive-chart/helpers/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export {
Theme,
RowLegend,
SeriesList,
SeriesData,
SeriesDataItem,
SeriesOptions,
SeriesStyleOptions,
ColorToStringFunction,
LegendStyle
Expand Down
18 changes: 14 additions & 4 deletions packages/elements/src/interactive-chart/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
BarData,
MouseEventParams,
ITimeScaleApi,
SeriesOptions,
SeriesOptions as ChartSeriesOptions,
LineData,
HistogramData,
ChartOptions,
Expand All @@ -40,17 +40,27 @@ import type {
Theme,
RowLegend,
SeriesList,
SeriesData,
SeriesDataItem,
SeriesOptions,
SeriesStyleOptions,
ColorToStringFunction
} from './helpers/types';
} from './helpers/types.js';

import { LegendStyle } from './helpers/types.js';
import { merge, MergeObject } from './helpers/merge.js';

export type {
InteractiveChartConfig,
InteractiveChartSeries,
Time,
Theme,
RowLegend,
SeriesList,
SeriesData,
SeriesDataItem,
SeriesOptions,
SeriesStyleOptions,
LegendStyle
};

Expand Down Expand Up @@ -514,7 +524,7 @@ export class InteractiveChart extends ResponsiveElement {
for (let index = 0; index < this.internalConfig.series.length; index++) {

// Get seriesOptions and type
const seriesOptions = this.internalConfig.series[index].seriesOptions as SeriesOptions<SeriesStyleOptions> || {};
const seriesOptions = this.internalConfig.series[index].seriesOptions as ChartSeriesOptions<SeriesStyleOptions> || {};
const type = this.internalConfig.series[index].type;

let seriesThemeOptions = {};
Expand Down Expand Up @@ -586,7 +596,7 @@ export class InteractiveChart extends ResponsiveElement {
}
// Update config seriesOptions not have seriesOptions
if (!this.internalConfig.series[index].seriesOptions) {
this.internalConfig.series[index].seriesOptions = seriesThemeOptions as SeriesOptions<SeriesStyleOptions>;
this.internalConfig.series[index].seriesOptions = seriesThemeOptions as ChartSeriesOptions<SeriesStyleOptions>;
}
else {
merge(seriesOptions as unknown as MergeObject, seriesThemeOptions);
Expand Down

0 comments on commit d930d5d

Please sign in to comment.