This solution does not work.
I have a bar chart that can display multiple traces of data. I have an user interface built around this bar chart that allows an end user to switch between grouped and stacked modes.
For grouped mode:
The solution you mentioned above will work to an extent. I get the max value from each trace and add 1. Although I want the ticks between the first and last tick to be plotted as whole integers. So this, to the best of my knowledge, requires intensive conditional logic to determine a valid dtick value.
For stacked mode:
In stack mode your solution will simply not work. We need to calculate the max by adding the elements from each respective index from each of our traces. So if we have two traces to be plotted on a bar chart in stacked mode; we would need to add traceOne + traceTwo and traceOne + traceTwo etc, push all these values to a new array then get the max from this new array then perform our conditional logic mentioned above to set the dticks value.
So as you can see, as simple as your solution is, it becomes very intensive in my use case. We have many more use cases where this is applicable.
My question was: Is there any simpler way of telling Plotly you want to see max + n?
I know post render (after you call Plotly.newPlot()) you can access properties for the plot such as max and min values as well as many more. I’m just hesitant to be performing these calculations more than required.
@Chiaki, please either take a step back and try to look at things from our perspective or just leave this discussion as copying and pasting the first link you find from a google search is counter intuitive at this stage. I’m quite capable of doing so myself. Don’t be so patronising. Thanks for your input thus far regardless.
Your help is much appreciated.