mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
68.75k stars 6.08k forks source link

XY-chart should default to 0 being the origin #5618

Open RichardJECooke opened 3 days ago

RichardJECooke commented 3 days ago

Description

This is a statistical bug, not a code bug.

Charts should always have 0 as the origin except under extremely rare circumstances. Having the Y-axis default to the range of the chart values, instead of starting from zero, completely visually misrepresents the difference between series.

The example chart should be changed too - https://mermaid.js.org/syntax/xyChart.html

Steps to reproduce

Dark anti-pattern stats:

xychart-beta
    title "Non-blank lines of code per SDK"
    x-axis [OG, SE]   
    bar [6722, 3316]

Honest stats:

xychart-beta
    title "Non-blank lines of code per SDK"
    x-axis [OG, SE]
    y-axis 0 --> 6722
    bar [6722, 3316]

Screenshots

No response

Code Sample

xychart-beta
    title "Non-blank lines of code per SDK"
    x-axis [OG, SE]   
    bar [6722, 3316]

```text
xychart-beta
    title "Non-blank lines of code per SDK"
    x-axis [OG, SE]
    y-axis 0 --> 6722
    bar [6722, 3316]


### Setup

- Mermaid version:
- Browser and Version: [Chrome, Edge, Firefox]

### Suggested Solutions

_No response_

### Additional Context

_No response_