How to display several graphs which have common X Axis using ZedGraph library?
Asked Answered
R

1

9

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.

enter image description here

Readjustment answered 6/7, 2011 at 14:14 Comment(2)
Have you taken a thorough look at the documentation for your version? See here: sourceforge.net/projects/zedgraph/files/…Circuitous
I have, but I didn't find what I need.Readjustment
M
7

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:

enter image description here

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.

Mckinleymckinney answered 20/9, 2011 at 8:7 Comment(2)
Thank you. Now, I have several options to consider. BTW, Russian is my native language, so the first link definitely rocks :)Readjustment
@Peter17: yeah, this is a really cool ZedGraph cheatsheet, much more useful than official docsMckinleymckinney

© 2022 - 2024 — McMap. All rights reserved.