コード例 #1
0
        public void WhenLocatorIsNull_ThenFromLicenseReturnsUnknown()
        {
            var annotation = ImageAnnotation.FromLicense(null);

            Assert.AreEqual(LicenseTypes.Unknown, annotation.LicenseType);
            Assert.AreEqual(OperatingSystemTypes.Unknown, annotation.OperatingSystem);
        }
        private void Form1_Load(object sender, EventArgs e)
        {
            // Add a text annotation to the chart control's repository.
            chartControl1.AnnotationRepository.Add(new TextAnnotation("Annotation 1"));

            // And, assign a series point to the annotation's AnchorPoint property.
            // This adds the annotation to the series point's Annotations collection.
            chartControl1.AnnotationRepository[0].AnchorPoint =
                new SeriesPointAnchorPoint(chartControl1.Series[0].Points[2]);

            // Now, create an image annotation, and add it to the chart's collection.
            chartControl1.Annotations.AddImageAnnotation("Annotation 2",
                                                         Bitmap.FromFile(@"...\...\image.png"));

            // Define the X and Y absolute coordinates for the annotation, in pixels.
            ((ChartAnchorPoint)chartControl1.Annotations[0].AnchorPoint).X = 150;
            ((ChartAnchorPoint)chartControl1.Annotations[0].AnchorPoint).Y = 150;

            // Obtain the additional pane from the diagram's collection.
            XYDiagramPaneBase myPane = ((XYDiagram)chartControl1.Diagram).Panes[0];

            // And, position the chart's annotation in this pane's right top corner;
            ((FreePosition)chartControl1.Annotations[0].ShapePosition).DockTarget = myPane;
            ((FreePosition)chartControl1.Annotations[0].ShapePosition).DockCorner = DockCorner.RightTop;

            // Another annotation is now being added to the collection of this pane.
            myPane.Annotations.AddImageAnnotation("Annotation 3", Bitmap.FromFile(@"...\...\image.png"));

            // Define its axis coordinates (in units appropriate for the scale type of the axes).
            ((PaneAnchorPoint)myPane.Annotations[0].AnchorPoint).AxisXCoordinate.AxisValue = 2;
            ((PaneAnchorPoint)myPane.Annotations[0].AnchorPoint).AxisYCoordinate.AxisValue = 180;

            // Position the annotation in relation to its anchor point.
            ((RelativePosition)myPane.Annotations[0].ShapePosition).Angle           = -135;
            ((RelativePosition)myPane.Annotations[0].ShapePosition).ConnectorLength = 50;

            // You can get an annotation either via the collection of the element to which it is anchored,
            // or centrally, via the chart control's repository (e.g. by its name).
            TextAnnotation myTextAnnotation =
                (TextAnnotation)chartControl1.AnnotationRepository.GetElementByName("Annotation 1");
            ImageAnnotation myImageAnnotation =
                (ImageAnnotation)chartControl1.AnnotationRepository.GetElementByName("Annotation 3");

            // Define the text for the text annotation.
            myTextAnnotation.Text = "<i>Basic</i> <b>HTML</b> <u>is</u> <color=blue>supported</color>.";

            // Enable the interactive positioning for the image annotation.
            myImageAnnotation.RuntimeMoving    = true;
            myImageAnnotation.RuntimeAnchoring = true;
            myImageAnnotation.RuntimeResizing  = true;
            myImageAnnotation.RuntimeRotation  = true;

            // Specify image annotation size mode.
            myImageAnnotation.SizeMode = ChartImageSizeMode.Tile;

            // And, adjust image annotation appearance options.
            myImageAnnotation.ShapeKind      = ShapeKind.RoundedRectangle;
            myImageAnnotation.ShapeFillet    = 10;
            myImageAnnotation.ConnectorStyle = AnnotationConnectorStyle.Arrow;
        }
コード例 #3
0
        public static PlotModel ImageAnnotation()
        {
            var model = new PlotModel("ImageAnnotation", "Click the image");

            model.Axes.Add(new LinearAxis(AxisPosition.Bottom, -20, 20));
            model.Axes.Add(new LinearAxis(AxisPosition.Left, -10, 10));

            OxyImage image = null;

            using (var stream = Alt.IO.VirtualFile.OpenRead("AltData/OxyPlot/OxyPlot.png"))
            {
                image = new OxyImage(stream);
            }

            var ia = new ImageAnnotation(image, new DataPoint(4, 2), global::OxyPlot.HorizontalAlignment.Right);

            model.Annotations.Add(ia);

            // Handle left mouse clicks
            ia.MouseDown += (s, e) =>
            {
                if (e.ChangedButton != OxyMouseButton.Left)
                {
                    return;
                }

                ia.HorizontalAlignment = ia.HorizontalAlignment == global::OxyPlot.HorizontalAlignment.Right ? global::OxyPlot.HorizontalAlignment.Left : global::OxyPlot.HorizontalAlignment.Right;
                model.InvalidatePlot(false);
                e.Handled = true;
            };

            return(model);
        }
コード例 #4
0
        public static PlotModel ImageAnnotation()
        {
            var model = new PlotModel("ImageAnnotation", "Click the image");

            model.Axes.Add(new LinearAxis(AxisPosition.Bottom, -20, 20));
            model.Axes.Add(new LinearAxis(AxisPosition.Left, -10, 10));

            OxyImage image;
            var      assembly = Assembly.GetExecutingAssembly();

            using (var stream = assembly.GetManifestResourceStream("ExampleLibrary.Resources.OxyPlot.png"))
            {
                image = new OxyImage(stream);
            }

            var ia = new ImageAnnotation(image, new DataPoint(4, 2), HorizontalAlignment.Right);

            model.Annotations.Add(ia);

            // Handle left mouse clicks
            ia.MouseDown += (s, e) =>
            {
                if (e.ChangedButton != OxyMouseButton.Left)
                {
                    return;
                }

                ia.HorizontalAlignment = ia.HorizontalAlignment == HorizontalAlignment.Right ? HorizontalAlignment.Left : HorizontalAlignment.Right;
                model.InvalidatePlot(false);
                e.Handled = true;
            };

            return(model);
        }
