Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(issue): 30131 #31751

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import {
Ref,
} from 'react';

import { useSelector } from 'react-redux';
import { ExplorePageState } from 'src/explore/types';
import * as echarts from 'echarts/core';
jpchev marked this conversation as resolved.
Show resolved Hide resolved

import { styled } from '@superset-ui/core';
import { use, init, EChartsType } from 'echarts/core';
import {
Expand Down Expand Up @@ -123,10 +127,14 @@ function Echart(
getEchartInstance: () => chartRef.current,
}));

const localeObj = useSelector((state: ExplorePageState) => state?.common?.locale);

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

This comment was marked as resolved.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

const lang = require('echarts/lib/i18n/lang' + localeObj.toUpperCase()).default;

This comment was marked as resolved.

echarts.registerLocale(localeObj.toUpperCase(), lang);

useEffect(() => {
if (!divRef.current) return;
if (!chartRef.current) {
chartRef.current = init(divRef.current);
chartRef.current = init(divRef.current, undefined, { locale: localeObj });
jpchev marked this conversation as resolved.
Show resolved Hide resolved
}

Object.entries(eventHandlers || {}).forEach(([name, handler]) => {
Expand Down
Loading