VictoryChart 不更改日期数据
VictoryChart not change date data
我有一个胜利图和两个坐标轴,下面这张图
https://formidable.com/open-source/victory/gallery/multiple-dependent-axes/
我无话可说,但这张图表现在看起来像这样
但问题是我无法更改日期数据,尽管我更改了日期
<VictoryAxis
crossAxis={true}
tickCount={12}
data={date}
tickFormat={(x) => {
console.log(x);
return x.toLocaleString("vn-vn", {
month: "short",
day: "numeric"
});
}}
/>
和日期数据
const date = [
{ x: new Date(2000, 3, 4) },
{ x: new Date(2003, 4, 17) },
{ x: new Date(2004, 1, 1) },
{ x: new Date(2005, 1, 1) },
{ x: new Date(2006, 1, 1) },
{ x: new Date(2007, 2, 1) },
{ x: new Date(2008, 1, 1) }
];
但是总是显示1 jan
,求助
这是现场演示和数据
https://codesandbox.io/s/chart2-11eut?file=/src/App.js:776-1010
非常感谢
使用数组:
const date = [
new Date(2000, 3, 4),
new Date(2003, 4, 17),
new Date(2004, 1, 1),
new Date(2005, 1, 1),
new Date(2006, 1, 1),
new Date(2007, 2, 1),
new Date(2008, 1, 1)
];
修改JSX如下:
<VictoryAxis
crossAxis={true}
tickValues={date}
tickCount={date.length}
tickFormat={(x) => {
return x.toLocaleString("vn-vn",
{month: "short", day: "numeric"})
}
}
/>
我有一个胜利图和两个坐标轴,下面这张图
https://formidable.com/open-source/victory/gallery/multiple-dependent-axes/
我无话可说,但这张图表现在看起来像这样
但问题是我无法更改日期数据,尽管我更改了日期
<VictoryAxis
crossAxis={true}
tickCount={12}
data={date}
tickFormat={(x) => {
console.log(x);
return x.toLocaleString("vn-vn", {
month: "short",
day: "numeric"
});
}}
/>
和日期数据
const date = [
{ x: new Date(2000, 3, 4) },
{ x: new Date(2003, 4, 17) },
{ x: new Date(2004, 1, 1) },
{ x: new Date(2005, 1, 1) },
{ x: new Date(2006, 1, 1) },
{ x: new Date(2007, 2, 1) },
{ x: new Date(2008, 1, 1) }
];
但是总是显示1 jan
,求助
这是现场演示和数据
https://codesandbox.io/s/chart2-11eut?file=/src/App.js:776-1010
非常感谢
使用数组:
const date = [
new Date(2000, 3, 4),
new Date(2003, 4, 17),
new Date(2004, 1, 1),
new Date(2005, 1, 1),
new Date(2006, 1, 1),
new Date(2007, 2, 1),
new Date(2008, 1, 1)
];
修改JSX如下:
<VictoryAxis
crossAxis={true}
tickValues={date}
tickCount={date.length}
tickFormat={(x) => {
return x.toLocaleString("vn-vn",
{month: "short", day: "numeric"})
}
}
/>