コード例 #5
0
        public void WhenLocatorIsNotWindwosAndNotNull_ThenFromLicenseReturnsLinux()
        {
            var annotation = ImageAnnotation.FromLicense(
                new LicenseLocator("my-project", "my-distro"));

            Assert.AreEqual(LicenseTypes.Unknown, annotation.LicenseType);
            Assert.AreEqual(OperatingSystemTypes.Linux, annotation.OperatingSystem);
        }
コード例 #6
0
        public void WhenLocatorIsWindowsSpla_ThenFromLicenseReturnsWindowsSpla()
        {
            var annotation = ImageAnnotation.FromLicense(
                new LicenseLocator("windows-cloud", "windows-2016-dc"));

            Assert.AreEqual(LicenseTypes.Spla, annotation.LicenseType);
            Assert.AreEqual(OperatingSystemTypes.Windows, annotation.OperatingSystem);
        }
コード例 #7
0
        public void WhenLocatorIsWindowsByol_ThenFromLicenseReturnsWindowsByol()
        {
            var annotation = ImageAnnotation.FromLicense(
                new LicenseLocator("windows-cloud", "windows-10-enterprise-byol"));

            Assert.AreEqual(LicenseTypes.Byol, annotation.LicenseType);
            Assert.AreEqual(OperatingSystemTypes.Windows, annotation.OperatingSystem);
        }
コード例 #8
0
ファイル: Form1.cs プロジェクト: hpa777/wav_editor
 private void chart1_AnnotationSelectionChanged(object sender, EventArgs e)
 {
     cur_annotation = sender as ImageAnnotation;
     char[] mm = cur_annotation.Image.ToCharArray();
     motor1button.Checked = mm[0].Equals('1');
     motor2button.Checked = mm[1].Equals('1');
     chart1.ContextMenuStrip.Show();
 }
コード例 #9
0
ファイル: Form1.cs プロジェクト: hpa777/wav_editor
 void deleteAnnotation(object sender, EventArgs e)
 {
     if (cur_annotation == null)
     {
         return;
     }
     chart1.Annotations.Remove(cur_annotation);
     cur_annotation = null;
     chart1.ContextMenuStrip.Close();
 }
コード例 #10
0
ファイル: Form1.cs プロジェクト: hpa777/wav_editor
        private void DrawChart(string fname)
        {
            var samples = wave.Length / (wave.WaveFormat.Channels * wave.WaveFormat.BitsPerSample / 8);

            batch = (int)Math.Max(40, samples / 4000);

            int f_count = 0;

            byte[] buf = new byte[cof];
            wave.Position = 0;
            while (wave.Position < wave.Length)
            {
                wave.Read(buf, 0, cof);
                int motor = cof == 2 ? buf[1] : (buf[2] + buf[3]);
                if (motor > 0)
                {
                    string fn = "";
                    switch (motor)
                    {
                    case 1: fn = "00"; break;

                    case 3: fn = "01"; break;

                    case 5: fn = "10"; break;

                    case 7: fn = "11"; break;
                    }
                    ImageAnnotation ann = new ImageAnnotation();
                    ann.AxisX          = chart1.ChartAreas["ChartArea1"].AxisX;
                    ann.AxisY          = chart1.ChartAreas["ChartArea1"].AxisY;
                    ann.Image          = fn;
                    ann.AnchorX        = wave.Position / cof / batch;
                    ann.AnchorY        = 0;
                    ann.AllowSelecting = true;
                    chart1.Annotations.Add(ann);
                }
                if (f_count == 0)
                {
                    if (cof == 4)
                    {
                        chart1.Series["wave"].Points.Add(BitConverter.ToInt16(buf, 0));
                    }
                    else
                    {
                        chart1.Series["wave"].Points.Add(buf[0]);
                    }
                    f_count = batch;
                }
                else
                {
                    f_count--;
                }
            }
            wave.Position = 0;
        }
コード例 #11
0
        private void addImageAnnotation(DataPoint point)
        {
            //return;


            ImageAnnotation ia = new ImageAnnotation();

            ia.Image = System.Environment.CurrentDirectory + "\\Resources\\" + "" + ".png";
            ia.IsSizeAlwaysRelative = true;
            ia.AnchorAlignment      = ContentAlignment.TopCenter;
            ia.AnchorDataPoint      = point;

            chart.Annotations.Add(ia);
        }
コード例 #12
0
        // Finish drawing the new ellipse.
        private void picCanvas_MouseUp(object sender, MouseEventArgs e)
        {
            if (!DrawingNew)
            {
                return;
            }
            DrawingNew = false;

            string shape = "";

            // If the start and end points are different,
            // save the new ellipse.
            if (StartPoint.X != EndPoint.X &&
                StartPoint.Y != EndPoint.Y)
            {
                Rectangle rect = new Rectangle(
                    Math.Min(StartPoint.X, EndPoint.X),
                    Math.Min(StartPoint.Y, EndPoint.Y),
                    Math.Abs(StartPoint.X - EndPoint.X),
                    Math.Abs(StartPoint.Y - EndPoint.Y));
                Image img = new Bitmap(chartAnnotate.Width, chartAnnotate.Height);
                using (Graphics g = Graphics.FromImage(img))
                {
                    if (CircleMode)
                    {
                        g.DrawEllipse(Pens.Red, rect);
                        shape = "Ellipse";
                    }
                    else if (RectangleMode)
                    {
                        g.DrawRectangle(Pens.Red, rect);
                        shape = "Rectangle";
                    }
                    g.DrawString("Label" + regionCount, new Font("Arial", 10), Brushes.Red, rect.X, rect.Y + rect.Height);
                }


                chartAnnotate.Images.Add(new NamedImage("Label" + regionCount, img));
                ImageAnnotation ia = new ImageAnnotation();
                ia.Image   = "Label" + regionCount;
                ia.Name    = ia.Image;
                ia.ToolTip = ia.Name;
                ia.X       = 0;
                ia.Y       = 0;
                chartAnnotate.Annotations.Add(ia);
                regionCount++;
                Regions.Add(new Region(ia.Name, shape, rect.X, rect.Y, rect.Width, rect.Height));
            }
        }
