antvis / G2

📊 The concise and progressive visualization grammar.
https://g2.antv.antgroup.com
MIT License
12.08k stars 1.58k forks source link

组合图缩略轴Y或者Y1拖动后,两边刻度变成一样了 #6007

Open hxz1993 opened 8 months ago

hxz1993 commented 8 months ago

问题描述

组合图配置Y和Y1 两个缩略轴,拖动Y1 会导致Y的刻度和Y1 变成一样

重现链接

No response

重现步骤

import { Chart } from '@antv/g2';

const data = [ { Month: 'Jan', Evaporation: 2, Precipitation: 2.6, Temperature: 2, }, { Month: 'Feb', Evaporation: 4.9, Precipitation: 5.9, Temperature: 2.2, }, { Month: 'Mar', Evaporation: 7, Precipitation: 9, Temperature: 3.3, }, { Month: 'Apr', Evaporation: 23.2, Precipitation: 26.4, Temperature: 4.5, }, { Month: 'May', Evaporation: 25.6, Precipitation: 28.7, Temperature: 6.3, }, { Month: 'Jun', Evaporation: 76.7, Precipitation: 70.7, Temperature: 10.2, }, { Month: 'Jul', Evaporation: 135.6, Precipitation: 175.6, Temperature: 20.3, }, { Month: 'Aug', Evaporation: 162.2, Precipitation: 182.2, Temperature: 23.4, }, { Month: 'Sep', Evaporation: 32.6, Precipitation: 48.7, Temperature: 23, }, { Month: 'Oct', Evaporation: 20, Precipitation: 18.8, Temperature: 16.5, }, { Month: 'Nov', Evaporation: 6.4, Precipitation: 6, Temperature: 12, }, { Month: 'Dec', Evaporation: 3.3, Precipitation: 2.3, Temperature: 6.2, }, ];

const chart = new Chart({ container: 'container', autoFit: true, });

chart.data(data);

chart .line() .encode('x', 'Month') .encode('y', 'Temperature') .encode('color', '#EE6666') .encode('shape', 'smooth') .scale('y', { independent: true, domainMax: 30 }) .axis('y', { title: 'Temperature (°C)', grid: null, titleFill: '#EE6666', }) .slider('y')

chart .interval() .encode('x', 'Month') .encode('y', 'Evaporation') .encode('color', '#5470C6') .scale('y', { independent: true, domainMax: 200}) .style('fillOpacity', 0.8) .axis('y', { position: 'right', title: 'Evaporation (ml)', titleFill: '#5470C6', }) .slider('y')

chart.render();

预期行为

拖动哪个缩略轴,只对应的刻度线发上变化

平台

屏幕截图或视频(可选)

初始效果:image 拖动后两个变一样了: image

补充说明(可选)

No response

pearmini commented 8 months ago

目前多轴图的 Y 轴不支持 slider,会存在 Bug。