Skip to content

Commit

Permalink
chore(plugin-chart-echarts): bump to ECharts 5.2.1 (apache-superset#1370
Browse files Browse the repository at this point in the history
)

* chore(plugin-chart-echarts): bump to ECharts 5.2.1

* ignore type error
  • Loading branch information
villebro authored Sep 22, 2021
1 parent dead812 commit 7aef068
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 50 deletions.
2 changes: 1 addition & 1 deletion plugins/plugin-chart-echarts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"@superset-ui/core": "0.18.5",
"@types/math-expression-evaluator": "^1.2.1",
"d3-array": "^1.2.0",
"echarts": "^5.2.0",
"echarts": "^5.2.1",
"lodash": "^4.17.15",
"math-expression-evaluator": "^1.3.8"
},
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/BoxPlot/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
getNumberFormatter,
getTimeFormatter,
} from '@superset-ui/core';
import { EChartsOption, BoxplotSeriesOption } from 'echarts';
import { EChartsCoreOption, BoxplotSeriesOption } from 'echarts';
import { CallbackDataParams } from 'echarts/types/src/util/types';
import {
BoxPlotChartTransformedProps,
Expand Down Expand Up @@ -206,7 +206,7 @@ export default function transformProps(
yAxisTitleMargin,
xAxisTitleMargin,
);
const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
grid: {
...defaultGrid,
...chartPadding,
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/BoxPlot/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
QueryFormData,
SetDataMaskHook,
} from '@superset-ui/core';
import { EChartsOption } from 'echarts';
import { EChartsCoreOption } from 'echarts';
import { EchartsTitleFormData, DEFAULT_TITLE_FORM_DATA } from '../types';

export type BoxPlotQueryFormData = QueryFormData & {
Expand Down Expand Up @@ -56,7 +56,7 @@ export interface BoxPlotChartTransformedProps {
formData: BoxPlotQueryFormData;
height: number;
width: number;
echartOptions: EChartsOption;
echartOptions: EChartsCoreOption;
emitFilter: boolean;
setDataMask: SetDataMaskHook;
labelMap: Record<string, DataRecordValue[]>;
Expand Down
5 changes: 3 additions & 2 deletions plugins/plugin-chart-echarts/src/Funnel/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
NumberFormatter,
} from '@superset-ui/core';
import { CallbackDataParams } from 'echarts/types/src/util/types';
import { EChartsOption, FunnelSeriesOption } from 'echarts';
import { EChartsCoreOption, FunnelSeriesOption } from 'echarts';
import {
DEFAULT_FORM_DATA as DEFAULT_FUNNEL_FORM_DATA,
EchartsFunnelChartProps,
Expand Down Expand Up @@ -181,11 +181,12 @@ export default function transformProps(
fontWeight: 'bold',
},
},
// @ts-ignore
data: transformedData,
},
];

const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
grid: {
...defaultGrid,
},
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Funnel/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { EChartsOption } from 'echarts';
import { EChartsCoreOption } from 'echarts';
import {
ChartDataResponseResult,
ChartProps,
Expand Down Expand Up @@ -80,7 +80,7 @@ export interface FunnelChartTransformedProps {
formData: EchartsFunnelFormData;
height: number;
width: number;
echartOptions: EChartsOption;
echartOptions: EChartsCoreOption;
emitFilter: boolean;
setDataMask: SetDataMaskHook;
labelMap: Record<string, DataRecordValue[]>;
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Gauge/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import {
getMetricLabel,
DataRecordValue,
} from '@superset-ui/core';
import { EChartsOption, GaugeSeriesOption } from 'echarts';
import { EChartsCoreOption, GaugeSeriesOption } from 'echarts';
import { GaugeDataItemOption } from 'echarts/types/src/chart/gauge/GaugeSeries';
import range from 'lodash/range';
import { parseNumbersList } from '../utils/controls';
Expand Down Expand Up @@ -253,7 +253,7 @@ export default function transformProps(
},
];

const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
series,
};

Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Graph/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import {
DataRecord,
DataRecordValue,
} from '@superset-ui/core';
import { EChartsOption, GraphSeriesOption } from 'echarts';
import { EChartsCoreOption, GraphSeriesOption } from 'echarts';
import { extent as d3Extent } from 'd3-array';
import { GraphEdgeItemOption } from 'echarts/types/src/chart/graph/GraphSeries';
import {
Expand Down Expand Up @@ -265,7 +265,7 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
},
];

