コード例 #1
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.Title("Crosshair with DateTime Axis");
            plt.XLabel("Horizontal Axis");
            plt.YLabel("Vertical Axis");

            // plot DateTime data
            int    pointCount = 100;
            Random rand       = new Random(0);

            double[]   values = ScottPlot.DataGen.RandomWalk(rand, pointCount);
            DateTime[] dates  = Enumerable.Range(0, pointCount)
                                .Select(x => new DateTime(2016, 06, 27).AddDays(x))
                                .ToArray();
            double[] xs = dates.Select(x => x.ToOADate()).ToArray();
            plt.AddScatter(xs, values);

            // add a crosshair
            var ch = plt.AddCrosshair(xs[50], values[50]);

            // indicaite horizontal axis is DateTime and give a proper DateTime format string
            // https://docs.microsoft.com/en-us/dotnet/standard/base-types/custom-date-and-time-format-strings
            ch.VerticalLine.PositionFormatter = pos => DateTime.FromOADate(pos).ToString("d");

            // use a numeric vertical axis but customize the format string
            // https://docs.microsoft.com/en-us/dotnet/standard/base-types/standard-numeric-format-strings
            ch.VerticalLine.PositionFormatter = pos => pos.ToString("F4");
        }
コード例 #2
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.AddSignal(ScottPlot.DataGen.Sin(51));
            plt.AddSignal(ScottPlot.DataGen.Cos(51));
            plt.AddCrosshair(42, 0.48);

            plt.Title("Crosshair Demo");
            plt.XLabel("Horizontal Axis");
            plt.YLabel("Vertical Axis");
        }
コード例 #3
0
ファイル: Crosshair.cs プロジェクト: whble/ScottPlot
        public void ExecuteRecipe(Plot plt)
        {
            plt.AddSignal(ScottPlot.DataGen.Sin(51));
            plt.AddSignal(ScottPlot.DataGen.Cos(51));
            var ch = plt.AddCrosshair(42, 0.48);

            ch.IsVisibleX = false;

            plt.Title("Crosshair on One Axis Only");
            plt.XLabel("Horizontal Axis");
            plt.YLabel("Vertical Axis");
        }
コード例 #4
0
ファイル: Crosshair.cs プロジェクト: whble/ScottPlot
        public void ExecuteRecipe(Plot plt)
        {
            plt.Title("Customized Crosshair");
            plt.XLabel("Horizontal Axis");
            plt.YLabel("Vertical Axis");

            plt.AddSignal(ScottPlot.DataGen.Sin(51));
            plt.AddSignal(ScottPlot.DataGen.Cos(51));

            var ch = plt.AddCrosshair(42, 0.48);

            ch.LabelBackgroundColor = System.Drawing.Color.LightBlue;
            ch.LabelFont.Color      = System.Drawing.Color.Black;
            ch.LabelFont.Name       = ScottPlot.Drawing.InstalledFont.Monospace();
            ch.LabelFont.Size       = 16;
            ch.LineStyle            = LineStyle.Dot;
            ch.LineColor            = System.Drawing.Color.Blue;
        }
コード例 #5
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.Title("Customized Crosshair");
            plt.XLabel("Horizontal Axis");
            plt.YLabel("Vertical Axis");

            plt.AddSignal(ScottPlot.DataGen.Sin(51));
            plt.AddSignal(ScottPlot.DataGen.Cos(51));

            var ch = plt.AddCrosshair(42, 0.48);

            // you can style both lines at the same time
            ch.LineStyle = LineStyle.Dash;
            ch.Color     = System.Drawing.Color.Blue;
            ch.LineWidth = 2;

            // or reach in and style lines individually
            ch.HorizontalLine.PositionLabelFont.Size = 16;
            ch.VerticalLine.PositionLabelFont.Size   = 8;
            ch.VerticalLine.LineStyle = LineStyle.Dot;
        }
コード例 #6
0
        public void ExecuteRecipe(Plot plt)
        {
            plt.AddSignal(ScottPlot.DataGen.Sin(51));
            plt.AddSignal(ScottPlot.DataGen.Cos(51));

            var ch = plt.AddCrosshair(20, 0);