[英]Display only Start and End object names in victory charts in X-Axis
My requirement is to display all the details of my object in Y- Axis and to show first and last object details in X-Axis (like to show a range).我的要求是在 Y 轴中显示对象的所有详细信息,并在 X 轴中显示第一个和最后一个对象的详细信息(如显示范围)。 My code as bellow我的代码如下
render() {
let array = [ ];
this.props.data.map(data => {
array.push({ x: data.date, y: data.total })
})
return (
<View>
<VictoryChart>
<VictoryLine
style={{
data: { stroke: "#c43a31" },
parent: { border: "1px solid #ccc" }
}}
data={array}
/>
</VictoryChart>
</View>
);
}
The current display of the graph as per the above code as bellow根据上面的代码当前显示的图形如下
I only wants to show the fist and last dates on my X-Axis.我只想在 X 轴上显示第一个和最后一个日期。 What am I missing here ??我在这里错过了什么?
I know this is an old question but better late than never.我知道这是一个老问题,但迟到总比不到好。 I didn't test this.我没有测试这个。 I'm just guiding you.我只是在指导你。
You can make use of tickValues
for VictoryAxis
.您可以将tickValues
用于VictoryAxis
。 doc here 文档在这里
Try to give your array of values as tickValues
for the axis like this.尝试将您的值数组作为tickValues
的轴的tickValues
值。
['11-08', '', '', '', '', '11-15]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.