-
Notifications
You must be signed in to change notification settings - Fork 605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DualAxes中右边y坐标可以设置起始值吗?比如0 #2313
Comments
这个之前我尝试过,似乎没有用。StackOverflown里也有人说无效。 import { DualAxes, G2 } from '@antv/g2plot';
const { registerTheme } = G2;
registerTheme('custom-theme', {
colors10: ['#FACDAA', '#F4A49E', '#EE7B91', '#E85285', '#BE408C', '#BE408C'],
/** 20色板 */
colors20: ['#FACDAA', '#F4A49E', '#EE7B91', '#E85285', '#BE408C', '#BE408C', '#942D93'],
});
const uvBillData = [
{ time: 'Mon', value: 42, type: 'Overspeed' },
{ time: 'Tue', value: 123, type: 'Overspeed' },
{ time: 'Wed', value: 52, type: 'Overspeed' },
{ time: 'Thu', value: 33, type: 'Overspeed' },
{ time: 'Fri', value: 75, type: 'Overspeed' },
{ time: 'Sat', value: 53, type: 'Overspeed' },
{ time: 'Sun', value: 90, type: 'Overspeed' },
{ time: 'Mon', value: 153, type: 'Underspeed' },
{ time: 'Tue', value: 900, type: 'Underspeed' },
{ time: 'Wed', value: 300, type: 'Underspeed' },
{ time: 'Thu', value: 450, type: 'Underspeed' },
{ time: 'Fri', value: 470, type: 'Underspeed' },
{ time: 'Sat', value: 220, type: 'Underspeed' },
{ time: 'Sun', value: 300, type: 'Underspeed' },
];
const transformData = [
{ time: 'Mon', speed: 54 },
{ time: 'Tue', speed: 55 },
{ time: 'Wed', speed: 52 },
{ time: 'Thu', speed: 45 },
{ time: 'Fri', speed: 53 },
{ time: 'Sat', speed: 59 },
{ time: 'Sun', speed: 45 },
];
const dualAxes = new DualAxes('container', {
padding: 30,
autoFit: true,
data: [uvBillData, transformData],
meta: {
min: 0,
minLimit:0
},
xField: 'time',
yField: ['value', 'speed'],
legend: { position: 'bottom'},
geometryOptions: [
{
geometry: 'column',
isStack: true,
seriesField: 'type',
color: ({ type }) => {
if(type === 'Underspeed'){
return 'rgb(98 218 171)';
}
return '#f96060';
},
},
{
autoFit: false,
geometry: 'line',
smooth: true,
label : {
content: (x)=>x.speed +'km',
style: {
opacity: 0.6,
fontSize: 12
},
},
yAxis: {
title: 'xx'
},
},
],
});
dualAxes.render(); |
visiky
pushed a commit
that referenced
this issue
Feb 7, 2021
非常感谢 |
hustcc
pushed a commit
that referenced
this issue
Feb 7, 2021
close: #2313 Co-authored-by: kasmine <visiky>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
目前右边值是自动计算出来的,如果想从0开始,如何设置?谢谢。
The text was updated successfully, but these errors were encountered: