Skip to content

Is there a way to set the Y axis in a line chart to start from 0? #2

Answered by rokotyan
rokotyan asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can set the Y axis range (or the Y scale domain in D3 terms) for all XY components (Line, Area, Scatter, etc ...) by setting the yDomain property of XYContainer.

Here's an example in React:

<VisXYContainer yDomain={[0, undefined]} ...>
  <VisLine ... >
</VisXYContainer>

The yDomain value of [0, undefined] means that the lower limit will be 0 and the upper limit will be determined automatically based on the data.

You can read more about controlling the chart's scales in the documentation: https://unovis.dev/docs/xy-charts/Container#ydomain

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rokotyan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested
1 participant