コード例 #13
0
        public void AddBackgroundGradient(PlotModel model, Axis xAxis, double yStart, double yEnd, OxyColor color1, OxyColor color2)
        {
            var image           = GetGradientImage(color1, color2);
            var colorAnnotation = new ImageAnnotation {
                ImageSource         = image,
                Interpolate         = true,
                Layer               = AnnotationLayer.BelowAxes,
                X                   = new PlotLength(xAxis.ActualMinimum, PlotLengthUnit.Data),
                Y                   = new PlotLength(yStart, PlotLengthUnit.Data),
                Width               = new PlotLength(xAxis.ActualMaximum - xAxis.ActualMinimum, PlotLengthUnit.Data),
                Height              = new PlotLength(Math.Abs(yEnd - yStart), PlotLengthUnit.Data),
                HorizontalAlignment = OxyPlot.HorizontalAlignment.Left,
                VerticalAlignment   = OxyPlot.VerticalAlignment.Bottom
            };

            model.Annotations.Add(colorAnnotation);
        }
コード例 #14
0
        public static PlotModel ImageAnnotation()
        {
            var model = new PlotModel {
                Title = "ImageAnnotation", Subtitle = "Click the image"
            };

            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Bottom, Minimum = -20, Maximum = 20
            });
            model.Axes.Add(new LinearAxis {
                Position = AxisPosition.Left, Minimum = -10, Maximum = 10
            });

            OxyImage image;

#if UNIVERSAL
            var assembly = typeof(PlotModel).GetTypeInfo().Assembly;
#else
            var assembly = Assembly.GetExecutingAssembly();
#endif
            using (var stream = assembly.GetManifestResourceStream("ExampleLibrary.Resources.OxyPlot.png"))
            {
                image = new OxyImage(stream);
            }

            var ia = new ImageAnnotation {
                ImageSource = image, X = new PlotLength(4, PlotLengthUnit.Data), Y = new PlotLength(2, PlotLengthUnit.Data), HorizontalAlignment = HorizontalAlignment.Right
            };
            model.Annotations.Add(ia);

            // Handle left mouse clicks
            ia.MouseDown += (s, e) =>
            {
                if (e.ChangedButton != OxyMouseButton.Left)
                {
                    return;
                }

                ia.HorizontalAlignment = ia.HorizontalAlignment == HorizontalAlignment.Right ? HorizontalAlignment.Left : HorizontalAlignment.Right;
                model.InvalidatePlot(false);
                e.Handled = true;
            };

            return(model);
        }
コード例 #15
0
        public PlotModel ApplyHeatMapPlotSettings(PlotModel model, PlotSettingsEventModel settings)
        {
            lock (_lockObject)
            {
                model.Annotations.Clear();
                model.Axes.Clear();

                // Color axis (the X and Y axes are generated automatically)
                model.Axes.Add(new LinearColorAxis {
                    Position = AxisPosition.Right, Palette = OxyPalettes.Jet(100)
                });
                model.Axes.Add(new LinearAxis {
                    Position = AxisPosition.Bottom, Title = settings.XAxisTitle, Minimum = settings.XAxisMinimum, Maximum = settings.XAxisMaximum
                });
                model.Axes.Add(new LinearAxis {
                    Position = AxisPosition.Left, Title = settings.YAxisTitle, Minimum = settings.YAxisMinimum, Maximum = settings.YAxisMaximum
                });

                // Set image as background
                if (!File.Exists(settings.BackgroundImage))
                {
                    return(model);
                }

                using var fs = new FileStream(settings.BackgroundImage, FileMode.Open);
                var image0 = new OxyImage(fs);

                var imageAnnotation = new ImageAnnotation
                {
                    ImageSource         = image0,
                    Opacity             = 0.5,
                    X                   = new PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea),
                    Y                   = new PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea),
                    Width               = new PlotLength(1, PlotLengthUnit.RelativeToPlotArea),
                    Height              = new PlotLength(1, PlotLengthUnit.RelativeToPlotArea),
                    Layer               = AnnotationLayer.AboveSeries,
                    HorizontalAlignment = HorizontalAlignment.Center,
                    VerticalAlignment   = VerticalAlignment.Middle,
                    Interpolate         = true,
                    Tag                 = BackgroundTag
                };
                model.Annotations.Add(imageAnnotation);
                return(model);
            }
        }
