Esempio n. 1
0
        private void Construct()
        {
            FittingCurve = new ScanCurveBase <Point>
            {
                Suffix = "Fitting"
            };
            FittingCurve.LineStyle.Thickness = 1;
            FittingCurve.LineStyle.DashStyle = new DashStyle(new double[] { 1, 5 }, 0);

            MaxPowerConstantLine = new ScanCurveBase <Point>
            {
                Suffix  = "Max",
                Visible = false
            };
            MaxPowerConstantLine.LineStyle.Thickness = 1;
            MaxPowerConstantLine.LineStyle.DashStyle = new DashStyle(new double[] { 1, 5 }, 0);

            this.CollectionChanged += ((s, e) =>
            {
                if (e.Action == NotifyCollectionChangedAction.Reset)
                {
                    FittingCurve.Clear();
                    FittingCurve.Visible = false;

                    MaxPowerConstantLine.Clear();
                    MaxPowerConstantLine.Visible = false;
                }
            });

            // generate some fake points to debug
            Random r      = new Random((int)DateTime.Now.Ticks);
            var    offset = r.NextDouble();

            for (double i = -2; i < 2; i += 0.2)
            {
                this.Add(new Point(i, GaussianDistribution.Invoke(i, 1, offset + r.NextDouble() / 10)));
            }

            FindMaximalPosition();

            X_Title = "X轴";
            Y_Title = "Y轴";
        }