hustcc / echarts-for-react

⛳️ Apache ECharts components for React wrapper. 一个简单的 Apache echarts 的 React 封装。
https://git.hust.cc/echarts-for-react
MIT License
4.52k stars 630 forks source link

Update Required type Opts ( and add support for SSR) #567

Open RayaneSlimani opened 6 months ago

RayaneSlimani commented 6 months ago

Update Required in Opts Between ECharts and ECharts-for-React, and Lack of SSR Support

Description: Currently, there is a discrepancy between the options available for configuring a chart in ECharts and those used in the ECharts-for-React wrapper. Additionally, there is a lack of support for Server-Side Rendering (SSR) in the ECharts-for-React wrapper.

Problem: In ECharts, the options are defined as follows:

opts= {
    devicePixelRatio?: number,
    renderer?: string,
    useDirtyRect?: boolean,
    useCoarsePointer?: boolean,
    pointerSize?: number,
    ssr?: boolean,
    width?: number|string,
    height?: number|string,
    locale?: string
}

However, in the ECharts-for-React wrapper, the options are defined differently:

export type Opts = {
  readonly devicePixelRatio?: number;
  readonly renderer?: 'canvas' | 'svg';
  readonly width?: number | null | undefined | 'auto';
  readonly height?: number | null | undefined | 'auto';
  readonly locale?: string;
};

Moreover, the ECharts-for-React wrapper lacks support for Server-Side Rendering (SSR), which is a crucial feature for many projects aiming to improve performance and SEO.

Proposed Solution: Harmonize the options between ECharts and ECharts-for-React, either by aligning the definitions or providing clear documentation on how to translate between the two sets of options. Implement Server-Side Rendering (SSR) support in the ECharts-for-React wrapper to enable rendering charts on the server side, improving performance and SEO.

image

RayaneSlimani commented 5 months ago

@hustcc up

hustcc commented 5 months ago

Can help me with a pr?