コード例 #16
0
        public void LargeImageTest(bool interpolate)
        {
            // this is a test of the DrawImage function; don't add pointless backgrounds to your plots

            var plotModel = CreateTestModel1();

            var pixelData = new OxyColor[5, 5];

            for (int i = 0; i < pixelData.GetLength(0); i++)
            {
                for (int j = 0; j < pixelData.GetLength(1); j++)
                {
                    pixelData[i, j] = OxyColor.FromArgb(255, 128, (byte)((i * 255) / pixelData.GetLength(0)), (byte)((j * 255) / pixelData.GetLength(1)));
                }
            }

            var oxyImage        = OxyImage.Create(pixelData, ImageFormat.Png);
            var imageAnnotation = new ImageAnnotation()
            {
                ImageSource         = oxyImage,
                X                   = new PlotLength(-1, PlotLengthUnit.RelativeToViewport),
                Y                   = new PlotLength(-1, PlotLengthUnit.RelativeToViewport),
                Width               = new PlotLength(3, PlotLengthUnit.RelativeToViewport),
                Height              = new PlotLength(3, PlotLengthUnit.RelativeToViewport),
                HorizontalAlignment = HorizontalAlignment.Left,
                VerticalAlignment   = VerticalAlignment.Top,
                Interpolate         = interpolate
            };

            plotModel.Annotations.Add(imageAnnotation);

            var fileName = Path.Combine(this.outputDirectory, $"LargeImage{(interpolate ? "Interpolated" : "Pixelated")}.png");
            var exporter = new PngExporter {
                Width = 400, Height = 300
            };

            using (var stream = File.OpenWrite(fileName))
            {
                exporter.Export(plotModel, stream);
            }

            Assert.IsTrue(File.Exists(fileName));
        }
コード例 #17
0
ファイル: MainForm.cs プロジェクト: savara94/RPi-StereoCar
        private void InsertInTopView(double x, double y, Bitmap img)
        {
            var id        = chartTopView.Series["Signs"].Points.Count;
            var dataPoint = new DataPoint(x, y);

            chartTopView.Series["Signs"].Points.Add(dataPoint);
            var namedImg = new NamedImage($"sign_{id}", img);

            chartTopView.Images.Add(namedImg);

            ImageAnnotation ia = new ImageAnnotation()
            {
                AnchorDataPoint = dataPoint,
            };

            ia.Image       = namedImg.Name;
            ia.AllowMoving = false;
            chartTopView.Annotations.Add(ia);
        }
コード例 #18
0
        private static void AddAnnotation(PriceVolumeChart chart, int imageIndex, PositionDir dir, DateTime ts)
        {
            DataPoint dataPoint = chart.PricesCandles.Points.FindByValue(ts.ToOADate(), "X");

            if (dataPoint == null)
            {
                return;
            }

            ImageAnnotation annotation = new ImageAnnotation()
            {
                AnchorDataPoint = dataPoint,
                AnchorY         = dataPoint.YValues[PositionOpenCloseImages.AnnotationAnchorYValueIndex[dir][imageIndex]],
                AnchorAlignment = PositionOpenCloseImages.AnnotationContentAlignment[dir][imageIndex],
                Image           = PositionOpenCloseImages.ImageName[dir][imageIndex],
                AnchorOffsetY   = 2
            };

            chart.PVChartControl.Annotations.Add(annotation);
        }
コード例 #19
0
        private void chartAnnotate_DragDrop(object sender, DragEventArgs e)
        {
            string[] files    = (string[])e.Data.GetData(DataFormats.FileDrop);
            string   fileName = files[0];

            if (fileName.ToLower().Contains(".jpg") || files[0].ToLower().Contains(".png"))
            {
                Image img = Bitmap.FromFile(fileName);
                chartImage = img;
                img        = ResizeImage(img, chartAnnotate.Width, chartAnnotate.Height);
                if (chartAnnotate.Images.Count > 0)
                {
                    chartAnnotate.Images[0] = new NamedImage("Image", img);
                }
                else
                {
                    chartAnnotate.Images.Add(new NamedImage("Image", img));
                }
                chartImageAnnotation       = new ImageAnnotation();
                chartImageAnnotation.Image = "Image";
                chartImageAnnotation.Name  = "Image";
                chartImageAnnotation.X     = 0;
                chartImageAnnotation.Y     = 0;
                if (chartAnnotate.Annotations.Count > 0)
                {
                    chartAnnotate.Annotations[0] = chartImageAnnotation;
                }
                else
                {
                    chartAnnotate.Annotations.Add(chartImageAnnotation);
                }
            }
            else
            {
                MessageBox.Show("Picture format must be .jpg or .png");
            }
        }
コード例 #20
0
ファイル: Form1.cs プロジェクト: hpa777/wav_editor
        void saveAnnotation(object sender, EventArgs e)
        {
            chart1.ContextMenuStrip.Close();
            string i1 = motor1button.Checked ? "1" : "0";
            string i2 = motor2button.Checked ? "1" : "0";
            string s  = i2 + i1;

            if (cur_annotation == null)
            {
                ImageAnnotation ann = new ImageAnnotation();
                ann.AxisX          = chart1.ChartAreas["ChartArea1"].AxisX;
                ann.AxisY          = chart1.ChartAreas["ChartArea1"].AxisY;
                ann.Image          = s;
                ann.AnchorX        = cur_pos;
                ann.AnchorY        = 0;
                ann.AllowSelecting = true;
                chart1.Annotations.Add(ann);
            }
            else
            {
                cur_annotation.Image = s;
                cur_annotation       = null;
            }
        }
コード例 #21
0
ファイル: Train.cs プロジェクト: fakoor/ERTMSFormalSpecs
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graph_visualizer"></param>
        public Train(GraphVisualizer graph_visualizer)
            : base(graph_visualizer)
        {
            Position             = new DataPoint();
            Position.XValue      = 0;
            hidden_point         = new DataPoint(0, 0);
            hidden_point.IsEmpty = true;

            TopLeft     = new DataPoint();
            BottomLeft  = new DataPoint();
            BottomRight = new DataPoint();
            TopRight    = new DataPoint();

            under_reading_amount = 0;
            over_reading_amount  = 0;
            SpeedLowerBound      = 0.08;
            SpeedUpperBound      = 0.08;

            TrainAnnotation = new ImageAnnotation();
            TrainAnnotation.AnchorDataPoint = Position;
            TrainAnnotation.AnchorOffsetY   = -4;
            TrainAnnotation.Image           = "TrainMoving";

            TrainLineAnnotation                      = new VerticalLineAnnotation();
            TrainLineAnnotation.AxisX                = GraphVisualizer.AxisX;
            TrainLineAnnotation.AxisY                = GraphVisualizer.AxisY;
            TrainLineAnnotation.LineColor            = Color.LightGray;
            TrainLineAnnotation.LineDashStyle        = ChartDashStyle.Dash;
            TrainLineAnnotation.LineWidth            = 2;
            TrainLineAnnotation.IsSizeAlwaysRelative = false;

            UpdateToolTip();

            InitializeProperties(SeriesChartType.Line, "Train position and accuracy",
                                 "Represents the position of the train and the odometry accuracy", Color.Red);
        }
コード例 #22
0
        private void Annotation_SelectedIndexChanged(object sender, System.EventArgs e)
        {
            Chart1.Annotations.Clear();

            AnnotationStyle.Items.Clear();
            AnnotationStyle.Enabled = false;

            AnnotationStyle1.Items.Clear();
            AnnotationStyle1.Enabled = false;
            AnnotationStyle2.Items.Clear();
            AnnotationStyle2.Visible = false;

            if (Annotation.SelectedItem.ToString() == "Line")
            {
                LineAnnotation annotation = new LineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height          = -25;
                annotation.Width           = -25;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);
            }
            else if (Annotation.SelectedItem.ToString() == "Vertical Line")
            {
                VerticalLineAnnotation annotation = new VerticalLineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height          = -25;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);
            }
            else if (Annotation.SelectedItem.ToString() == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = new HorizontalLineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Width           = -25;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetLineControls(true);
            }
            else if (Annotation.SelectedItem.ToString() == "Polyline")
            {
                PolylineAnnotation annotation = new PolylineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];

                // explicitly set the relative height and width
                annotation.Height = 50;
                annotation.Width  = 30;

                PointF [] points = new PointF[5];
                points[0].X = 0;
                points[0].Y = 0;

                points[1].X = 100;
                points[1].Y = 0;

                points[2].X = 0;
                points[2].Y = 100;

                points[3].X = 100;
                points[3].Y = 100;

                points[4].X = 0;
                points[4].Y = 50;

                annotation.GraphicsPath.AddPolygon(points);

                Chart1.Annotations.Add(annotation);

                SetLineControls(false);
            }
            else if (Annotation.SelectedItem.ToString() == "Text")
            {
                TextAnnotation annotation = new TextAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am a TextAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 12);;

                Chart1.Annotations.Add(annotation);
                SetTextControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Rectangle")
            {
                RectangleAnnotation annotation = new RectangleAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am a\nRectangleAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 12);;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetTextControls();
                SetColorLineControls();
                AnnotationStyle1.SelectedIndex = 2;
            }
            else if (Annotation.SelectedItem.ToString() == "Ellipse")
            {
                EllipseAnnotation annotation = new EllipseAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am an EllipseAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 12);;
                annotation.LineWidth       = 2;
                annotation.Height          = 35;
                annotation.Width           = 60;

                Chart1.Annotations.Add(annotation);

                SetTextControls();
                SetColorLineControls();
                AnnotationStyle1.SelectedIndex = 2;
            }
            else if (Annotation.SelectedItem.ToString() == "Arrow")
            {
                ArrowAnnotation annotation = new ArrowAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Height          = -25;
                annotation.Width           = -25;
                annotation.LineWidth       = 2;

                Chart1.Annotations.Add(annotation);

                SetArrowControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Border3D")
            {
                Border3DAnnotation annotation = new Border3DAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am a Border3DAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 12);
                annotation.Height          = 40;
                annotation.Width           = 50;

                Chart1.Annotations.Add(annotation);

                SetBorder3DControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Callout")
            {
                CalloutAnnotation annotation = new CalloutAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text            = "I am a\nCalloutAnnotation";
                annotation.ForeColor       = Color.Black;
                annotation.Font            = new Font("Arial", 10);;
                annotation.Height          = 35;
                annotation.Width           = 50;

                Chart1.Annotations.Add(annotation);

                SetCalloutControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Polygon")
            {
                PolygonAnnotation annotation = new PolygonAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];

                // explicitly set the relative height and width
                annotation.Height = 50;
                annotation.Width  = 30;

                annotation.BackColor = Color.FromArgb(128, Color.Orange);

                // define relative value points for a polygon
                PointF [] points = new PointF[5];
                points[0].X = 0;
                points[0].Y = 0;

                points[1].X = 100;
                points[1].Y = 0;

                points[2].X = 100;
                points[2].Y = 100;

                points[3].X = 0;
                points[3].Y = 100;

                points[4].X = 50;
                points[4].Y = 50;

                annotation.GraphicsPath.AddPolygon(points);

                Chart1.Annotations.Add(annotation);

                SetColorControl();
                SetColorLineControls();
            }
            else if (Annotation.SelectedItem.ToString() == "Image")
            {
                if (Chart1.Images.IndexOf("MyBmp") < 0)
                {
                    Bitmap   Bmp = new Bitmap(200, 75);
                    Graphics g   = Graphics.FromImage(Bmp);
                    g.FillRectangle(new SolidBrush(Color.Transparent), 0, 0, Bmp.Width, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.PaleGoldenrod), Bmp.Width / 2, 0, Bmp.Width / 2, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.PaleVioletRed), 0, 0, Bmp.Width / 2, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.DarkOrange)), 0, Bmp.Height / 2, Bmp.Width, Bmp.Height / 2);
                    g.DrawString("I am an ImageAnnotation", new Font("Arial", 12),
                                 new SolidBrush(Color.Black),
                                 new Rectangle(0, 0, Bmp.Width, Bmp.Height));

                    g.Dispose();

                    Chart1.Images.Add(new NamedImage("MyBmp", Bmp));
                }

                ImageAnnotation annotation = new ImageAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Image           = "MyBmp";

                Chart1.Annotations.Add(annotation);
                StyleLabel1.Text = "";
                StyleLabel2.Text = "";
            }
        }
