private void bConnect_Click(object sender, EventArgs e) { gbR.Visible = false; gbRFunctionInfo.Visible = false; gbGetData.Visible = false; btGraphic.Visible = false; lbCurrRFunction.Visible = false; lbUsingRFunction.Visible = false; tsConnected.Text = "Not connected"; bool connectedtatus = true; if (cbPIServersList.Text == string.Empty) { connectedtatus = MyApp.Connect(null); } else { connectedtatus = MyApp.Connect(cbPIServersList.Text); } if (connectedtatus == true) { tsConnected.Text = "Connected to " + MyApp.GetPIServerName(); MyApp.ProgramCurrentStep = 0; tsProgressBar.Value = 25; cbPIServersList.Text = MyApp.GetPIServerName(); gbR.Visible = true; } else { tsConnected.Text = "Not Connected"; MessageBox.Show("Could not connect to " + MyApp.GetPIServerName()); } }
public IHttpActionResult Execute() { REngine _engine = REngine.GetInstance(null, true, null, null); SvgGraphicsDevice GraphicsDevice = new SvgGraphicsDevice(new SvgContextMapper(700, 700, SvgUnitType.Pixel, null)); _engine.Initialize(); _engine.Install(GraphicsDevice); RApplication app = new RApplication(_engine); app.DataAccessMethod = "PIAFSDK"; app.Connect("MARC-PI2016"); app.RFunction = "PI Histogram"; app.NumTags = 1; app.Mode = "Interpolated"; var tag1 = "FAC.OAK.Weather-Outside_Temperature-Val.PV"; var tag2 = "FAC.OAK.Weather-Inside_Temperature-Val.PV"; var tag3 = "FAC.OAK.Weather-Inside_Humidity-Val.PV"; var tag4 = "FAC.OAK.Weather-Outside_Humidity-Val.Pv"; var tag5 = "FAC.OAK.Power-Total_Demand_Calc.PV"; app.GetPIData(tag1, tag2, tag3, tag4, tag5, "1-Oct-2012", "1-Nov-2012", "1h"); app.GenerateGhaphic("5", "0", "1", ""); //GraphicsDevice.ClearImages(); //var evaluated = statements.Select(_engine.Evaluate).ToList(); var plots = GraphicsDevice.GetImages().Select(RenderSvg).ToList(); return(Ok(plots)); }