| | |
| | | |
| | | _config.plot.$label = label |
| | | } |
| | | |
| | | if (_config.plot.zoomYaxis === 'adjust' && _config.plot.mutilBar === 'stack') { |
| | | if (_config.plot.Bar_axis) { |
| | | _config.plot.zoomFields = _config.plot.Yaxis.filter(cell => !_config.plot.Bar_axis.includes(cell)) |
| | | } |
| | | } |
| | | } else { |
| | | _config.plot.enabled = 'false' |
| | | } |
| | |
| | | */ |
| | | customrender = (data) => { |
| | | const { plot, transfield } = this.state |
| | | |
| | | let max = 0 |
| | | if (plot.zoomYaxis === 'adjust') { |
| | | data.forEach(item => { |
| | | if (plot.zoomFields) { |
| | | plot.zoomFields.forEach(f => { |
| | | if (item[f] > max) { |
| | | max = item[f] |
| | | } |
| | | }) |
| | | let sum = 0 |
| | | plot.Bar_axis.forEach(f => { |
| | | sum += item[f] |
| | | }) |
| | | if (sum > max) { |
| | | max = sum |
| | | } |
| | | } else { |
| | | plot.Yaxis.forEach(f => { |
| | | if (item[f] > max) { |
| | | max = item[f] |
| | | } |
| | | }) |
| | | } |
| | | }) |
| | | |
| | | if (!isNaN(max)) { |
| | | max = Math.ceil(max) |
| | | let s = Math.pow(10, (max + '').length - 1) |
| | | max = Math.ceil(max / s) * s |
| | | } else { |
| | | max = 0 |
| | | } |
| | | } |
| | | |
| | | const ds = new DataSet() |
| | | const dv = ds.createView().source(data) |
| | | |
| | |
| | | range: [0, 0.9] |
| | | } |
| | | |
| | | if (plot.min || plot.min === 0) { |
| | | c.min = plot.min |
| | | } |
| | | if (plot.max || plot.max === 0) { |
| | | c.max = plot.max |
| | | if (plot.zoomYaxis === 'adjust') { |
| | | if (max) { |
| | | c.min = 0 |
| | | c.max = max |
| | | } |
| | | } else { |
| | | if (plot.min || plot.min === 0) { |
| | | c.min = plot.min |
| | | } |
| | | if (plot.max || plot.max === 0) { |
| | | c.max = plot.max |
| | | c.min = c.min || 0 |
| | | } |
| | | } |
| | | view1.scale('value', c) |
| | | view1.axis('value', plot.$yc) |
| | |
| | | |
| | | let colorIndex = 0 |
| | | |
| | | if (plot.adjust !== 'stack') { |
| | | if (plot.mutilBar !== 'stack') { |
| | | let _chart = view1 |
| | | .interval() |
| | | .position(`${plot.Xaxis}*value`) |
| | |
| | | if (plot.barRadius) { |
| | | _chart.style({ radius: [plot.barRadius, plot.barRadius, 0, 0] }) |
| | | } |
| | | } else if (plot.adjust === 'stack') { |
| | | } else if (plot.mutilBar === 'stack') { |
| | | let _chart = view1 |
| | | .interval() |
| | | .position(`${plot.Xaxis}*value`) |
| | |
| | | range: [0, 0.9] |
| | | } |
| | | |
| | | if (item.min || item.min === 0) { |
| | | c.min = item.min |
| | | } |
| | | if (item.max || item.max === 0) { |
| | | c.max = item.max |
| | | if (plot.zoomYaxis === 'adjust') { |
| | | if (max) { |
| | | c.min = 0 |
| | | c.max = max |
| | | } |
| | | } else { |
| | | if (item.min || item.min === 0) { |
| | | c.min = item.min |
| | | } |
| | | if (item.max || item.max === 0) { |
| | | c.max = item.max |
| | | } |
| | | } |
| | | |
| | | view2.scale(item.name, c) |
| | |
| | | range: [0, 0.9] |
| | | } |
| | | |
| | | if (item.min || item.min === 0) { |
| | | c.min = item.min |
| | | } |
| | | if (item.max || item.max === 0) { |
| | | c.max = item.max |
| | | if (plot.zoomYaxis === 'adjust') { |
| | | if (max) { |
| | | c.min = 0 |
| | | c.max = max |
| | | } |
| | | } else { |
| | | if (item.min || item.min === 0) { |
| | | c.min = item.min |
| | | } |
| | | if (item.max || item.max === 0) { |
| | | c.max = item.max |
| | | } |
| | | } |
| | | |
| | | view2.scale(item.name, c) |
| | |
| | | } |
| | | if (plot.max || plot.max === 0) { |
| | | c.max = plot.max |
| | | c.min = c.min || 0 |
| | | } |
| | | chart.scale(_valfield, c) |
| | | |