如何连接两个图表,以便一个复制另一个图表的行为?在C#中 [英] How to connect two charts so that one replicates the behavior of the other? In C#

查看:88
本文介绍了如何连接两个图表,以便一个复制另一个图表的行为?在C#中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近大家好,我正在处理一些图表。为了做到这一点,我使用ZedGraphControl库。我用ZedGraphControl创建了两个图表,我想连接这两个图表,例如,如果我放大或滚动第一个ZedGraphControl,那么第二个ZedGraphControl必须执行相同的操作。任何帮助将不胜感激。



我尝试过:



 ZedGraph.ZedGraphControl zedGraphControl1 = new ZedGraph.zedGraphControl1(); 
ZedGraph.ZedGraphControl zedGraphControl2 = new ZedGraph.zedGraphControl2();
private void InitializeEvents()
{
zedGraphControl1.ZoomEvent + = ZedGraphControl1_ZoomEvent;
zedGraphControl2.ZoomEvent + = ZedGraphControl2_ZoomEvent;
}

private void ZedGraphControl1_ZoomEvent(ZedGraph.ZedGraphControl sender,ZedGraph.ZoomState oldState,ZedGraph.ZoomState newState)
{
double zoomFraction = sender.ZoomStepFraction;
PointF centerPt = this.deviceControl1.mousePt;
ZedGraph.GraphPane pane = sender.MasterPane.FindChartRect(centerPt);

//this.deviceControl2.zedGraphControl1.ZoomS

// ZoomPane(pane,zoomFraction,centerPt,this.deviceControl1.zedGraphControl1.IsZoomOnMouseCenter);
}

private void ZedGraphControl2_ZoomEvent(ZedGraph.ZedGraphControl sender,ZedGraph.ZoomState oldState,ZedGraph.ZoomState newState)
{

}

解决方案

c# - Scrollviewer inside一个Viewbox? - 堆栈溢出 [ ^ ]

Hello everyone recently I am working on the some chart. In order to do this I am using the ZedGraphControl library. I have created two charts with ZedGraphControl and I want to connect these two charts, for instance, if I zoom in or scroll the first ZedGraphControl then second ZedGraphControl has to do the same action. Any help would be appreciate.

What I have tried:

ZedGraph.ZedGraphControl zedGraphControl1 = new ZedGraph.zedGraphControl1();
ZedGraph.ZedGraphControl zedGraphControl2 = new ZedGraph.zedGraphControl2();
private void InitializeEvents()
        {
            zedGraphControl1.ZoomEvent += ZedGraphControl1_ZoomEvent;
            zedGraphControl2.ZoomEvent += ZedGraphControl2_ZoomEvent;
        }

private void ZedGraphControl1_ZoomEvent(ZedGraph.ZedGraphControl sender, ZedGraph.ZoomState oldState, ZedGraph.ZoomState newState)
        {
            double zoomFraction = sender.ZoomStepFraction;
            PointF centerPt = this.deviceControl1.mousePt;
            ZedGraph.GraphPane pane = sender.MasterPane.FindChartRect(centerPt);

            //this.deviceControl2.zedGraphControl1.ZoomS

            //ZoomPane(pane, zoomFraction, centerPt, this.deviceControl1.zedGraphControl1.IsZoomOnMouseCenter);
        }

        private void ZedGraphControl2_ZoomEvent(ZedGraph.ZedGraphControl sender, ZedGraph.ZoomState oldState, ZedGraph.ZoomState newState)
        {

        }

解决方案

c# - Scrollviewer inside a Viewbox? - Stack Overflow[^]


这篇关于如何连接两个图表,以便一个复制另一个图表的行为?在C#中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