Improve plot helper typing

This commit is contained in:
Matthias 2023-05-04 07:21:00 +02:00
parent 77952ec2c9
commit 7d2be4e6df

View File

@ -1,15 +1,17 @@
import { IndicatorConfig } from '@/types'; import { IndicatorConfig } from '@/types';
import { SeriesOption } from 'echarts'; import { BarSeriesOption, LineSeriesOption, ScatterSeriesOption } from 'echarts';
import randomColor from '../randomColor'; import randomColor from '../randomColor';
export type SupportedSeriesTypes = LineSeriesOption | BarSeriesOption | ScatterSeriesOption;
export function generateCandleSeries( export function generateCandleSeries(
colDate: number, colDate: number,
col: number, col: number,
key: string, key: string,
value: IndicatorConfig, value: IndicatorConfig,
axis = 0, axis = 0,
): SeriesOption { ): SupportedSeriesTypes {
const sp: SeriesOption = { const sp: SupportedSeriesTypes = {
name: key, name: key,
type: value.type || 'line', type: value.type || 'line',
xAxisIndex: axis, xAxisIndex: axis,