Search code examples
c#zedgraph

How to make ZedGraph bars overlap?


For a particular task, I need bars on my bar graph to overlap. Currently, if two bars from two different data sets have the same x value, they are set apart from each other instead of both originating at the actual x value.

How can I force ZedGraph to add bars that land exactly on their x values, even if there is more than one bar with the same x value. When they're separated, they're not even moved from the actual x value by the same amount, so it just looks really bad.

Thanks.


Solution

  • The default format for bar charts is BarType.Cluster, but it seems you probably want BarType.Overlay.

    Try setting the following property:

    zedGraphControl1.GraphPane.BarSettings.Type = BarType.Overlay;
    

    Reference: Zedgraph at CodeProject