提交 b24a46e6 authored 作者: junjun's avatar junjun

refactor: 颜色优化

上级 8b6dc5c0
...@@ -25,7 +25,7 @@ export function baseBarOption(chart_option, chart) { ...@@ -25,7 +25,7 @@ export function baseBarOption(chart_option, chart) {
const y = chart.data.series[i] const y = chart.data.series[i]
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
} }
// size // size
if (customAttr.size) { if (customAttr.size) {
...@@ -88,7 +88,7 @@ export function horizontalBarOption(chart_option, chart) { ...@@ -88,7 +88,7 @@ export function horizontalBarOption(chart_option, chart) {
const y = chart.data.series[i] const y = chart.data.series[i]
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
} }
// size // size
if (customAttr.size) { if (customAttr.size) {
......
...@@ -40,7 +40,7 @@ export function baseFunnelOption(chart_option, chart) { ...@@ -40,7 +40,7 @@ export function baseFunnelOption(chart_option, chart) {
y.name = chart.data.x[i] y.name = chart.data.x[i]
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
} }
// y.type = 'funnel' // y.type = 'funnel'
chart_option.series[0].data.push(y) chart_option.series[0].data.push(y)
......
...@@ -63,7 +63,7 @@ export function baseGaugeOption(chart_option, chart) { ...@@ -63,7 +63,7 @@ export function baseGaugeOption(chart_option, chart) {
for (let i = 0; i < arr.length; i++) { for (let i = 0; i < arr.length; i++) {
const ele = arr[i] const ele = arr[i]
const p = parseInt(ele) / 100 const p = parseInt(ele) / 100
range.push([p, hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha)]) range.push([p, hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)])
if (!flag && per <= p) { if (!flag && per <= p) {
flag = true flag = true
index = i index = i
...@@ -73,7 +73,7 @@ export function baseGaugeOption(chart_option, chart) { ...@@ -73,7 +73,7 @@ export function baseGaugeOption(chart_option, chart) {
index = arr.length index = arr.length
} }
range.push([1, hexColorToRGBA(customAttr.color.colors[arr.length % 9], customAttr.color.alpha)]) range.push([1, hexColorToRGBA(customAttr.color.colors[arr.length % customAttr.color.colors.length], customAttr.color.alpha)])
chart_option.series[0].axisLine = { chart_option.series[0].axisLine = {
lineStyle: { lineStyle: {
color: range color: range
......
...@@ -88,12 +88,12 @@ export function baseGaugeOptionAntV(plot, container, chart, action) { ...@@ -88,12 +88,12 @@ export function baseGaugeOptionAntV(plot, container, chart, action) {
options.indicator = { options.indicator = {
pointer: { pointer: {
style: { style: {
stroke: theme.styleSheet.paletteQualitative10[index % 9] stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length]
} }
}, },
pin: { pin: {
style: { style: {
stroke: theme.styleSheet.paletteQualitative10[index % 9] stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length]
} }
} }
} }
......
...@@ -25,7 +25,7 @@ export function baseLineOption(chart_option, chart) { ...@@ -25,7 +25,7 @@ export function baseLineOption(chart_option, chart) {
const y = chart.data.series[i] const y = chart.data.series[i]
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
} }
// size // size
if (customAttr.size) { if (customAttr.size) {
......
...@@ -73,7 +73,7 @@ export function baseMapOption(chart_option, chart) { ...@@ -73,7 +73,7 @@ export function baseMapOption(chart_option, chart) {
y.name = chart.data.x[i] y.name = chart.data.x[i]
// color // color
// y.itemStyle = { // y.itemStyle = {
// color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), // color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha),
// borderRadius: 0 // borderRadius: 0
// } // }
chart_option.series[0].data.push(y) chart_option.series[0].data.push(y)
......
...@@ -27,7 +27,7 @@ export function baseMixOption(chart_option, chart) { ...@@ -27,7 +27,7 @@ export function baseMixOption(chart_option, chart) {
y.type = y.type ? y.type : 'bar' y.type = y.type ? y.type : 'bar'
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
} }
// size // size
if (customAttr.size) { if (customAttr.size) {
......
...@@ -43,7 +43,7 @@ export function baseMixOptionAntV(plot, container, chart, action) { ...@@ -43,7 +43,7 @@ export function baseMixOptionAntV(plot, container, chart, action) {
const o = { const o = {
type: '', type: '',
options: { options: {
color: colors[i % 9], color: colors[i % colors.length],
data: d.data, data: d.data,
xField: 'field', xField: 'field',
yField: 'value', yField: 'value',
......
...@@ -41,7 +41,7 @@ export function basePieOption(chart_option, chart) { ...@@ -41,7 +41,7 @@ export function basePieOption(chart_option, chart) {
y.name = chart.data.x[i] y.name = chart.data.x[i]
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha),
borderRadius: 0 borderRadius: 0
} }
y.type = 'pie' y.type = 'pie'
...@@ -94,7 +94,7 @@ export function rosePieOption(chart_option, chart) { ...@@ -94,7 +94,7 @@ export function rosePieOption(chart_option, chart) {
y.name = chart.data.x[i] y.name = chart.data.x[i]
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha),
borderRadius: customAttr.size.pieRoseRadius borderRadius: customAttr.size.pieRoseRadius
} }
y.type = 'pie' y.type = 'pie'
......
...@@ -33,7 +33,7 @@ export function baseRadarOption(chart_option, chart) { ...@@ -33,7 +33,7 @@ export function baseRadarOption(chart_option, chart) {
} }
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
} }
// label // label
if (customAttr.label) { if (customAttr.label) {
......
...@@ -30,7 +30,7 @@ export function baseScatterOption(chart_option, chart, terminal = 'pc') { ...@@ -30,7 +30,7 @@ export function baseScatterOption(chart_option, chart, terminal = 'pc') {
const y = chart.data.series[i] const y = chart.data.series[i]
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
} }
// size // size
if (customAttr.size) { if (customAttr.size) {
......
...@@ -49,7 +49,7 @@ export function baseTreemapOption(chart_option, chart) { ...@@ -49,7 +49,7 @@ export function baseTreemapOption(chart_option, chart) {
y.name = chart.data.x[i] y.name = chart.data.x[i]
// color // color
y.itemStyle = { y.itemStyle = {
color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)
} }
// y.type = 'treemap' // y.type = 'treemap'
chart_option.series[0].data.push(y) chart_option.series[0].data.push(y)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论