Skip to content

Conversation

@Laccolith
Copy link

I noticed that a stacked graph with the yaxis being set to auto will get clamped to the max value in the series, rather then the sum of the values. This change fixed it for me, but I'm new to using the graph, so let me know if this may cause any issues.

Before
CaptureBefore

After
Capture

Laccolith and others added 2 commits April 27, 2022 18:50
Fix for stacked graphs with auto yaxis heights being limited in height to the max value
@vingerha
Copy link
Contributor

vingerha commented Sep 3, 2025

I looked at this code and it works in quite a few cases but not all, e.g. not with negative stacks. The base code returns the max of each of the series but it should not reduce those values > 0 with same-timestamp-stacked values < 0.

Added to thsi, it is a tricky thing as one requires to know the values on the timestamp, e.g. when you have three series with values on 3 different timestamps, e.g. (100,1,1) and (1,101,1) and (1,1,102) then the yaxis max should be roughly 105 but not 100+101+102...but it should be 305 when they are on the same timestamp

@TheSerapher
Copy link

Just found this PR while checking for issues since I have the same problem. And it's exactly as @vingerha mentions, my graph shows negative stacks and also shows the wrong scaling issue. Thanks for looking into this, it's not a major bother for me but getting it fixed would be awesome :)

@vingerha
Copy link
Contributor

vingerha commented Sep 5, 2025

There is an alternative and not sure if/how this will be built-in to simplify things for the user
By not (!) using yaxis on root-level but under apex_config and using the seriesName to refer to the individual series. In this situation the id of the yaxis entry and yaxis_id in the series have no value (ignore from the picture below).
In the apex_config setup a soft-limit, alike |-1| is not possible, thsi can be done via a function though

      min: |
        EVAL: function(min) { return Math.round(min)-1 }
image

What I donot like is that one of the right yaxis does not start at the 0 of the left one. This configuration behavior is (almost) fully due to the underlying (external) library apexcharts.js, maybe it can be improved but have not had time to dive deeper

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants