import { FunctionComponent } from 'react'; import { getComputedStyleValue, getCustomTheme, Charts, ThemeColor } from '@patternfly/react-charts/echarts'; import * as echarts from 'echarts/core'; import { LineChart } from 'echarts/charts'; import { GridComponent, TitleComponent, TooltipComponent } from 'echarts/components'; import { SVGRenderer } from 'echarts/renderers'; import chart_color_blue_300 from '@patternfly/react-tokens/dist/esm/chart_color_blue_300'; import chart_color_green_300 from '@patternfly/react-tokens/dist/esm/chart_color_green_300'; import chart_color_purple_300 from '@patternfly/react-tokens/dist/esm/chart_color_purple_300'; import chart_color_teal_300 from '@patternfly/react-tokens/dist/esm/chart_color_teal_300'; import chart_color_yellow_300 from '@patternfly/react-tokens/dist/esm/chart_color_yellow_300'; // Register required components echarts.use([GridComponent, LineChart, SVGRenderer, TitleComponent, TooltipComponent]); export const Theme: FunctionComponent = () => { const myCustomTheme = getCustomTheme(ThemeColor.default, { color: [ getComputedStyleValue(chart_color_purple_300), getComputedStyleValue(chart_color_blue_300), getComputedStyleValue(chart_color_green_300), getComputedStyleValue(chart_color_teal_300), getComputedStyleValue(chart_color_yellow_300) ] }); return ( (value !== 0 ? `${value}` : '') }, splitNumber: 3, type: 'value' }, series: [ { data: [1, 2, 5, 3], name: 'Cats', symbol: 'rect', type: 'line' }, { data: [2, 1, 7, 4], name: 'Dogs', lineStyle: { type: 'dashed' }, symbol: 'arrow', type: 'line' }, { data: [3, 4, 9, 5], name: 'Birds', symbol: 'circle', type: 'line' }, { data: [3, 3, 8, 7], name: 'Mice', symbol: 'emptyCircle', type: 'line' } ], title: { left: 'center', text: 'This is a Line chart' } }} theme={myCustomTheme} width={825} /> ); };