Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

195
Views
How to stop victory axis behave differently when there are 0 values?

If you go to the first example demonstration here, with code:

<VictoryChart
  theme={VictoryTheme.material}
  domainPadding={10}
>
  <VictoryBar
    style={{ data: { fill: "#c43a31" } }}
    data={sampleData}
  />
</VictoryChart>

you see that the bars are looking good, aligned nicely:

enter image description here

But once you change the code like this (adding a data point with a 0 x value):

<VictoryChart
  theme={VictoryTheme.material}
  domainPadding={10}
>
  <VictoryBar
    style={{ data: { fill: "#c43a31" } }}
    data={[{x: 0, y: 2}, ...sampleData]}
  />
</VictoryChart>

You see that the new bar is going weird. I sort of get it why it's like this. If negative values would be present, then they would be shown to the left from the y axis. But I find it very frustrating that I couldn't find a way to turn this off, and handle 0, or even negative values like positive ones, and just show the axis on the left always.

I'm using custom VictoryAxis, and tried different domainPaddings, played with singleQuadrantDomainPadding, but nothing worked.

enter image description here

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!