| | |
| | | _plot.customs = [] |
| | | delete _plot.Yaxis |
| | | } else if (_plot.Yaxis) { |
| | | let labels = {} |
| | | config.columns.forEach(col => { |
| | | labels[col.field] = col.label |
| | | }) |
| | | let yaxis = JSON.parse(JSON.stringify(_plot.Yaxis)) |
| | | let caxis = _plot.customs ? _plot.customs.map(m => m.type) : [] |
| | | yaxis.sort() |
| | | caxis.sort() |
| | | |
| | | if (JSON.stringify(yaxis) !== JSON.stringify(caxis)) { |
| | | let labels = {} |
| | | config.columns.forEach(col => { |
| | | labels[col.field] = col.label |
| | | }) |
| | | |
| | | let cus = {} |
| | | _plot.customs && _plot.customs.forEach(m => { |
| | | cus[m.type] = m |
| | | }) |
| | | _plot.customs = _plot.Yaxis.map((item, i) => { |
| | | if (cus[item]) return cus[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | name: labels[item] || item, |
| | | axis: i === 0 ? 'true' : 'false', |
| | | label: 'false', |
| | | title: 'true', |
| | | shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth'] |
| | | } |
| | | }) |
| | | |
| | | let cus = {} |
| | | _plot.customs && _plot.customs.forEach(m => { |
| | | cus[m.type] = m |
| | | }) |
| | | _plot.customs = _plot.Yaxis.map((item, i) => { |
| | | if (cus[item]) return cus[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | name: labels[item] || item, |
| | | axis: i === 0 ? 'true' : 'false', |
| | | label: 'false', |
| | | title: 'true', |
| | | shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth'] |
| | | } |
| | | }) |
| | | |
| | | let cusColor = {} |
| | | let limit = chartColors.length |
| | | |
| | | _plot.colors && _plot.colors.forEach(m => { |
| | | cusColor[m.type] = m |
| | | }) |
| | | _plot.colors = _plot.Yaxis.map((item, i) => { |
| | | if (cusColor[item]) return cusColor[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | label: labels[item] || item, |
| | | color: chartColors[i % limit], |
| | | color1: chartColors[i % limit] |
| | | } |
| | | }) |
| | | let cusColor = {} |
| | | let limit = chartColors.length |
| | | |
| | | _plot.colors && _plot.colors.forEach(m => { |
| | | cusColor[m.type] = m |
| | | }) |
| | | _plot.colors = _plot.Yaxis.map((item, i) => { |
| | | if (cusColor[item]) return cusColor[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | label: labels[item] || item, |
| | | color: chartColors[i % limit], |
| | | color1: chartColors[i % limit] |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |
| | |
| | | _plot.colors = _plot.colors || [] |
| | | delete _plot.Yaxis |
| | | } else if (_plot.Yaxis) { |
| | | let labels = {} |
| | | config.columns.forEach(col => { |
| | | labels[col.field] = col.label |
| | | }) |
| | | let yaxis = JSON.parse(JSON.stringify(_plot.Yaxis)) |
| | | let caxis = _plot.customs ? _plot.customs.map(m => m.type) : [] |
| | | yaxis.sort() |
| | | caxis.sort() |
| | | |
| | | let cus = {} |
| | | _plot.customs && _plot.customs.forEach(m => { |
| | | cus[m.type] = m |
| | | }) |
| | | _plot.customs = _plot.Yaxis.map((item, i) => { |
| | | if (cus[item]) return cus[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | name: labels[item] || item, |
| | | axis: i === 0 ? 'true' : 'false', |
| | | label: _plot.label === 'false' ? 'false' : true, |
| | | title: 'true', |
| | | shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth'] |
| | | } |
| | | }) |
| | | |
| | | let cusColor = {} |
| | | let limit = chartColors.length |
| | | |
| | | _plot.colors && _plot.colors.forEach(m => { |
| | | cusColor[m.type] = m |
| | | }) |
| | | _plot.colors = _plot.Yaxis.map((item, i) => { |
| | | if (cusColor[item]) return cusColor[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | label: labels[item] || item, |
| | | color: chartColors[i % limit], |
| | | color1: chartColors[i % limit] |
| | | } |
| | | }) |
| | | if (JSON.stringify(yaxis) !== JSON.stringify(caxis)) { |
| | | let labels = {} |
| | | config.columns.forEach(col => { |
| | | labels[col.field] = col.label |
| | | }) |
| | | |
| | | let cus = {} |
| | | _plot.customs && _plot.customs.forEach(m => { |
| | | cus[m.type] = m |
| | | }) |
| | | _plot.customs = _plot.Yaxis.map((item, i) => { |
| | | if (cus[item]) return cus[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | name: labels[item] || item, |
| | | axis: i === 0 ? 'true' : 'false', |
| | | label: _plot.label === 'false' ? 'false' : true, |
| | | title: 'true', |
| | | shape: _plot.chartType === 'bar' && i === 0 ? ['bar', 'rect'] : ['line', 'smooth'] |
| | | } |
| | | }) |
| | | |
| | | let cusColor = {} |
| | | let limit = chartColors.length |
| | | |
| | | _plot.colors && _plot.colors.forEach(m => { |
| | | cusColor[m.type] = m |
| | | }) |
| | | _plot.colors = _plot.Yaxis.map((item, i) => { |
| | | if (cusColor[item]) return cusColor[item] |
| | | |
| | | return { |
| | | uuid: Utils.getuuid(), |
| | | type: item, |
| | | label: labels[item] || item, |
| | | color: chartColors[i % limit], |
| | | color1: chartColors[i % limit] |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | this.setState({ |