const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
animationDuration: DEFAULT_GRAPH_SERIES_OPTION.animationDuration,
animationEasing: DEFAULT_GRAPH_SERIES_OPTION.animationEasing,
tooltip: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
isIntervalAnnotationLayer,
isTimeseriesAnnotationLayer,
} from '@superset-ui/core';
import { EChartsOption, SeriesOption } from 'echarts';
import { EChartsCoreOption, SeriesOption } from 'echarts';
import {
DEFAULT_FORM_DATA,
EchartsMixedTimeseriesFormData,
Expand Down Expand Up @@ -227,7 +227,7 @@ export default function transformProps(

const { setDataMask = () => {} } = hooks;

const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
useUTC: true,
grid: {
...defaultGrid,
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/MixedTimeseries/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { EChartsOption } from 'echarts';
import { EChartsCoreOption } from 'echarts';
import {
AnnotationLayer,
TimeGranularity,
Expand Down Expand Up @@ -140,7 +140,7 @@ export type EchartsMixedTimeseriesChartTransformedProps = {
formData: EchartsMixedTimeseriesFormData;
height: number;
width: number;
echartOptions: EChartsOption;
echartOptions: EChartsCoreOption;
emitFilter: boolean;
emitFilterB: boolean;
setDataMask: SetDataMaskHook;
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Pie/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
NumberFormatter,
} from '@superset-ui/core';
import { CallbackDataParams } from 'echarts/types/src/util/types';
import { EChartsOption, PieSeriesOption } from 'echarts';
import { EChartsCoreOption, PieSeriesOption } from 'echarts';
import {
DEFAULT_FORM_DATA as DEFAULT_PIE_FORM_DATA,
EchartsPieChartProps,
Expand Down Expand Up @@ -211,7 +211,7 @@ export default function transformProps(chartProps: EchartsPieChartProps): PieCha
},
];

const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
grid: {
...defaultGrid,
},
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Pie/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { EChartsOption } from 'echarts';
import { EChartsCoreOption } from 'echarts';
import {
ChartDataResponseResult,
ChartProps,
Expand Down Expand Up @@ -88,7 +88,7 @@ export interface PieChartTransformedProps {
formData: EchartsPieFormData;
height: number;
width: number;
echartOptions: EChartsOption;
echartOptions: EChartsCoreOption;
emitFilter: boolean;
setDataMask: SetDataMaskHook;
labelMap: Record<string, DataRecordValue[]>;
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Radar/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
} from '@superset-ui/core';
import { CallbackDataParams } from 'echarts/types/src/util/types';
import { RadarSeriesDataItemOption } from 'echarts/types/src/chart/radar/RadarSeries';
import { EChartsOption, RadarSeriesOption } from 'echarts';
import { EChartsCoreOption, RadarSeriesOption } from 'echarts';
import {
DEFAULT_FORM_DATA as DEFAULT_RADAR_FORM_DATA,
EchartsRadarChartProps,
Expand Down Expand Up @@ -195,7 +195,7 @@ export default function transformProps(
},
];

const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
grid: {
...defaultGrid,
},
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Radar/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
import { EChartsOption } from 'echarts';
import { EChartsCoreOption } from 'echarts';
import {
ChartDataResponseResult,
ChartProps,
Expand Down Expand Up @@ -82,7 +82,7 @@ export interface RadarChartTransformedProps {
formData: EchartsRadarFormData;
height: number;
width: number;
echartOptions: EChartsOption;
echartOptions: EChartsCoreOption;
setDataMask: SetDataMaskHook;
labelMap: Record<string, DataRecordValue[]>;
groupby: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ export default function EchartsTimeseries({

const eventHandlers: EventHandlers = {
click: props => {
const { seriesName: name, value } = props;
const xValue = value[0].getTime?.() || value[0];
console.log(props, name, xValue);
const { seriesName: name } = props;
const values = Object.values(selectedValues);
if (values.includes(name)) {
handleChange(values.filter(v => v !== name));
Expand Down
5 changes: 3 additions & 2 deletions plugins/plugin-chart-echarts/src/Timeseries/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
TimeseriesChartDataResponseResult,
DataRecordValue,
} from '@superset-ui/core';
import { EChartsOption, SeriesOption } from 'echarts';
import { EChartsCoreOption, SeriesOption } from 'echarts';
import {
DEFAULT_FORM_DATA,
EchartsTimeseriesChartProps,
Expand Down Expand Up @@ -221,7 +221,7 @@ export default function transformProps(
yAxisTitleMargin,
xAxisTitleMargin,
);
const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
useUTC: true,
grid: {
...defaultGrid,
Expand All @@ -233,6 +233,7 @@ export default function transformProps(
nameGap: xAxisTitleMargin,
nameLocation: 'middle',
axisLabel: {
hideOverlap: true,
formatter: xAxisFormatter,
rotate: xAxisLabelRotation,
},
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Timeseries/transformers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
import { SeriesOption } from 'echarts';
import {
CallbackDataParams,
DefaultExtraStateOpts,
DefaultStatesMixin,
ItemStyleOption,
LineStyleOption,
OptionName,
Expand Down Expand Up @@ -301,7 +301,7 @@ export function transformEventAnnotation(
},
];

const lineStyle: LineStyleOption & DefaultExtraStateOpts['emphasis'] = {
const lineStyle: LineStyleOption & DefaultStatesMixin['emphasis'] = {
width,
type: style as ZRLineType,
color: color || colorScale(name),
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Tree/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { ChartProps, getMetricLabel, DataRecordValue } from '@superset-ui/core';
import { EChartsOption, TreeSeriesOption } from 'echarts';
import { EChartsCoreOption, TreeSeriesOption } from 'echarts';
import {
TreeSeriesCallbackDataParams,
TreeSeriesNodeItemOption,
Expand Down Expand Up @@ -190,7 +190,7 @@ export default function transformProps(chartProps: ChartProps): EchartsProps {
},
];

const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
animationDuration: DEFAULT_TREE_SERIES_OPTION.animationDuration,
animationEasing: DEFAULT_TREE_SERIES_OPTION.animationEasing,
series,
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Treemap/transformProps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import {
} from '@superset-ui/core';
import { groupBy, isNumber, transform } from 'lodash';
import { TreemapSeriesNodeItemOption } from 'echarts/types/src/chart/treemap/TreemapSeries';
import { EChartsOption, TreemapSeriesOption } from 'echarts';
import { EChartsCoreOption, TreemapSeriesOption } from 'echarts';
import {
DEFAULT_FORM_DATA as DEFAULT_TREEMAP_FORM_DATA,
EchartsTreemapChartProps,
Expand Down Expand Up @@ -279,7 +279,7 @@ export default function transformProps(
},
];

const echartOptions: EChartsOption = {
const echartOptions: EChartsCoreOption = {
tooltip: {
...defaultTooltip,
trigger: 'item',
Expand Down
4 changes: 2 additions & 2 deletions plugins/plugin-chart-echarts/src/Treemap/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {
QueryFormMetric,
SetDataMaskHook,
} from '@superset-ui/core';
import { EChartsOption } from 'echarts';
import { EChartsCoreOption } from 'echarts';
import { CallbackDataParams } from 'echarts/types/src/util/types';
import { LabelPositionEnum } from '../types';

Expand Down Expand Up @@ -77,7 +77,7 @@ export interface TreemapTransformedProps {
formData: EchartsTreemapFormData;
height: number;
width: number;
echartOptions: EChartsOption;
echartOptions: EChartsCoreOption;
emitFilter: boolean;
setDataMask: SetDataMaskHook;
labelMap: Record<string, DataRecordValue[]>;
Expand Down
6 changes: 3 additions & 3 deletions plugins/plugin-chart-echarts/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import { DataRecordValue, SetDataMaskHook } from '@superset-ui/core';
import { EChartsOption } from 'echarts';
import { EChartsCoreOption } from 'echarts';
import { TooltipMarker } from 'echarts/types/src/util/format';

export type EchartsStylesProps = {
Expand All @@ -28,7 +28,7 @@ export type EchartsStylesProps = {
export interface EchartsProps {
height: number;
width: number;
echartOptions: EChartsOption;
echartOptions: EChartsCoreOption;
eventHandlers?: EventHandlers;
selectedValues?: Record<number, string>;
forceClear?: boolean;
Expand Down Expand Up @@ -102,7 +102,7 @@ export interface EChartTransformedProps<F> {
formData: F;
height: number;
width: number;
echartOptions: EChartsOption;
echartOptions: EChartsCoreOption;
emitFilter: boolean;
setDataMask: SetDataMaskHook;
labelMap: Record<string, DataRecordValue[]>;
Expand Down
Loading

0 comments on commit 7aef068

Please sign in to comment.