antvis/G2



The issue has been closed
多轴图折线图 tooltip item 展示不符合预期 #5672
pearmini posted onGitHub
- 版本:5.1.6
import { Chart } from '@antv/g2';
const data = [
{
Month: 'Jan',
Evaporation: 2,
Temperature: 2,
},
{
Month: 'Feb',
Evaporation: 4.9,
Temperature: 2.2,
},
{
Month: 'Mar',
Evaporation: 7,
Temperature: 3.3,
},
{
Month: 'Jan',
Precipitation: 2.6,
Temperature: 2,
},
{
Month: 'Feb',
Precipitation: 5.9,
Temperature: 2.2,
},
{
Month: 'Mar',
Precipitation: 9,
Temperature: 3.3,
},
];
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart.data(data);
chart
.line()
.encode('x', 'Month')
.encode('y', 'Evaporation')
.encode('color', '#EE6666')
.encode('shape', 'smooth')
.scale('y', { independent: true, domainMax: 30 })
chart
.line()
.encode('x', 'Month')
.encode('y', 'Precipitation')
.encode('color', '#91CC75')
.scale('y', { independent: true })
.axis('y', {
position: 'right',
});
chart.render();