fix(视图): 修复K线图自定义颜色分类不正确的问题

This commit is contained in:
jianneng-fit2cloud 2024-09-26 00:17:16 +08:00
parent c2f60c029b
commit cd8c3b155e
2 changed files with 12 additions and 1 deletions

View File

@ -608,11 +608,13 @@ export function stockLineOptionAntV(container, chart, action) {
const theme = getTheme(chart) const theme = getTheme(chart)
const legend = getLegend(chart) const legend = getLegend(chart)
const basicStyle = JSON.parse(chart.customAttr).color const basicStyle = JSON.parse(chart.customAttr).color
const colors = [] let colors = []
const alpha = basicStyle.alpha const alpha = basicStyle.alpha
basicStyle.colors.forEach(ele => { basicStyle.colors.forEach(ele => {
colors.push(hexColorToRGBA(ele, alpha)) colors.push(hexColorToRGBA(ele, alpha))
}) })
// custom color
colors = antVCustomColor(chart)
const data = cloneDeep(chart.data?.tableRow ?? []) const data = cloneDeep(chart.data?.tableRow ?? [])
// 时间字段 // 时间字段

View File

@ -3761,6 +3761,15 @@ export function getColors(chart, colors, reset) {
}) })
} }
} }
} else if (equalsAny(chart.type, 'stock-line')) {
const averages = ['MA5', 'MA10', 'MA20', 'MA60', 'MA120', 'MA180']
for (let i = 0; i < averages.length; i++) {
seriesColors.push({
name: averages[i],
color: colors[i % colors.length],
isCustom: false
})
}
} else { } else {
if (chart.data) { if (chart.data) {
const data = chart.data.data const data = chart.data.data