From e9cf9ade40c4a80a166d8408095a71aa41c63dad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sylvain=20Th=C3=A9nault?= Date: Thu, 25 Feb 2021 11:15:29 +0100 Subject: [PATCH] Add locale to Opts type (#412) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add locale to Opts type as available in echarts v5 * Add example of using Opts.locale to the demo website Co-authored-by: Sylvain Thénault --- docs/examples/locale.md | 49 +++++++++++++++++++++++++++++++++++++++++ src/types.ts | 1 + 2 files changed, 50 insertions(+) create mode 100644 docs/examples/locale.md diff --git a/docs/examples/locale.md b/docs/examples/locale.md new file mode 100644 index 0000000..f350772 --- /dev/null +++ b/docs/examples/locale.md @@ -0,0 +1,49 @@ +--- +title: Locale +order: 8 +--- + +## Locale + +```tsx +import React from 'react'; +import ReactECharts from 'echarts-for-react'; + +import "echarts/i18n/langFR"; + +const Page: React.FC = () => { + const option = { + title: { + text: 'ECharts 入门示例' + }, + toolbox: { + feature: { + saveAsImage: {}, + dataZoom: {}, + restore: {} + } + }, + tooltip: {}, + legend: { + data:['销量'] + }, + xAxis: { + data: ['衬衫', '羊毛衫', '雪纺衫', '裤子', '高跟鞋', '袜子'] + }, + yAxis: {}, + series: [{ + name: '销量', + type: 'line', + data: [5, 20, 36, 10, 10, 20] + }] + }; + + return ; +}; + +export default Page; +``` diff --git a/src/types.ts b/src/types.ts index 7b8bd1a..6876863 100644 --- a/src/types.ts +++ b/src/types.ts @@ -9,6 +9,7 @@ export type Opts = { readonly renderer?: 'canvas' | 'svg'; readonly width?: number | null | undefined | 'auto'; readonly height?: number | null | undefined | 'auto'; + readonly locale?: string; }; export type EChartsReactProps = {