[react] feat: Added docs for components/Echart
This commit is contained in:
parent
f6f6419cae
commit
7058843534
4 changed files with 152 additions and 2 deletions
|
@ -12,6 +12,25 @@ echarts.registerTheme('dark', {
|
|||
backgroundColor: 'transparent',
|
||||
})
|
||||
|
||||
/**
|
||||
* A component to provide Echart functionality.
|
||||
*
|
||||
* This is a wrapper around Apache Echarts. The option prop is for echarts.
|
||||
*
|
||||
* @component
|
||||
* @param {object} props - All component props
|
||||
* @param {object} [props.option = false] - The Echarts option object. This is
|
||||
* marked as optional because this component will show a loading message when
|
||||
* option is not an object. However, that is intended for use-cases where
|
||||
* option relies on async code. This component is pointless if you do not
|
||||
* (eventually) pass it an option prop.
|
||||
* @param {string} [props.theme = 'light'] - The theme to use for echarts. Supports 'light' and 'dark'.
|
||||
* @param {number} [props.h = 400] - The height of the chart, in pixels. Charts
|
||||
* are rendered as SVG, we need to set a height because without a height, some
|
||||
* browsers will not properly render the SVG element. This is an Echart
|
||||
* limitation.
|
||||
* @returns {JSX.Element}
|
||||
*/
|
||||
export const ChartWrapper = ({ option = false, theme = 'light', h = 400 }) => {
|
||||
return option ? (
|
||||
<ReactECharts option={option} className="class_2" theme={theme} style={{ height: h }} />
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue