antvis / antvis/G2Plot

🐛 [BUG] 双轴图图例颜色不会随柱形图和折线图自定义柱子或线颜色进行更改

Open
#2,694 3 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
TypeScript
Stars
2.7k
Forks
591
PR merge metrics
No merged PRs in 30d

Description

### 🐛 双轴图图例颜色不会柱形图和折线图自定义颜色进行更改

### code:
`
import { DualAxes } from '@antv/g2plot';
const uvBillData = [
{ time: '2019-03', value: 350, type: 'uv' },
{ time: '2019-04', value: 900, type: 'uv' },
{ time: '2019-05', value: 300, type: 'uv' },
{ time: '2019-06', value: 450, type: 'uv' },
{ time: '2019-07', value: 470, type: 'uv' },
];
const transformData = [
{ time: '2019-03', count: 800, name: 'a' },
{ time: '2019-04', count: 600, name: 'a' },
{ time: '2019-05', count: 400, name: 'a' },
{ time: '2019-06', count: 380, name: 'a' },
{ time: '2019-07', count: 220, name: 'a' },
];
const dualAxes = new DualAxes('container', {
data: [uvBillData, transformData],
xField: 'time',
yField: ['value', 'count'],
meta: {
count: {
alias: '通过率',
formatter: (v) => `${(v * 100).toFixed(1)}%`,
min: 0,
},
},
appendPadding: 12,
geometryOptions: [
{
geometry: 'column',
seriesField: 'type',
columnWidthRatio: 0.4,
maxColumnWidth: 30,
color: '#00A0ED',
columnStyle: {
fill: 'l(270) 0:#B3FEF5 1:#00A0ED',
},
},
{
geometry: 'line',
seriesField: 'name',
lineStyle:{
stroke: 'rgba(246,189,21,1.00)',
},
point: {
size: 4,
shape: 'circle',
style: () => ({ fill: 'white', stroke: 'rgba(251,173,20,1.00)', lineWidth: 3 }),
},
},
],
});
dualAxes.render();
`

Contributor guide

Open the contributing guide

Research direction

Start by running the DualAxes reproduction from the issue with its custom column and line colors, then trace how the @antv/g2plot DualAxes entry point builds the legend. Done means the legend colors match the configured column and line colors in the example.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.