private void PlotConstantFunction(IChartAdapter2D adapter, Explicit2DParameters explicitParameters) { ConstantFunctionPlotter plotter = new ConstantFunctionPlotter((Constant)explicitParameters.Function); double[] result = null; switch (explicitParameters.PlotMode) { case PlotMode.ByNumPoints: result = plotter.Plot(explicitParameters.Min, explicitParameters.Max, explicitParameters.NumPoints); break; //case PlotMode.ByClientArea: // throw new NotSupportedException("This type of PlotMode not supported"); case PlotMode.ByStep: result = plotter.Plot(explicitParameters.Min, explicitParameters.Max, explicitParameters.Step); break; } if (!_automaticMode) { double[] tempArray = (double[])result.Clone(); Array.Sort(tempArray); double min = tempArray[0]; Array.Reverse(tempArray); double max = tempArray[0]; adapter.SetAxes(explicitParameters.Min, explicitParameters.Max, min, max); } adapter.Plot(result, _series); }
private void PlotParametric2DFunction(IChartAdapter2D adapter, Parametric2DParameters parametricParameters) { Parameter2DFunctionPlotter plotter = new Parameter2DFunctionPlotter((Parameter2DFunction)parametricParameters.Function); Point2D[] result = null; switch (parametricParameters.PlotMode) { case PlotMode.ByNumPoints: result = plotter.Plot(parametricParameters.Min, parametricParameters.Max, parametricParameters.NumPoints); break; //case PlotMode.ByClientArea: // throw new NotSupportedException("This type of PlotMode not supported"); case PlotMode.ByStep: result = plotter.Plot(parametricParameters.Min, parametricParameters.Max, parametricParameters.Step); break; } if (!_automaticMode) { if (adapter.MinY != 0 && adapter.MaxY != 0) { adapter.SetAxes(parametricParameters.Min, parametricParameters.Max, adapter.MinY, adapter.MaxY); } } adapter.Plot(result, _series); }
private void PlotConstantFunction(IChartAdapter2D adapter, Implicit2DParameters implicitParameters) { ConstantFunctionPlotter plotter = new ConstantFunctionPlotter((Constant)implicitParameters.Function); double[] result = null; //result = plotter.Plot() adapter.Plot(result, _series); }
private void PlotExplicitFunction(IChartAdapter2D adapter, Implicit2DParameters implicitParameters) { Explicit2DFunctionPlotter plotter = new Explicit2DFunctionPlotter((Explicit2DFunction)implicitParameters.Function); double[] result = null; plotter.Plot(implicitParameters.PointA, implicitParameters.PointB, implicitParameters.AreaSize); adapter.Plot(result, _series); }
private void PlotImplicit2DFunction(IChartAdapter2D adapter, Implicit2DParameters implicitParameters) { Implicit2DFunctionPlotter plotter = new Implicit2DFunctionPlotter((Implicit2DFunction)implicitParameters.Function); plotter.GridFactor = implicitParameters.GridFactor; Point2D[] resultPoints = plotter.Plot( implicitParameters.PointA, implicitParameters.PointB, implicitParameters.AreaSize); adapter.SetAxes(implicitParameters.PointA.X, implicitParameters.PointB.X, implicitParameters.PointA.Y, implicitParameters.PointB.Y); adapter.Plot(resultPoints, _series); }
private void PlotImplicit2DFunction(IChartAdapter2D adapter, Implicit2DParameters implicitParameters) { Implicit2DFunctionPlotter plotter = new Implicit2DFunctionPlotter((Implicit2DFunction)implicitParameters.Function); plotter.GridFactor = implicitParameters.GridFactor; Point2D[] resultPoints = plotter.Plot( implicitParameters.PointA, implicitParameters.PointB, implicitParameters.AreaSize); adapter.SetAxes(implicitParameters.PointA.X, implicitParameters.PointB.X, implicitParameters.PointA.Y, implicitParameters.PointB.Y); adapter.Plot(resultPoints, _series); }
private void PlotConstantFunction(IChartAdapter2D adapter, Explicit2DParameters explicitParameters) { ConstantFunctionPlotter plotter = new ConstantFunctionPlotter((Constant)explicitParameters.Function); double[] result = null; switch(explicitParameters.PlotMode) { case PlotMode.ByNumPoints: result = plotter.Plot(explicitParameters.Min, explicitParameters.Max, explicitParameters.NumPoints); break; //case PlotMode.ByClientArea: // throw new NotSupportedException("This type of PlotMode not supported"); case PlotMode.ByStep: result = plotter.Plot(explicitParameters.Min, explicitParameters.Max, explicitParameters.Step); break; } if (!_automaticMode) { double[] tempArray = (double[])result.Clone(); Array.Sort(tempArray); double min = tempArray[0]; Array.Reverse(tempArray); double max = tempArray[0]; adapter.SetAxes(explicitParameters.Min, explicitParameters.Max, min, max); } adapter.Plot(result, _series); }
private void PlotConstantFunction(IChartAdapter2D adapter, Implicit2DParameters implicitParameters) { ConstantFunctionPlotter plotter = new ConstantFunctionPlotter((Constant)implicitParameters.Function); double[] result = null; //result = plotter.Plot() adapter.Plot(result, _series); }
private void PlotParametric2DFunction(IChartAdapter2D adapter, Parametric2DParameters parametricParameters) { Parameter2DFunctionPlotter plotter = new Parameter2DFunctionPlotter((Parameter2DFunction)parametricParameters.Function); Point2D[] result = null; switch(parametricParameters.PlotMode) { case PlotMode.ByNumPoints: result = plotter.Plot(parametricParameters.Min, parametricParameters.Max, parametricParameters.NumPoints); break; //case PlotMode.ByClientArea: // throw new NotSupportedException("This type of PlotMode not supported"); case PlotMode.ByStep: result = plotter.Plot(parametricParameters.Min, parametricParameters.Max, parametricParameters.Step); break; } if (!_automaticMode) { if (adapter.MinY != 0 && adapter.MaxY != 0) adapter.SetAxes(parametricParameters.Min, parametricParameters.Max, adapter.MinY, adapter.MaxY); } adapter.Plot(result, _series); }
private void PlotExplicitFunction(IChartAdapter2D adapter, Implicit2DParameters implicitParameters) { Explicit2DFunctionPlotter plotter = new Explicit2DFunctionPlotter((Explicit2DFunction)implicitParameters.Function); double[] result = null; plotter.Plot(implicitParameters.PointA, implicitParameters.PointB, implicitParameters.AreaSize); adapter.Plot(result, _series); }
/// <summary> /// Plot with new source and new destination chart /// </summary> /// <exception cref="System.ArgumentNullException" caption="ArgumentNullException">Chart control or FunctionParameters cannot be null</exception> /// <exception cref="System.ArgumentException" caption="ArgumentException">Code or Formula of source cannot be empty</exception> /// <exception cref="System.NotSupportedException" caption="NotSupportedException">Chart not supported</exception> /// <example> /// <code lang="CS" description="The following example plot given function on given chart"> /// NugenCCalcComponent2D nugenCCalcComponent1 = new NugenCCalcComponent2D(); /// nugenCCalcComponent1.Plot(c1Chart, new Explicit2DParameters("x*x")); /// </code> /// </example> public void Plot(object chartControl, Function2DParameters functionParameters) { if (DesignMode) { return; } OnBeforePlot(); if (chartControl == null) { throw new ArgumentNullException("ChartControl"); } if (functionParameters == null) { throw new ArgumentNullException("functionParameters"); } if (functionParameters.Code == "") { throw new ArgumentException("Code or Formula of source cannot be empty"); } IChartAdapter2D adapter = null; if (chartControl != _chartControl) { adapter = (IChartAdapter2D)GetChartAdapter(chartControl); adapter.SetChartControl(chartControl); } else { adapter = (IChartAdapter2D)_currentAdapter; } if (adapter == null) { throw new NotSupportedException("Chart not supported"); } Function function = functionParameters.Function; if (function is Constant) { if (functionParameters is Explicit2DParameters) { PlotConstantFunction(adapter, (Explicit2DParameters)functionParameters); } if (functionParameters is Implicit2DParameters) { PlotConstantFunction(adapter, (Implicit2DParameters)functionParameters); } } if (function is Explicit2DFunction) { if (functionParameters is Explicit2DParameters) { PlotExplicitFunction(adapter, (Explicit2DParameters)functionParameters); } if (functionParameters is Implicit2DParameters) { PlotExplicitFunction(adapter, (Implicit2DParameters)functionParameters); } } if (function is Implicit2DFunction) { PlotImplicit2DFunction(adapter, (Implicit2DParameters)functionParameters); } if (function is Parameter2DFunction) { PlotParametric2DFunction(adapter, (Parametric2DParameters)functionParameters); } OnAfterPlot(); }