| | |
| | | let colorIndex = 0 |
| | | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | if (plot.ramp === 'true') { |
| | | plot.colors.forEach(item => { |
| | | if (!colors.has(transfield[item.type])) { |
| | | colors.set(transfield[item.type], `l(0) 0:${item.color} 1:${item.color1}` ) |
| | | } |
| | | }) |
| | | } else { |
| | | plot.colors.forEach(item => { |
| | | if (!colors.has(transfield[item.type])) { |
| | | colors.set(transfield[item.type], item.color) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let _chart = chart |
| | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | let limit = chartColors.length |
| | | _chart.color('key', (key) => { |
| | | if (colors.get(key)) { |
| | | if (colors.has(key)) { |
| | | return colors.get(key) |
| | | } else { |
| | | colors.set(key, chartColors[colorIndex % limit]) |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | let limit = chartColors.length |
| | | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | plot.colors.forEach(item => { |
| | | if (!colors.has(item.type)) { |
| | | colors.set(item.type, item.color) |
| | | if (plot.ramp === 'true') { |
| | | let bars = {} |
| | | plot.customs.forEach(item => { |
| | | if (!item.shape || !item.shape[0] || item.shape[0] === 'bar') { |
| | | bars[item.type] = true |
| | | } |
| | | }) |
| | | plot.colors.forEach(item => { |
| | | if (!colors.has(transfield[item.type])) { |
| | | if (bars[item.type]) { |
| | | colors.set(transfield[item.type], `l(90) 0:${item.color} 1:${item.color1}` ) |
| | | } else { |
| | | colors.set(transfield[item.type], `l(0) 0:${item.color} 1:${item.color1}` ) |
| | | } |
| | | } |
| | | }) |
| | | } else { |
| | | plot.colors.forEach(item => { |
| | | if (!colors.has(transfield[item.type])) { |
| | | colors.set(transfield[item.type], item.color) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | let axisIndex = 0 |
| | |
| | | item.chartType = item.shape ? (item.shape[0] || 'bar') : 'bar' |
| | | item.shape = item.shape ? (item.shape[1] || '') : '' |
| | | |
| | | if (colors.get(item.type)) { |
| | | item.color = colors.get(item.type) |
| | | if (colors.has(item.name)) { |
| | | item.color = colors.get(item.name) |
| | | } else { |
| | | item.color = chartColors[colorIndex % limit] |
| | | colorIndex++ |
| | |
| | | |
| | | view1.legend(false) |
| | | |
| | | let colors = new Map() |
| | | let colorIndex = 0 |
| | | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | plot.colors.forEach(item => { |
| | | if (!colors.has(transfield[item.type])) { |
| | | colors.set(transfield[item.type], item.color) |
| | | } |
| | | }) |
| | | } |
| | | |
| | | if (plot.mutilBar !== 'stack') { |
| | | let _chart = view1 |
| | | .interval() |
| | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | let limit = chartColors.length |
| | | _chart.color('key', (key) => { |
| | | if (colors.get(key)) { |
| | | // return 'l(90) 0:#1890ff 1:#70cdd0' |
| | | if (colors.has(key)) { |
| | | return colors.get(key) |
| | | } else { |
| | | colors.set(key, chartColors[colorIndex % limit]) |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | let limit = chartColors.length |
| | | _chart.color('key', (key) => { |
| | | if (colors.get(key)) { |
| | | if (colors.has(key)) { |
| | | return colors.get(key) |
| | | } else { |
| | | colors.set(key, chartColors[colorIndex % limit]) |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | let colorIndex = 0 |
| | | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | if (plot.ramp === 'true') { |
| | | plot.colors.forEach(item => { |
| | | if (!colors.has(transfield[item.type])) { |
| | | colors.set(transfield[item.type], `l(90) 0:${item.color} 1:${item.color1}` ) |
| | | } |
| | | }) |
| | | } else { |
| | | plot.colors.forEach(item => { |
| | | if (!colors.has(transfield[item.type])) { |
| | | colors.set(transfield[item.type], item.color) |
| | | } |
| | | }) |
| | | } |
| | | } |
| | | |
| | | if (plot.adjust !== 'stack') { |
| | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | let limit = chartColors.length |
| | | _chart.color('key', (key) => { |
| | | if (colors.get(key)) { |
| | | if (colors.has(key)) { |
| | | return colors.get(key) |
| | | } else { |
| | | colors.set(key, chartColors[colorIndex % limit]) |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |
| | |
| | | if (plot.colors && plot.colors.length > 0) { |
| | | let limit = chartColors.length |
| | | _chart.color('key', (key) => { |
| | | if (colors.get(key)) { |
| | | if (colors.has(key)) { |
| | | return colors.get(key) |
| | | } else { |
| | | colors.set(key, chartColors[colorIndex % limit]) |
| | | colorIndex++ |
| | | return chartColors[(colorIndex - 1) % limit] |
| | | } |
| | | }) |
| | | } else { |