I need to display several graphs which have a common X Axis and a legend. What I want to achieve is displayed on the picture. The main goal is to have several Y Axis on the one line, not paralelly. So, several curves can be displayed without intersection with each other.
I know how to display several graphs, but then each of them has its own legend and Y Axis.
I worked with ZedGraph in two of my projects and it doesn't seem to support this feature. Basically, you have two options at this point:
1. Use another plotting library
If you don't have a lot of things depending on ZedGraph already, maybe it's not too late for switching to another plotting control. I worked with this library (CodeProject link), and it has a decent look and support for stacked graphs:
It's less feature-rich compared to ZedGraph, but if 2d-plotting is all you really need, you should probably give it a try.
2. Cheat by creating multiple ZedGraph panes
You can make all your graphs panes have the same width and the same zoom. By setting IsSynchronizeXAxes
property to true you make sure that all the panes on ZedGraph control have their X-Axes synchronized automatically.
There are few useful articles to help you achieve the effect you want. Although in Russian, they provide code samples and illustrations and should be of use even without understanding the comments.
You should also hide X-axis and everything else that you don't need. Single legend is tricky but can be achieved by only showing a legend for the topmost graph and adding fake dummy curves with no points to this graph to populate the legend.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With