コード例 #1
0
        private void UpdatePlot()
        {
            if (TestBench.Steps.Count == 0)
            {
                return;
            }

            var animationAxis = new PlotAxis
            {
                Max       = TestBench.MaxVoltage.Volts,
                Min       = TestBench.MinVoltage.Volts,
                MajorSpan = TestBench.StepSize.Volts,
                Title     = "Bias (V)"
            };

            PlotGroup = new PlotAnimationGrouping(animationAxis,
                                                  d => CreatePlot(TestBench.GetStep(new ElectricPotential(d))));

            NeedsScreenshot = true;
        }
コード例 #2
0
ファイル: Plot.cs プロジェクト: ryanthompson0123/BandDiagram
        public PlotAnimationGrouping(PlotAxis animationAxis, Func <double, Plot> provider)
        {
            AnimationAxis = animationAxis;

            Plots = Enumerable.Range(0, animationAxis.MajorTickCount)
                    .Select(s => s * animationAxis.MajorSpan + animationAxis.Min)
                    .Select(provider)
                    .ToList();

            var allXBounds = Plots.Select(p => p.XAxis).ToList();
            var allYBounds = Plots.Select(p => p.YAxis).ToList();

            var xMax  = Math.Ceiling(allXBounds.Max(b => b.Max));
            var xMin  = Math.Floor(allXBounds.Min(b => b.Min));
            var xTick = Plots[0].XAxis.MajorSpan > 0 ?
                        Plots[0].XAxis.MajorSpan : Plot.CalculateSpanForBestFit(xMax, xMin, 1.0);

            XAxis = new PlotAxis
            {
                AxisType  = AxisType.X,
                Max       = xMax,
                Min       = xMin,
                MajorSpan = xTick,
                Title     = Plots[0].XAxis.Title
            };

            var yMax  = Math.Ceiling(allYBounds.Max(b => b.Max));
            var yMin  = Math.Floor(allYBounds.Min(b => b.Min));
            var yTick = Plots[0].YAxis.MajorSpan > 0 ?
                        Plots[0].YAxis.MajorSpan : Plot.CalculateSpanForBestFit(yMax, yMin, 1.0);

            YAxis = new PlotAxis
            {
                AxisType  = AxisType.PrimaryY,
                Max       = yMax,
                Min       = yMin,
                MajorSpan = yTick,
                Title     = Plots[0].YAxis.Title
            };
        }
コード例 #3
0
ファイル: Plot.cs プロジェクト: ryanthompson0123/BandDiagram
 public Plot(List <PlotDataSet> dataSets)
 {
     DataSets = new ObservableCollection <PlotDataSet>(dataSets);
     XAxis    = new PlotAxis();
     YAxis    = new PlotAxis();
 }