Zed-Graph Set scale to default programmatically

会有一股神秘感。 提交于 2019-12-23 12:07:56

问题


I've got a winforms application which uses zed-graph library to plot graphs. When I right-click on the control (while application is running) a context menu shows up and I can choose Set Scale to default.
How do I achive this Set Scale to default-behaviour programmatically?


回答1:


For each x- and y-axis following code is executed:

_scale._minAuto = true;
_scale._maxAuto = true;
_scale._majorStepAuto = true;
_scale._minorStepAuto = true;
_crossAuto = true;
_scale._magAuto = true;
_scale._formatAuto = true;

For more information easily look in the source code and search for "Set Scale to default".




回答2:


As of 2014, I couldn't get the above solution to work in VS2008, C#. But I succeeded doing the following:

    private void frmGraph_VisibleChanged(object sender, EventArgs e)
    {
        ZGraphComponent.RestoreScale(ZGraph.GraphPane);
    }

In the "VisibleChanged" event handler for the window containing the graph component, I call the "RestoreScale" method on the graph component, passing the main graph pane as the argument.



来源:https://stackoverflow.com/questions/7834604/zed-graph-set-scale-to-default-programmatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!