コード例 #23
0
        public void PlotSignal(ChartSignalItem[] chartSignalItems)
        {
            chtChart.Annotations.Clear();
            chtChart.Images.Clear();
            chtChart.Images.Add(new NamedImage("buy", Properties.Resources.buysignal));
            chtChart.Images.Add(new NamedImage("sell", Properties.Resources.sellsignal));
            chtChart.Images.Add(new NamedImage("no_signal", Properties.Resources.indecisionsignal));

            Bitmap   reversalToBuyBitmap = new Bitmap(Math.Max(Properties.Resources.buysignal.Size.Width, Properties.Resources.indecisionsignal.Size.Width), Properties.Resources.indecisionsignal.Height + Properties.Resources.buysignal.Height);
            Graphics gfxReversalToBuy    = Graphics.FromImage(reversalToBuyBitmap);

            gfxReversalToBuy.DrawImageUnscaled(Properties.Resources.indecisionsignal, 0, 0);
            gfxReversalToBuy.DrawImageUnscaled(Properties.Resources.buysignal, 0, Properties.Resources.indecisionsignal.Height);
            gfxReversalToBuy.Dispose();
            chtChart.Images.Add(new NamedImage("reversalToBuy", reversalToBuyBitmap));

            Bitmap   reversalToSellBitmap = new Bitmap(Math.Max(Properties.Resources.sellsignal.Size.Width, Properties.Resources.indecisionsignal.Size.Width), Properties.Resources.indecisionsignal.Height + Properties.Resources.sellsignal.Height);
            Graphics gfxReversalToSell    = Graphics.FromImage(reversalToSellBitmap);

            gfxReversalToSell.DrawImageUnscaled(Properties.Resources.indecisionsignal, 0, 0);
            gfxReversalToSell.DrawImageUnscaled(Properties.Resources.sellsignal, 0, Properties.Resources.indecisionsignal.Height);
            gfxReversalToSell.Dispose();
            chtChart.Images.Add(new NamedImage("reversalToSell", reversalToSellBitmap));

            DateTime    lastSignalTime = DateTime.MinValue;
            SignalState lastSignal     = SignalState.NoSignal;

            foreach (ChartSignalItem chartSignalItem in chartSignalItems)
            {
                if (priceActionChart.TimeKeyForIndex.ContainsKey(chartSignalItem.Time))
                {
                    ImageAnnotation logo = new ImageAnnotation();
                    switch (chartSignalItem.SignalState)
                    {
                    case SignalState.Long:
                        logo.Image = "buy";
                        break;

                    case SignalState.Short:
                        logo.Image = "sell";
                        break;

                    case SignalState.NoSignal:
                        logo.Image = "no_signal";
                        break;
                    }
                    logo.ShadowOffset  = 5;
                    logo.ShadowColor   = Color.Black;
                    logo.AnchorOffsetY = 2;
                    DataPoint dataPoint = priceActionChart.Series.Points[priceActionChart.TimeKeyForIndex[chartSignalItem.Time]];
                    //dataPoint.BorderColor = Color.Black;
                    //dataPoint.LabelForeColor = Color.Black;
                    //dataPoint.LabelBackColor = Color.Yellow;
                    //dataPoint.Label= eventListItem.EventName;;
                    //dataPoint.Font = new Font("Arial", 8);

                    if (chartSignalItem.Time == lastSignalTime)
                    {
                        chtChart.Annotations.RemoveAt(chtChart.Annotations.Count - 1);
                        logo.AnchorDataPoint = dataPoint;
                        logo.Alignment       = ContentAlignment.TopCenter;
                        if (lastSignal == SignalState.NoSignal && chartSignalItem.SignalState == SignalState.Long)
                        {
                            logo.Image = "reversalToBuy";
                        }
                        else if (lastSignal == SignalState.NoSignal && chartSignalItem.SignalState == SignalState.Short)
                        {
                            logo.Image = "reversalToSell";
                        }

                        chtChart.Annotations.Add(logo);
                    }
                    else
                    {
                        lastSignalTime = chartSignalItem.Time;

                        logo.AnchorDataPoint = dataPoint;
                        logo.Alignment       = ContentAlignment.TopCenter;
                        chtChart.Annotations.Add(logo);
                    }
                }
            }

            if (this.annotationOverlaps.Count > 0)
            {
                chtChart.ChartAreas[0].RecalculateAxesScale();
                double imageHeightToYValue = chtChart.ChartAreas[0].AxisY.PixelPositionToValue(0) - chtChart.ChartAreas[0].AxisY.PixelPositionToValue(Properties.Resources.buysignal.Height);
                foreach (int index in this.annotationOverlaps)
                {
                    chtChart.Annotations[index].AnchorY = chtChart.Annotations[index].AnchorDataPoint.YValues[2] + imageHeightToYValue;
                }
                this.annotationOverlaps.Clear();
            }
        }
コード例 #24
0
        private void AddMapFeatures(PlotModel model, WeatherDataPalette wdp, OxyPalette pal, bool isWindMap)
        {
            LineSeries line = null;

            string[] lines = File.ReadAllLines("Coastline.thd");
            foreach (string s in lines)
            {
                if (s.StartsWith("#"))
                {
                    continue;
                }

                if (s.StartsWith(">>"))
                {
                    if (line != null)
                    {
                        model.Series.Add(line);
                    }

                    line = new LineSeries();
                    line.CanTrackerInterpolatePoints = true;
                    line.Color           = OxyColors.Black;
                    line.StrokeThickness = 1;
                    continue;
                }

                Point pt = Point.Parse(s);
                line.Points.Add(new DataPoint(pt.X, pt.Y));
            }

            if (line != null)
            {
                model.Series.Add(line);
            }
            line = null;

            line = null;

            lines = File.ReadAllLines("ContourRO.thd");
            foreach (string s in lines)
            {
                if (s.StartsWith("#"))
                {
                    continue;
                }

                if (s.StartsWith(">>"))
                {
                    if (line != null)
                    {
                        model.Series.Add(line);
                    }

                    line = new LineSeries();
                    line.CanTrackerInterpolatePoints = true;
                    line.Color           = OxyColors.Maroon;
                    line.StrokeThickness = 2;
                    continue;
                }

                Point pt = Point.Parse(s);
                line.Points.Add(new DataPoint(pt.X, pt.Y));
            }

            if (line != null)
            {
                model.Series.Add(line);
            }


            model.Axes.Add(new OxyPlot.Axes.LinearAxis
            {
                Unit              = "° Latitude",
                Position          = OxyPlot.Axes.AxisPosition.Left,
                FilterMinValue    = App.ControlPanelModel.SelectedViewport.MinLat,
                FilterMaxValue    = App.ControlPanelModel.SelectedViewport.MaxLat,
                AxisTitleDistance = 10,

                //MajorGridlineStyle = LineStyle.Solid,
                //MajorStep = 0.5,
            });
            model.Axes.Add(new OxyPlot.Axes.LinearAxis
            {
                Unit              = "° Longitude",
                Position          = OxyPlot.Axes.AxisPosition.Bottom,
                FilterMinValue    = App.ControlPanelModel.SelectedViewport.MinLon,
                FilterMaxValue    = App.ControlPanelModel.SelectedViewport.MaxLon,
                AxisTitleDistance = 10,
                AxislineStyle     = LineStyle.Solid,

                //MajorGridlineStyle = LineStyle.Solid,
                //MajorStep = 0.5,
            });

            model.Axes[0].Minimum = App.ControlPanelModel.SelectedViewport.MinLat;
            model.Axes[0].Maximum = App.ControlPanelModel.SelectedViewport.MaxLat;
            model.Axes[1].Minimum = App.ControlPanelModel.SelectedViewport.MinLon;
            model.Axes[1].Maximum = App.ControlPanelModel.SelectedViewport.MaxLon;

            //if (isWindMap)
            //{
            //}
            //else
            {
                model.Axes.Add(new OxyPlot.Axes.LinearColorAxis
                {
                    Unit              = wdp.Unit,
                    Position          = OxyPlot.Axes.AxisPosition.Right,
                    Palette           = pal,
                    HighColor         = OxyColors.Black,
                    LowColor          = OxyColors.Black,
                    FilterMinValue    = wdp.MinMax.Min,
                    FilterMaxValue    = wdp.MinMax.Max,
                    Minimum           = wdp.MinMax.Min,
                    Maximum           = wdp.MinMax.Max,
                    AxisDistance      = 5,
                    AxisTitleDistance = 5,
                    AxislineThickness = 100,
                });
            }

            model.PlotMargins   = new OxyThickness(40, 0, 50, 40);
            model.TitleFontSize = 14;

            //model.PlotType = PlotType.Polar;

            if (App.ControlPanelModel.SelectedViewport.Name == "Romania")
            {
                if (_roCounties == null)
                {
                    _roCounties = new ImageAnnotation
                    {
                        ImageSource = new OxyImage(File.ReadAllBytes("RO4.png")),

                        X     = new PlotLength(0.5, PlotLengthUnit.RelativeToPlotArea),
                        Width = new PlotLength(1, PlotLengthUnit.RelativeToPlotArea),

                        Y      = new PlotLength(0.51, PlotLengthUnit.RelativeToPlotArea),
                        Height = new PlotLength(0.8, PlotLengthUnit.RelativeToPlotArea),

                        HorizontalAlignment = OxyPlot.HorizontalAlignment.Center,
                        VerticalAlignment   = OxyPlot.VerticalAlignment.Middle
                    };
                }

                model.Annotations.Add(_roCounties);
            }
        }
コード例 #25
0
 public Example(Image image, string annotationLib, ImageAnnotation annotation)
 {
     Img               = image.Source;
     Annotation        = annotation;
     AnnotationLibrary = annotationLib;
 }
コード例 #26
0
        private void SetAnnotationType()
        {
            Chart1.Annotations.Clear();

            if(Annotation.SelectedItem.Value == "Line")
            {
                LineAnnotation annotation = new LineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Height = -25;
                annotation.Width = -25;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Vertical Line")
            {
                VerticalLineAnnotation annotation = new VerticalLineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Height = -25;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Horizontal Line")
            {
                HorizontalLineAnnotation annotation = new HorizontalLineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Width = -25;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Polyline")
            {
                PolylineAnnotation annotation = new PolylineAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];

                // explicitly set the relative height and width
                annotation.Height = 50;
                annotation.Width = 30;

                PointF [] points = new PointF[5];
                points[0].X = 0;
                points[0].Y = 0;

                points[1].X = 100;
                points[1].Y = 0;

                points[2].X = 0;
                points[2].Y = 100;

                points[3].X = 100;
                points[3].Y = 100;

                points[4].X = 0;
                points[4].Y = 50;

                annotation.GraphicsPath.AddPolygon(points);

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Text")
            {
                TextAnnotation annotation = new TextAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Text = "I am a TextAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 12);;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Rectangle")
            {
                RectangleAnnotation annotation = new RectangleAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Text = "I am a\nRectangleAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 12);;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Ellipse")
            {
                EllipseAnnotation annotation = new EllipseAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Text = "I am an EllipseAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 12);;
                annotation.LineWidth = 2;
                annotation.Height = 35;
                annotation.Width = 60;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Arrow")
            {
                ArrowAnnotation annotation = new ArrowAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Height = -25;
                annotation.Width = -25;
                annotation.LineWidth = 2;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Border3D")
            {
                Border3DAnnotation annotation = new Border3DAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Text = "I am a Border3DAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 12);;
                annotation.Height = 40;
                annotation.Width = 50;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Callout")
            {
                CalloutAnnotation annotation = new CalloutAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[1];
                annotation.Text = "I am a\nCalloutAnnotation";
                annotation.ForeColor = Color.Black;
                annotation.Font = new Font("Arial", 10);;
                annotation.Height = 35;
                annotation.Width = 50;

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Polygon")
            {
                PolygonAnnotation annotation = new PolygonAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];

                // explicitly set the relative height and width
                annotation.Height = 50;
                annotation.Width = 30;

                annotation.BackColor = Color.FromArgb(128, Color.Orange);

                // define relative value points for a polygon
                PointF [] points = new PointF[5];
                points[0].X = 0;
                points[0].Y = 0;

                points[1].X = 100;
                points[1].Y = 0;

                points[2].X = 100;
                points[2].Y = 100;

                points[3].X = 0;
                points[3].Y = 100;

                points[4].X = 50;
                points[4].Y = 50;

                annotation.GraphicsPath.AddPolygon(points);

                Chart1.Annotations.Add(annotation);
            }
            else if(Annotation.SelectedItem.Value == "Image")
            {
                if (Chart1.Images.IndexOf("MyBmp") < 0)
                {
                    Bitmap Bmp = new Bitmap(200, 75);
                    Graphics g = Graphics.FromImage(Bmp);
                    g.FillRectangle(new SolidBrush(Color.Transparent), 0, 0, Bmp.Width, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.PaleGoldenrod), Bmp.Width/2, 0, Bmp.Width/2, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.PaleVioletRed), 0, 0, Bmp.Width/2, Bmp.Height);
                    g.FillRectangle(new SolidBrush(Color.FromArgb(128, Color.DarkOrange)), 0, Bmp.Height/2, Bmp.Width, Bmp.Height/2);
                    g.DrawString("I am an ImageAnnotation", new Font("Arial", 12),
                        new SolidBrush(Color.Black),
                        new Rectangle( 0, 0, Bmp.Width, Bmp.Height));

                    g.Dispose();

                    Chart1.Images.Add(new NamedImage("MyBmp", Bmp));
                }

                ImageAnnotation annotation = new ImageAnnotation();
                annotation.AnchorDataPoint = Chart1.Series[0].Points[2];
                annotation.Image = "MyBmp";

                Chart1.Annotations.Add(annotation);
            }
        }
コード例 #27
0
ファイル: ImageAnnotationWrapper.cs プロジェクト: nunb/code
 public ImageAnnotationWrapper(ImageAnnotation annotation)
 {
     _annotation = annotation;
 }
コード例 #28
0
        //Methods
        public void addImage(string name, Image image, List <string> children)
        {
            //Check if name is already present. If alread present, do not add it again.
            if (oImages.FindIndex(p => p.Name == name) > -1)
            {
                return;
            }

            //Determine vertical and horizontal position
            int level    = 1 * verticalSpacing;
            int position = 1 * horizontalSpacing;

            if (children != null && children.Count > 0)
            {
                //Find average position of children
                int levelSum    = 0;
                int positionSum = 0;
                foreach (string child in children)
                {
                    OrganizedImage oImage = oImages.Find(p => p.Name == child);
                    levelSum    += oImage.level;
                    positionSum += oImage.position;
                }

                //Computer position of this parent above the children
                level    = levelSum / children.Count + 1 * verticalSpacing;
                position = positionSum / children.Count;
            }
            else
            {
                //Level is 1
                level = 1 * verticalSpacing;

                //Position right of previous item
                position = oImages.FindAll(p => p.level == level).Count *verticalSpacing;
            }

            //Create image
            OrganizedImage img = new OrganizedImage(name, image, level, position);

            nImages.Add(img);
            oImages.Add(img);

            //Create point - parent
            DataPoint dpLabelLabel = new DataPoint(img.position, img.level)
            {
                Name = name, Label = name
            };
            DataPoint dpParent = new DataPoint(img.position, img.level)
            {
                Name = name
            };

            points.Add(dpParent);
            points.Add(dpLabelLabel);
            points.Add(new DataPoint()
            {
                IsEmpty = true
            });

            //Create image annotation of parent
            ImageAnnotation imgAn = new ImageAnnotation()
            {
                Name            = name,
                Image           = name,
                AnchorDataPoint = dpParent
            };

            annotations.Add(imgAn);

            //Create points - children
            foreach (string child in children)
            {
                OrganizedImage childOImage = oImages.Find(p => p.Name == child);
                DataPoint      dpChild     = new DataPoint(childOImage.position, childOImage.level)
                {
                    Name = childOImage.Name,
                };

                //Draw Line connecting them
                points.Add(dpParent);
                points.Add(dpChild);
                points.Add(new DataPoint()
                {
                    IsEmpty = true
                });                                             //prevents lines from connecting
            }
        }