🐛 [BUG] 混合图,柱状折线组合图表,只显示一个图例
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 591
- PR merge metrics
- No merged PRs in 30d
Description
import { Mix } from '@antv/g2plot';
const data = [
{ year: '1991', value: 3, category: '销量' },
{ year: '1992', value: 4, category: '销量' },
{ year: '1991', value: 2, category: '利润' },
{ year: '1992', value: 3, category: '利润' },
];
const mixPlot = new Mix('container', {
appendPadding: 8,
data,
plots: [
{
type: 'column',
options: {
data: data.filter((d) => d.category === '销量'),
xField: 'year',
yField: 'value',
seriesField: 'category',
},
},
{
type: 'line',
options: {
data: data.filter((d) => d.category === '利润'),
xField: 'year',
yField: 'value',
seriesField: 'category',
},
},
],
legend: {}
});
mixPlot.render();
Contributor guide
Research direction
Start with the Mix chart reproduction using the provided data, column and line plot configurations, and legend option. Run it to confirm that only one legend is rendered, then trace how Mix combines plot legends. Done means the combined chart displays the legends for both categories.
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
- 35/100