forked from github/dataease
style(图表-基础折线图): 自定义排序后,图例个数超过9个时,图例marker未着色
This commit is contained in:
parent
96085792b2
commit
c5e6fa9253
@ -288,40 +288,40 @@ export class Line extends G2PlotChartView<LineOptions, G2Line> {
|
|||||||
}
|
}
|
||||||
protected configLegend(chart: Chart, options: LineOptions): LineOptions {
|
protected configLegend(chart: Chart, options: LineOptions): LineOptions {
|
||||||
const optionTmp = super.configLegend(chart, options)
|
const optionTmp = super.configLegend(chart, options)
|
||||||
const xAxisExt = chart.xAxisExt
|
const xAxisExt = chart.xAxisExt[0]
|
||||||
if (!optionTmp.legend || xAxisExt.length === 0 || xAxisExt[0].customSort?.length === 0) {
|
if (optionTmp.legend && xAxisExt?.customSort?.length > 0) {
|
||||||
return optionTmp
|
// 图例自定义排序
|
||||||
}
|
const l = optionTmp.legend
|
||||||
// 图例自定义排序
|
const basicStyle = parseJson(chart.customAttr).basicStyle
|
||||||
const l = optionTmp.legend
|
const sort = xAxisExt.customSort ?? []
|
||||||
const basicStyle = parseJson(chart.customAttr).basicStyle
|
const legendItems = []
|
||||||
const sort = xAxisExt[0].customSort ?? []
|
sort.forEach((item, index) => {
|
||||||
const legendItems = []
|
legendItems.push({
|
||||||
sort.forEach((item, index) => {
|
name: item,
|
||||||
legendItems.push({
|
value: item,
|
||||||
name: item,
|
marker: {
|
||||||
value: item,
|
symbol: l.marker.symbol,
|
||||||
marker: {
|
style: {
|
||||||
symbol: l.marker.symbol,
|
r: 6,
|
||||||
style: {
|
fill: 'rgba(0,0,0,0)',
|
||||||
r: 6,
|
lineWidth: 2,
|
||||||
fill: 'rgba(0,0,0,0)',
|
lineJoin: 'round',
|
||||||
lineWidth: 2,
|
stroke: basicStyle.colors[index % basicStyle.colors.length]
|
||||||
lineJoin: 'round',
|
}
|
||||||
stroke: basicStyle.colors[index]
|
|
||||||
}
|
}
|
||||||
}
|
})
|
||||||
})
|
})
|
||||||
})
|
const legend = {
|
||||||
const legend = {
|
...l,
|
||||||
...l,
|
custom: true,
|
||||||
custom: true,
|
items: legendItems
|
||||||
items: legendItems
|
}
|
||||||
}
|
return {
|
||||||
return {
|
...optionTmp,
|
||||||
...optionTmp,
|
legend
|
||||||
legend
|
}
|
||||||
}
|
}
|
||||||
|
return optionTmp
|
||||||
}
|
}
|
||||||
protected setupOptions(chart: Chart, options: LineOptions): LineOptions {
|
protected setupOptions(chart: Chart, options: LineOptions): LineOptions {
|
||||||
return flow(
|
return flow(
|
||||||
|
Loading…
Reference in New Issue
Block a user