Example #1
0
        public override void Run(GraphController ctrl)
        {
            ctrl.Doc.RootLayer.IsValidIndex(ctrl.CurrentLayerNumber, out var activeLayer);

            if (!(activeLayer is XYPlotLayer))
            {
                return;
            }

            FunctionEvaluationScript script = null; //

            if (script == null)
            {
                script = new FunctionEvaluationScript();
            }

            object[] args = new object[] { script, new ScriptExecutionHandler(EhScriptExecution) };
            if (Current.Gui.ShowDialog(args, "Function script"))
            {
                ctrl.EnsureValidityOfCurrentLayerNumber();

                script = (FunctionEvaluationScript)args[0];
                var functItem = new XYFunctionPlotItem(new XYFunctionPlotData(script), new G2DPlotStyleCollection(LineScatterPlotStyleKind.Line, activeLayer.GetPropertyContext()));
                ((XYPlotLayer)activeLayer).PlotItems.Add(functItem);
            }
        }
Example #2
0
        public override void Run(Altaxo.Graph.GUI.GraphController ctrl)
        {
            FunctionEvaluationScript script = null; //

            if (script == null)
            {
                script = new FunctionEvaluationScript();
            }

            object[] args = new object[] { script, new ScriptExecutionHandler(this.EhScriptExecution) };
            if (Current.Gui.ShowDialog(args, "Function script"))
            {
                ctrl.EnsureValidityOfCurrentLayerNumber();

                script = (FunctionEvaluationScript)args[0];
                XYFunctionPlotItem functItem = new XYFunctionPlotItem(new XYFunctionPlotData(script), new G2DPlotStyleCollection(LineScatterPlotStyleKind.Line));
                ctrl.Doc.Layers[ctrl.CurrentLayerNumber].PlotItems.Add(functItem);
            }
        }