| | |
| | | } else { |
| | | _chart.color('key') |
| | | } |
| | | if (plot.label === 'true') { |
| | | _chart.label('value', (value) => { |
| | | if (plot.label !== 'false') { |
| | | _chart.label('value*key', (value, key) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | let _color = color |
| | | |
| | | if (plot.labelColor === 'custom' && colors.has(key)) { |
| | | _color = colors.get(key) |
| | | } |
| | | return { |
| | | content: value, |
| | | style: { |
| | | fill: color |
| | | fill: _color |
| | | } |
| | | } |
| | | }) |
| | |
| | | nice: true |
| | | }) |
| | | |
| | | let lablecfg = { |
| | | position: 'top', |
| | | offset: 2, |
| | | style: { |
| | | fill: '#fff' |
| | | } |
| | | } |
| | | |
| | | if (plot.label === 'top') { |
| | | lablecfg.offset = -5 |
| | | lablecfg.style.textBaseline = 'top' |
| | | } else if (plot.label === 'middle') { |
| | | lablecfg.position = 'middle' |
| | | lablecfg.offset = 0 |
| | | } else if (plot.label === 'bottom') { |
| | | lablecfg.position = 'bottom' |
| | | lablecfg.offset = 0 |
| | | } else if (plot.label === 'true') { |
| | | lablecfg.style.fill = color |
| | | } |
| | | |
| | | if (Bar_axis.length) { |
| | | const view1 = chart.createView({ |
| | | region: { |
| | |
| | | } else { |
| | | _chart.color('key') |
| | | } |
| | | if (plot.label === 'true') { |
| | | _chart.label('value', (value) => { |
| | | if (plot.label !== 'false') { |
| | | _chart.label('value*key', (value, key) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | |
| | | if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { |
| | | lablecfg.style.fill = colors.get(key) |
| | | } |
| | | return { |
| | | content: value, |
| | | style: { |
| | | fill: color |
| | | } |
| | | ...lablecfg |
| | | } |
| | | }) |
| | | } |
| | |
| | | } else { |
| | | _chart.color('key') |
| | | } |
| | | if (plot.label === 'true') { |
| | | _chart.label('value', (value) => { |
| | | if (plot.label !== 'false') { |
| | | _chart.label('value*key', (value, key) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | |
| | | if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { |
| | | lablecfg.style.fill = colors.get(key) |
| | | } |
| | | |
| | | return { |
| | | content: value, |
| | | style: { |
| | | fill: color |
| | | } |
| | | ...lablecfg |
| | | } |
| | | }) |
| | | } |
| | |
| | | if (plot.barSize) { |
| | | _chart.size(plot.barSize || 35) |
| | | } |
| | | if (item.label === 'true') { |
| | | if (item.label !== 'false') { |
| | | _chart.label(item.name, (value) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | |
| | | if (plot.label === 'true' && plot.labelColor === 'custom') { |
| | | lablecfg.style.fill = item.color |
| | | } |
| | | return { |
| | | content: value, |
| | | style: { |
| | | fill: color |
| | | } |
| | | ...lablecfg |
| | | } |
| | | }) |
| | | } |
| | |
| | | } |
| | | }) |
| | | |
| | | if (item.label === 'true') { |
| | | if (item.label !== 'false') { |
| | | _chart.label(item.name, (value) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | let _color = color |
| | | |
| | | if (plot.labelColor === 'custom') { |
| | | _color = item.color |
| | | } |
| | | return { |
| | | content: value, |
| | | style: { |
| | | fill: color |
| | | fill: _color |
| | | } |
| | | } |
| | | }) |
| | |
| | | }) |
| | | } |
| | | |
| | | if (plot.transpose === 'true') { |
| | | chart.coordinate().transpose() |
| | | } |
| | | |
| | | if (plot.coordinate === 'polar') { |
| | | chart.coordinate('polar', { |
| | | innerRadius: 0.1, |
| | |
| | | |
| | | let colors = new Map() |
| | | let colorIndex = 0 |
| | | let lablecfg = { |
| | | position: 'top', |
| | | offset: 2, |
| | | style: { |
| | | fill: '#fff' |
| | | } |
| | | } |
| | | |
| | | if (plot.label === 'top') { |
| | | lablecfg.offset = -5 |
| | | lablecfg.style.textBaseline = 'top' |
| | | } else if (plot.label === 'middle') { |
| | | lablecfg.position = 'middle' |
| | | lablecfg.offset = 0 |
| | | } else if (plot.label === 'bottom') { |
| | | lablecfg.position = 'bottom' |
| | | lablecfg.offset = 0 |
| | | } else if (plot.label === 'true') { |
| | | lablecfg.style.fill = color |
| | | } |
| | | |
| | | if (plot.transpose === 'true') { |
| | | chart.coordinate().transpose() |
| | | if (plot.label === 'top') { |
| | | delete lablecfg.style.textBaseline |
| | | lablecfg.position = 'right' |
| | | lablecfg.offset = -3 |
| | | lablecfg.style.textAlign = 'end' |
| | | } else if (plot.label === 'middle') { |
| | | lablecfg.position = 'middle' |
| | | lablecfg.offset = 0 |
| | | } else if (plot.label === 'bottom') { |
| | | lablecfg.position = 'left' |
| | | lablecfg.offset = 2 |
| | | } else if (plot.label === 'true') { |
| | | lablecfg.position = 'right' |
| | | lablecfg.offset = 2 |
| | | } |
| | | } |
| | | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | if (plot.ramp === 'true') { |
| | |
| | | } else { |
| | | _chart.color('key') |
| | | } |
| | | if (plot.label === 'true') { |
| | | _chart.label('value', (value) => { |
| | | if (plot.label !== 'false') { |
| | | _chart.label('value*key', (value, key) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | |
| | | if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { |
| | | lablecfg.style.fill = colors.get(key) |
| | | } |
| | | |
| | | return { |
| | | content: value, |
| | | style: { |
| | | fill: color |
| | | } |
| | | ...lablecfg |
| | | } |
| | | }) |
| | | } |
| | |
| | | } else { |
| | | _chart.color('key') |
| | | } |
| | | if (plot.label === 'true') { |
| | | _chart.label('value', (value) => { |
| | | if (plot.label !== 'false') { |
| | | _chart.label('value*key', (value, key) => { |
| | | if (plot.show === 'percent') { |
| | | value = value + '%' |
| | | } |
| | | |
| | | if (plot.label === 'true' && plot.labelColor === 'custom' && colors.has(key)) { |
| | | lablecfg.style.fill = colors.get(key) |
| | | } |
| | | return { |
| | | content: value, |
| | | style: { |
| | | fill: color |
| | | } |
| | | ...lablecfg |
| | | } |
| | | }) |
| | | } |