Exemple #1
0
        public void Test_Scatter_Highlight()
        {
            var plt = new ScottPlot.Plot(400, 300);

            // start with default settings
            double[] xs   = { 1, 2, 3, 4 };
            double[] ys   = { 1, 4, 9, 16 };
            var      splt = new ScatterPlotHighlight(xs, ys)
            {
                highlightedMarkerSize = 20, highlightedColor = System.Drawing.Color.Black
            };

            plt.Add(splt);
            var bmp1 = TestTools.GetLowQualityBitmap(plt);

            // change the plottable
            splt.HighlightPointNearest(2.1, 4.1);
            var bmp2 = TestTools.GetLowQualityBitmap(plt);

            // measure what changed
            //TestTools.SaveFig(bmp1, "1");
            //TestTools.SaveFig(bmp2, "2");
            var before = new MeanPixel(bmp1);
            var after  = new MeanPixel(bmp2);

            Console.WriteLine($"Before: {before}");
            Console.WriteLine($"After: {after}");

            Assert.That(after.IsDarkerThan(before));
        }
Exemple #2
0
        private void ShowValueOnHover2_Load(object sender, EventArgs e)
        {
            int    pointCount = 100;
            Random rand       = new Random(0);

            double[] xs = DataGen.Consecutive(pointCount, 0.1);
            double[] ys = DataGen.NoisySin(rand, pointCount);

            sph = formsPlot1.Plot.PlotScatterHighlight(xs, ys);
            formsPlot1.Render();
        }
        public ScatterPlotHighlight PlotScatterHighlight(
            double[] xs,
            double[] ys,
            Color?color                  = null,
            double lineWidth             = 1,
            double markerSize            = 5,
            string label                 = null,
            double[] errorX              = null,
            double[] errorY              = null,
            double errorLineWidth        = 1,
            double errorCapSize          = 3,
            MarkerShape markerShape      = MarkerShape.filledCircle,
            LineStyle lineStyle          = LineStyle.Solid,
            MarkerShape highlightedShape = MarkerShape.openCircle,
            Color?highlightedColor       = null,
            double?highlightedMarkerSize = null
            )
        {
            if (color is null)
            {
                color = settings.GetNextColor();
            }

            if (highlightedColor is null)
            {
                highlightedColor = Color.Red;
            }

            if (highlightedMarkerSize is null)
            {
                highlightedMarkerSize = 2 * markerSize;
            }

            var scatterPlot = new ScatterPlotHighlight(xs, ys, errorX, errorY)
            {
                color                 = (Color)color,
                lineWidth             = lineWidth,
                markerSize            = (float)markerSize,
                label                 = label,
                errorLineWidth        = (float)errorLineWidth,
                errorCapSize          = (float)errorCapSize,
                stepDisplay           = false,
                markerShape           = markerShape,
                lineStyle             = lineStyle,
                highlightedShape      = highlightedShape,
                highlightedColor      = highlightedColor.Value,
                highlightedMarkerSize = (float)highlightedMarkerSize.Value
            };

            Add(scatterPlot);
            return(scatterPlot);
        }
Exemple #4
0
        public ShowValueOnHover()
        {
            InitializeComponent();

            int    pointCount = 100;
            Random rand       = new Random(0);

            double[] xs = DataGen.Consecutive(pointCount, 0.1);
            double[] ys = DataGen.NoisySin(rand, pointCount);

            sph = wpfPlot1.plt.PlotScatterHighlight(xs, ys);
            wpfPlot1.Render();
        }
Exemple #5
0
        private void Form1_Load(object sender, EventArgs e)
        {
            vline = formsPlot1.plt.PlotVLine(1);
            hline = formsPlot1.plt.PlotHLine(1);

            formsPlot1.plt.PlotHSpan(10, 20, draggable: true);
            formsPlot1.plt.PlotVSpan(5, 10, draggable: true);

            Random rand = new Random(0);

            double[] xs = DataGen.Consecutive(100);
            double[] ys = DataGen.RandomWalk(rand, 100);
            sph = formsPlot1.plt.PlotScatterHighlight(xs, ys);

            formsPlot1.Render();
        }