NitinG
NitinG

Reputation: 923

ZedGraph: Changing behavior of Set Scale to Default

I have plotted few graphs using ZedGraphs. Now, i have an option that user can plot some graphs using different check boxes a can remove them as well. But, i am not scaling the graph when user makes those graphs as i don't want to change the look of the graphs.

Now, if the user zooms and then click to the Set Scale to Default, the graphs got reset as there is a call to AxisChange() i guess.

But, i want the original look of the graphs that i have plotted and not the default view which changes the view completely.

S, is there any way where i can change the behavior of the Set Scale to Default functionality?

Upvotes: 2

Views: 2134

Answers (1)

SanVEE
SanVEE

Reputation: 2070

You have 2 options to try with,

  1. Get rid off the default context menu item(Set Scale to Default) & add your own custom context menu item.

    In-order to remove:

    private void zedGraphControl1_ContextMenuBuilder(
        ZedGraphControl sender, ContextMenuStrip menuStrip, 
        Point mousePt, ZedGraphControl.ContextMenuObjectState objState)
    {
        foreach (ToolStripMenuItem item in menuStrip.Items)
        {
            if ((string)item.Tag == "set_default")
            {
                menuStrip.Items.Remove(item);
                break;
            }
         }
    }
    

    and to add a new item: http://www.smallguru.com/2009/06/zedgraph-csharp-graph-data-export-to-cs/

  2. Edit the source code (It's a bit tricky but do-able)

    I don't see any easy way to change the behavior of the pre-build options.

Upvotes: 4

Related Questions