// 核心库 import React, { Component } from 'react' // 组件库 import { Search } from '@woowalker/feui' import TableChart from './TableChart' class LineBarChart extends Component { getLineBarChartOption = (option, chartType) => { // 解析出 echarts option 配置 const { data = [], xAxis = [], yAxis = [] } = option || {} let tempXAxis = xAxis.map(item => ({ type: 'category', data: item.data })) let tempYAxis = yAxis.map(({ name, max, min, inverse }) => ({ type: 'value', name, nameTextStyle: { align: 'left' }, max, min, inverse })) let tempLegend = [] let tempSeries = data.map(item => { const { name, type, stack, yAxisIndex, data: itemData = [] } = item tempLegend.push(name) return { name, type: type || (chartType === 0 ? 'line' : 'bar'), stack, data: itemData.map(seriesData => { return { value: seriesData.value || 0, TooltipValue: seriesData.TooltipValue } }), yAxisIndex } }) // echarts 图表配置 const chartOption = { legend: { top: '5%', textStyle: { color: '#333333' }, data: tempLegend }, grid: { left: '2%', right: '4%', bottom: '2%', containLabel: true }, xAxis: tempXAxis, yAxis: tempYAxis, tooltip: { trigger: 'axis', axisPointer: { type: 'shadow' }, formatter: (params) => { const title = params[0].axisValueLabel const body = params.map(item => { return `