简体   繁体   English

在多个面板 winform c# 中显示多个 R Embedded Graph

[英]display multiple R Embedded Graph in multiple panel winform c#

I want to show multiple graphs from R that embedded in winform c# using R.NET.我想使用 R.NET 显示嵌入在 winform c# 中的 R 中的多个图形。 I have two forms.我有两种形式。 Form 1 consist of multiple panels and form 2 consist of some parameters based on user input.表格 1 由多个面板组成,表格 2 由一些基于用户输入的参数组成。 My scenario, after user input the parameter then graph will show in panels at form 1 not in popup window.我的场景,在用户输入参数后,图形将显示在表单 1 的面板中,而不是在弹出窗口中。 I have tried some code that I got from https://rdotnet.codeplex.com/workitem/7 or https://peterdaidinh.wordpress.com/2014/09/29/displaying-an-r-graph-within-ac-net-winform/ they're good in showing graph embedded in the form but only in one panel so multiple graphs will show only in one panel.My question is how to show multiple embedded graphs in multiple panels.我尝试了一些从https://rdotnet.codeplex.com/workitem/7https://peterdaidinh.wordpress.com/2014/09/29/displaying-an-r-graph-within-ac获得的代码-net-winform/他们擅长显示嵌入在表单中的图形,但只显示在一个面板中,因此多个图形将只显示在一个面板中。我的问题是如何在多个面板中显示多个嵌入的图形。 Here is my code at form2:这是我在form2的代码:

    namespace RNETGraph

{public partial class RGraphForm : Form
{
    private readonly RGraphAppHook cbt;
    REngine engine;

    public RGraphForm()
    {
        InitializeComponent();
        engine = REngine.GetInstance();

    }

    private void btnShowGraph_Click(object sender, EventArgs e)
    {
        Panel pan2 = data.getPanel2();
        RGraphAppHook cbt1 = new RGraphAppHook { GraphControl = pan2 };
        cbt1.Install();
        engine.Evaluate("plot(rnorm(100))");
        cbt1.Uninstall();

        Panel pan1 = data.getPanel1();
        RGraphAppHook cbt = new RGraphAppHook { GraphControl = pan1 };
        cbt.Install();
        engine.Evaluate("plot(rnorm(500))");
        cbt.Uninstall();
    }     
}}

Open a new graphics window using win.graph() or dev.new() :使用win.graph()dev.new()打开一个新的图形窗口:

cbt.Install();
engine.Evaluate("win.graph()");    
engine.Evaluate("plot(rnorm(500))");
cbt.Uninstall();

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM