[英]Victory | How to display x-axis from the lowest negative y-axis value
我有一個圖形來顯示一些值,但是y軸具有負值,如下所示。
<VictoryChart
theme={VictoryTheme.material}
>
<VictoryLine
style={{
data: { stroke: "#c43a31" },
parent: { border: "1px solid #ccc"}
}}
data={[
{ x: 1, y: -2 },
{ x: 2, y: -3 },
{ x: 3, y: -5 },
{ x: 4, y: -4 },
{ x: 5, y: -7 }
]}
/>
</VictoryChart>
這樣顯示。
我需要將x軸設置為y軸的-7值。 我該如何實現? 謝謝!
嘗試這個:
<VictoryChart
theme={VictoryTheme.material}
domain={{x: [1, 5], y: [-7, -2]}}
>
<VictoryAxis
orientation="top"
/>
<VictoryAxis dependentAxis
orientation="left"
invertAxis
/>
<VictoryLine
style={{
data: { stroke: "#c43a31" },
parent: { border: "1px solid #ccc"}
}}
data={[
{ x: 1, y: -2 },
{ x: 2, y: -3 },
{ x: 3, y: -5 },
{ x: 4, y: -4 },
{ x: 5, y: -7 }
]}
/>
</VictoryChart>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.