public async Task Plot(PlotMessage plot, CancellationToken ct) { await Console.Error.WriteLineAsync(plot.FilePath); }
public Task Plot(PlotMessage plot, CancellationToken ct) { PlotResult = plot.Data; return(Task.CompletedTask); }
/// <summary> /// Displays R plot in the host app-provided window /// </summary> public Task Plot(PlotMessage plot, CancellationToken ct) => _workflow.Plots.LoadPlotAsync(plot, ct);
public async Task LoadPlotAsync(PlotMessage plot, CancellationToken cancellationToken) { await _shell.SwitchToMainThreadAsync(cancellationToken); var device = FindDevice(plot.DeviceId); device.DeviceNum = plot.DeviceNum; if (plot.IsClearAll) { device.Clear(); } else if (plot.IsPlot) { try { var img = plot.ToBitmapImage(); // Remember the size of the last plot. // We'll use that when exporting the plot to image/pdf. device.PixelWidth = img.PixelWidth; device.PixelHeight = img.PixelHeight; device.Resolution = (int)Math.Round(img.DpiX); device.AddOrUpdate(plot.PlotId, img); } catch (Exception e) when (!e.IsCriticalException()) { } } else if (plot.IsError) { device.AddOrUpdate(plot.PlotId, null); } var visualComponent = GetVisualComponentForDevice(plot.DeviceId); if (visualComponent != null) { visualComponent.Container.Show(focus: false, immediate: false); visualComponent.Container.UpdateCommandStatus(false); } }