I kinda solved this problem, unfortuntely I did not have time to do it in a completely generic fashion.
You are welcome to use any of the follwing to make it generic and add it to Oxyplot though!
Background:
My graph contains 4 y-axis, 2 on each side.
Implementation:
I first had to decide how many major grid lines I was going to use for all the axes.
In my case, I constrained it to 20, because it works out well enough.
But one Idea I had that I never had time to implement was to let oxyplot create the axis natuarally by it self,
then find the one which naturally had the most grid marks and use that number of gridmarks as my gridmarkCount.
Then I had to make sure each axis started on a value and ended on a value, so first grid mark is always at the very bottom and last gridmark is always at the very top. This is simple enough if you set the minimum and maxium values to proper values.
Then I had to calculate a gridStep value that was evenly divisible by (maximum - minumum) / gridmarkCount.
This can be a bit tricky because the step values have to follow 1, 2, 5 , 10 etc, but its doable.
Finally, I needed a function to simply add x amount of gridSteps to the maximum of all other axis except the main, to make sure we ended up with gridmarkCount.
In my specific example it worked out like this:
- MainAxis predetermined, not dynamic.
- GridmarkCount = 20, not dynamic.
- Minimum and Maximum always are 0 and 100 on my main axis, not dynamic.
- Thus gridmarkStep becomes 5 on my main axis.
- Calculate minimum and maximum for all other axis.
If other axis turned out to have less than 20 gridmarks, I simply added x gridSteps to the maximum, thus changing the maximum until that axis gridmarkcount became 20. -
Ensure each axis has an appropriate minimum and maximum to ensure first value is the absolute bottom and highest value is at the absolute top.
Hope this helps somehow!