Example #1
0
        private void AddTargetLine()
        {
            if (DataList.TargetLine.Equals(0))
            {
                return;
            }
            else
            {
                var TargetLine = new ChartLine()
                {
                    Name       = "XAxis",
                    X1Position = 0,
                    X2Position = LengthForXAxis - 100,
                    Y1Position = 0, //ChartHeight - 150,
                    Y2Position = 0, // ChartHeight - 150,
                    Stroke     = Brushes.Black,
                    Thickness  = 2,
                    XPosition  = 100
                };


                if (ForceYStartAtZero)
                {
                    TargetLine.YPosition = (ChartHeight - 150) - DataList.TargetLine * BarHeightModifier - 2;
                }
                else
                {
                    TargetLine.YPosition = (ChartHeight - 150) - (DataList.TargetLine - LowestTickMarkValue) * BarHeightModifier - 2;
                }


                ChartNodesCollection.Add(TargetLine);
            }
        }
        public ChartLine AttachDataSet(IChart chart, MultiDimensionalPoint point, int pointDimension, object tag)
        {
            var chartPoints       = new ChartPoint[pointDimension];
            var chartLineSegments = new ChartLineSegment[pointDimension - 1];

            for (int i = 0; i < pointDimension; i++)
            {
                chartPoints[i] = new ChartPoint {
                    Data = point
                };
                chart.Axes[i].Points.Add(chartPoints[i]);
                chart.Axes[i].Transformation.Transform(chart.Axes[i], chartPoints[i]);
            }

            for (int i = 0; i < pointDimension - 1; i++)
            {
                chartLineSegments[i] = new ChartLineSegment(chartPoints[i], chartPoints[i + 1]);
            }

            foreach (var chartPoint in chartPoints)
            {
                chart.Points.Add(chartPoint);
            }

            var line = new ChartLine(chartLineSegments)
            {
                Tag = tag
            };

            chart.Lines.Add(line);

            return(line);
        }
Example #3
0
        private void AddAxis()
        {
            var Xaxis = new ChartLine()
            {
                Name       = "XAxis",
                X1Position = 0,
                X2Position = LengthForXAxis - 100,
                Y1Position = 0, //ChartHeight - 150,
                Y2Position = 0, // ChartHeight - 150,
                Stroke     = Brushes.Black,
                Thickness  = 2,
                XPosition  = 100,
                YPosition  = ChartHeight - 150,
            };

            ChartNodesCollection.Add(Xaxis);

            var YAxis = new ChartLine()
            {
                Name       = "YAxis",
                X1Position = 0,
                X2Position = 0,
                Y1Position = ChartHeight - 250,
                Y2Position = 0,
                Stroke     = Brushes.Black,
                Thickness  = 2,
                XPosition  = 100,
                YPosition  = 100,
            };

            ChartNodesCollection.Add(YAxis);
        }
Example #4
0
        public void DeleteLine(ChartLine line)
        {
            List <Path> toDel = new List <Path>();

            foreach (var p in canvas.Children)
            {
                if (p.GetType() == typeof(Path))
                {
                    Path path = p as Path;
                    if (path.Name == "rect_" + line.id)
                    {
                        toDel.Add(path);
                    }
                    if (path.Name == "line_" + line.id)
                    {
                        toDel.Add(path);
                    }
                }
            }

            for (int i = 0; i < toDel.Count; i++)
            {
                canvas.Children.Remove(toDel[i]);
            }

            chartLines.Remove(line);
            selectedLines.Remove(line);
        }
    //------------------------------------------------------------------------------------------------------------------
    void InitLines()
    {
        GUIBase_List list = Parent.transform.GetComponent <GUIBase_List>() as GUIBase_List;

        if (list == null)
        {
            Debug.LogError("'GUIBase_List' in '" + Parent.name + "' not found!");
            return;
        }

        if (list.numOfLines <= 0)
        {
            Debug.LogError("Wrong number of lines in '" + Parent.name + "'!");
            return;
        }

        m_Lines = new ChartLine[list.numOfLines];

        for (int i = 0; i < list.numOfLines; ++i)
        {
            m_Lines[i] = new ChartLine(list.GetWidgetOnLine(i));
        }

        m_PlayerHighlighting = Parent.transform.FindChildByName("MyPlayer").GetComponent <GUIBase_Sprite>();

        UpdateHighlighiting(-1);
    }
Example #6
0
            public override void UpdateMarker(int index)
            {
                base.UpdateMarker(index);

                // Get first chart line component
                ChartLine chartLine = FindObjectOfType <ChartLine>();

                // Get first line renderer component
                LineRenderer lineRenderer = chartLine.GetComponent <LineRenderer>();

                // Get marker position
                Vector3 markerPosition = lineRenderer.GetPosition(index);

                // Set marker object position
                this.gameObject.transform.localPosition = new Vector3(
                    markerPosition.x, 0, this.gameObject.transform.localPosition.z);

                // Get max and min values for all the chart lines and the given index
                List <float> yValueSet = new List <float>();

                foreach (ChartLine cl in FindObjectsOfType <ChartLine>())
                {
                    yValueSet.Add(cl.Y[index]);
                }
                String minText = yValueSet.Min().ToString("0.00#");
                String maxText = yValueSet.Max().ToString("0.00#");

                // Set text label
                this.gameObject.transform.GetComponentInChildren <TextMesh>().text = "Min: " + minText + " Max: " + maxText;
            }
        private void button4_Click(object sender, EventArgs e)
        {
            var line = new ChartLine(chart1, RandPoint(), RandPoint());

            line.Color = RandColor();
            chart1.AddObject(line);
        }
Example #8
0
        public async Task <IActionResult> PutChartLine(int id, ChartLine chartLine)
        {
            if (id != chartLine.ChartLineId)
            {
                return(BadRequest());
            }

            _context.Entry(chartLine).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ChartLineExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(NoContent());
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartCategoryAxis{T}" /> class.
 /// </summary>
 /// <param name="chart">The chart.</param>
 public ChartAxisDefaults(Chart <T> chart)
     : base(chart)
 {
     MajorGridLines = new ChartLine();
     MinorGridLines = new ChartLine();
     Labels         = new ChartAxisLabels();
 }
Example #10
0
        public async Task <ActionResult <ChartLine> > PostChartLine(ChartLine chartLine)
        {
            _context.ChartLine.Add(chartLine);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetChartLine", new { id = chartLine.ChartLineId }, chartLine));
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartNumericAxis{T}" /> class.
 /// </summary>
 /// <param name="chart">The chart.</param>
 public ChartNumericAxis(Chart <T> chart)
     : base(chart)
 {
     MajorGridLines = new ChartLine();
     MinorGridLines = new ChartLine();
     Labels         = new ChartAxisLabels();
     Format         = "";
 }
Example #12
0
 private void FrequencyChartSetup(ChartLine chart)
 {
     chart.Margin               = new Thickness(0, 2, 0, 2);
     chart.GridDraw             = true;
     chart.HAxisTitle           = "Частота (Гц)";
     chart.MappingXAxis         = MappingXAxis;
     chart.MaxHeightXAxisString = double.MaxValue.ToString(CultureInfo.InvariantCulture);
     chart.ShowCurrentXY        = true;
     chart.IsMouseSelect        = true;
 }
        public virtual void Transform(IAxis axis, ChartLine line)
        {
            if (line.Segments.Count > 0)
                Transform(axis, line.Segments[0].PointX);

            foreach (var segment in line.Segments)
            {
                Transform(axis, segment.PointY);
            }
        }
Example #14
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartAxisBase{T}" /> class.
 /// </summary>
 /// <param name="chart">The chart.</param>
 public ChartAxisBase(Chart <T> chart)
 {
     Chart          = chart;
     MinorTickSize  = ChartDefaults.Axis.MinorTickSize;
     MajorTickSize  = ChartDefaults.Axis.MajorTickSize;
     MajorTickType  = ChartDefaults.Axis.MajorTickType;
     MinorTickType  = ChartDefaults.Axis.MinorTickType;
     MajorGridLines = new ChartLine();
     MinorGridLines = new ChartLine();
     Line           = new ChartLine();
     Labels         = new ChartAxisLabels();
 }
        public virtual void Transform(IAxis axis, ChartLine line)
        {
            if (line.Segments.Count > 0)
            {
                Transform(axis, line.Segments[0].PointX);
            }

            foreach (var segment in line.Segments)
            {
                Transform(axis, segment.PointY);
            }
        }
Example #16
0
        private void AddLineClick(object sender, RoutedEventArgs e)
        {
            var line = new ChartLine {
                LineColor       = Colors.Yellow,
                FillColor       = Color.FromArgb(128, 255, 255, 0),
                LineThickness   = 2,
                PointDataSource = GenerateRandomDataSet(Axes.Length),
                Name            = "Chart " + (Lines.Count + 1)
            };

            Lines.Add(line);
        }
        public async Task <IActionResult> Create([Bind("ChartId,Quantity,ProductId")] ChartLine chartLine)
        {
            if (ModelState.IsValid)
            {
                _context.Add(chartLine);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["ChartId"]   = new SelectList(_context.Charts, "CustomerId", "CustomerId", chartLine.ChartId);
            ViewData["ProductId"] = new SelectList(_context.Products, "ProductId", "Genre", chartLine.ProductId);
            return(View(chartLine));
        }
Example #18
0
        private void SetSideLengths()
        {
            var list = new List <DataPoint>();

            foreach (var l in mHairLengths)
            {
                var dp = new DataPoint(DateTimeAxis.ToDouble(l.Day), l.Side);
                list.Add(dp);
                AddToList(dp, l);
            }

            mSideLength = new ChartLine("Side", list, SideLineColor);
        }
Example #19
0
        public static bool LineValueOnSdd(ChartLine line, Data.SymbolDayData sdd)
        {
            DrawingInfo di = line.GetDrawingInfo();

            double PDR = DateToPixel(di, sdd.Date, 0);

            double PVRLO = Math.Round(RemapRangeValToPix(sdd.Low, di), 6);
            double PVRHI = Math.Round(RemapRangeValToPix(sdd.Hi, di), 6);

            Point pLO = new Point(PDR, PVRLO);
            Point pHI = new Point(PDR, PVRHI);

            return(DoIntersect(line.getP1(), line.getP2(), pLO, pHI));
        }
Example #20
0
        public Form1()
        {
            InitializeComponent();
            Control.CheckForIllegalCrossThreadCalls = false;
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.EnableNotifyMessage, true);

            chartLine = new ChartLine();
            chartLine.AverageComment = "IPS";
            chartLine.DrawLines = true;
            chartLine.PeakComment = "Instructions Per Second";
            chartLine.ShowAverageLine = true;
            perfChart1.ChartLines.Add(chartLine);
        }
Example #21
0
        public void AddLoadedChartLines(Dictionary <string, DataToSerialize> symbolsDrawingsToSerialize, string name)
        {
            // add loaded chart lines
            foreach (var data in symbolsDrawingsToSerialize)
            {
                if (data.Key == name)
                {
                    // found drawing for symbol
                    foreach (var line in data.Value.chartLines)
                    {
                        ChartLine lineToAdd = new ChartLine(this);

                        // Create and add new points
                        lineToAdd.setP1(Misc.LineStringToPoint(drawingInfo, line.StartPointDV));
                        lineToAdd.setP2(Misc.LineStringToPoint(drawingInfo, line.EndPointDV));

                        lineToAdd.color           = Misc.StringToBrush(line.Color);
                        lineToAdd.linePath.Stroke = lineToAdd.color;

                        // default layer is L1
                        lineToAdd.layerData = line.Data;
                        if (line.Data == null)
                        {
                            lineToAdd.layerData = "L1";
                        }
                        if (line.Data == "")
                        {
                            lineToAdd.layerData = "L1";
                        }
                        if (lineToAdd.layerData.Contains("L1") == false)
                        {
                            lineToAdd.linePath.Visibility = Visibility.Hidden;
                        }

                        lineToAdd.mode        = ChartLine.Mode.Normal;
                        lineToAdd.drawingMode = ChartLine.DrawingMode.Invalid;
                        lineToAdd.Select(false);

                        chartLines.Add(lineToAdd);
                        canvas.Children.Add(lineToAdd.linePath);
                        canvas.Children.Add(lineToAdd.rectPath);

                        lineToAdd.MoveP1(lineToAdd.getP1());
                        lineToAdd.MoveP2(lineToAdd.getP2());
                    }
                    break;
                }
            }
        }
Example #22
0
 public void MoveControlPoint(ChartLine line, Point mousePosition, bool resize)
 {
     if (line.drawingMode == DrawingMode.P1)
     {
         line.MoveP1(mousePosition, resize);
     }
     else if (line.drawingMode == DrawingMode.P2)
     {
         line.MoveP2(mousePosition, resize);
     }
     else if (line.drawingMode == DrawingMode.Mid)
     {
         line.MoveMid(mousePosition);
     }
 }
Example #23
0
            public static void ColorUpdate(ChartLine line)
            {
                if (line.color == Brushes.Lime || line.color == Brushes.Red)
                {
                    bool upLine = line.getP1().X > line.getP2().X ?
                                  line.getP1().Y <line.getP2().Y : line.getP1().Y> line.getP2().Y;

                    if (upLine)
                    {
                        line.color = line.linePath.Stroke = Brushes.Lime;
                    }
                    else
                    {
                        line.color = line.linePath.Stroke = Brushes.Red;
                    }
                }
            }
Example #24
0
        private void AddAxis()
        {
            // need to calculate how "high" the X-axis will be in our chart
            double YPositionForXaxis;

            if ((LowestTickMarkValue == 0))
            {
                YPositionForXaxis = ChartHeight - ChartSpaceOffsetBottom;
            }
            else
            {
                YPositionForXaxis = ChartHeight - ChartSpaceOffsetBottom - (BarHeightModifier * (0 - LowestTickMarkValue));
            }


            var Xaxis = new ChartLine()
            {
                Name       = "XAxis",
                X1Position = 0,
                X2Position = LengthForXAxis - ChartSpaceOffsetLeft,
                Y1Position = 0,
                Y2Position = 0,
                Stroke     = Brushes.Black,
                Thickness  = 2,
                XPosition  = ChartSpaceOffsetLeft,
                YPosition  = YPositionForXaxis, //had to calculate this first (bit above :))
            };

            ChartNodesCollection.Add(Xaxis);

            var YAxis = new ChartLine()
            {
                Name       = "YAxis",
                X1Position = 0,
                X2Position = 0,
                Y1Position = ChartAvailableSpaceY,
                Y2Position = 0,
                Stroke     = Brushes.Black,
                Thickness  = 2,
                XPosition  = ChartSpaceOffsetLeft,
                YPosition  = ChartSpaceOffsetTop,
            };

            ChartNodesCollection.Add(YAxis);
        }
    //------------------------------------------------------------------------------------------------------------------
    void UpdateLines()
    {
        if ((m_Lines == null) || (m_Lines.Length == 0))
        {
            return;
        }

        int highlight = -1;
        PlayerPersistantInfo        local         = PPIManager.Instance.GetLocalPlayerPPI();
        List <PlayerPersistantInfo> original      = PPIManager.Instance.GetPPIList();
        List <PlayerPersistantInfo> sortedByTeam  = new List <PlayerPersistantInfo>(original);
        List <PlayerPersistantInfo> sortedByScore = new List <PlayerPersistantInfo>(original);

        m_FirstTeam = local.Team;

        sortedByTeam.Sort(ComparePPIsByTeam);
        sortedByScore.Sort(ComparePPIsByScore);

        for (int i = 0; i < m_Lines.Length; ++i)
        {
            ChartLine line = m_Lines[i];

            if (i < sortedByTeam.Count)
            {
                PlayerPersistantInfo ppi = sortedByTeam[i];
                Color col = GetColor(ppi);
                int   idx = GetIndex(ppi, sortedByScore) + 1;

                line.Show();
                line.Update(ppi, idx, col);

                if (ppi.Player == local.Player)
                {
                    m_PlayerPlace = idx;
                    highlight     = i;
                }
            }
            else
            {
                line.Hide();
            }
        }

        UpdateHighlighiting(highlight);
    }
        public void AddChannel(Channel channel)
        {
            var chart = new ChartLine(channel);

            chart.Height = 100;

            charts.Add(chart);

            chart.ContextMenu = new ContextMenu();

            var item1 = new MenuItem();

            item1.Header = "Осциллограмма";
            item1.Click += (object sender, RoutedEventArgs args) => {
                MainWindow.Instance.AddOscillogram(channel);
            };
            chart.ContextMenu.Items.Add(item1);

            var item2 = new MenuItem();

            item2.Header = "Статистика";
            item2.Click += (object sender, RoutedEventArgs args) => {
                MainWindow.Instance.AddStatistics(channel);
            };
            chart.ContextMenu.Items.Add(item2);

            var item3 = new MenuItem();

            item3.Header = "Анализ Фурье";
            item3.Click += (object sender, RoutedEventArgs args) => {
                MainWindow.Instance.AddAnalyze(channel);
            };
            chart.ContextMenu.Items.Add(item3);

            var item4 = new MenuItem();

            item4.Header = "Спектрограмма";
            item4.Click += (object sender, RoutedEventArgs args) => {
                MainWindow.Instance.AddSpectrogram(channel);
            };
            chart.ContextMenu.Items.Add(item4);

            ChannelsPanel.Children.Add(chart);
        }
Example #27
0
            public ChartLine CopyLineTo(Chart chart)
            {
                // copy line
                ChartLine newLine = new ChartLine(chart);

                newLine.mode        = Mode.Normal;
                newLine.drawingMode = DrawingMode.Invalid;
                newLine.Select(false);

                newLine.color           = color;
                newLine.linePath.Stroke = linePath.Stroke;

                newLine.layerData = layerData;

                chart.chartLines.Add(newLine);
                chart.canvas.Children.Add(newLine.linePath);
                chart.canvas.Children.Add(newLine.rectPath);

                return(newLine);
            }
Example #28
0
        public async Task <IActionResult> AddToChart(int id)
        {
            string email = User.Identity.Name;

            var customers = _context.Customers
                            .Where(c => c.Email == email)
                            .Select(id => id.CustomerId)
                            .ToList();

            int customerId = customers.First();
            var product    = _context.Products.Find(id);
            var chart      = _context.Charts.Find(customerId);
            var line       = _context.ChartLines.Find(customerId, id);

            if (line != null)
            {
                line.Quantity++;
                chart.Cost += (int)product.Price;
                _context.Update(line);
            }
            else
            {
                line = new ChartLine()
                {
                    ProductId = id,
                    ChartId   = customerId,
                    Product   = product,
                    Chart     = chart,
                    Quantity  = 1
                };
                chart.Cost += (int)product.Price;
                _context.Add(line);
            }
            await _context.SaveChangesAsync();



            return(RedirectToAction("Index", "Products"));
        }
Example #29
0
        public static IChart GetChart(string type)
        {
            IChart chart = null;

            if (type.Equals("histogram"))
            {
                chart = new ChartHistogram();
                System.Console.WriteLine("Init Histogram");
            }
            else if (type.Equals("pie"))
            {
                chart = new ChartPie();
                System.Console.WriteLine("Init Pie");
            }
            else if (type.Equals("line"))
            {
                chart = new ChartLine();
                System.Console.WriteLine("Init Line");
            }

            return(chart);
        }
        /// <summary>
        /// add the targetline to the graph if it falls within the chartrange, otherwise does nothing
        /// </summary>
        private void AddTargetLine()
        {
            if (DataList.TargetLine.Equals(0))
            {
                return;
            }
            else if (DataList.TargetLine > LowestTickMarkValue && DataList.TargetLine < HigestTickMarkValue)
            {
                var TargetLine = new ChartLine()
                {
                    Name       = "TargetLine",
                    X1Position = 0,
                    X2Position = LengthForXAxis - ChartSpaceOffsetLeft,
                    Y1Position = 0,
                    Y2Position = 0,
                    Stroke     = Brushes.Black,
                    Thickness  = 2,
                    XPosition  = ChartSpaceOffsetLeft
                };


                if (ForceYStartAtZero)
                {
                    TargetLine.YPosition = (ChartHeight - ChartSpaceOffsetBottom) - DataList.TargetLine * BarHeightModifier;
                }
                else
                {
                    TargetLine.YPosition = (ChartHeight - ChartSpaceOffsetBottom) - (DataList.TargetLine - LowestTickMarkValue) * BarHeightModifier;
                }


                ChartNodesCollection.Add(TargetLine);
            }
            else
            {
                return;
            }
        }
Example #31
0
            public override void UpdateMarker(int index)
            {
                base.UpdateMarker(index);

                // Get chart line component
                ChartLine chartLine = FindObjectOfType <ChartLine>();

                // Get line renderer component
                LineRenderer lineRenderer = chartLine.GetComponent <LineRenderer>();

                // Get marker point position
                Vector3 markerPosition = lineRenderer.GetPosition(index);

                // Set marker position
                this.gameObject.transform.localPosition = new Vector3(
                    markerPosition.x, markerPosition.y, this.gameObject.transform.localPosition.z);

                // Define marker line component
                this.gameObject.transform.Find("Line").GetComponent <LineRenderer>().SetPosition(0, new Vector3(0, -markerPosition.y - 2.2f));

                // Define marker text
                this.gameObject.transform.GetComponentInChildren <TextMesh>().text = chartLine.GetComponent <ChartLine>().Y[index].ToString("0.00#");
            }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartMajorGridLinesBuilder" /> class.
 /// </summary>
 /// <param name="chartLine">The chart line.</param>
 public ChartMajorGridLinesBuilder(ChartLine chartLine)
     : base(chartLine)
 {
     line = chartLine;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartLineBuilder" /> class.
 /// </summary>
 /// <param name="chartLine">The chart line.</param>
 public ChartLineBuilder(ChartLine chartLine)
     : base(chartLine)
 {
     line = chartLine;
 }
Example #34
0
 public ErrorBarsBase()
 {
     Line = new ChartLine();
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartMajorTicksBuilder" /> class.
 /// </summary>
 /// <param name="chartLine">The chart line.</param>
 public ChartMajorTicksBuilder(ChartLine chartLine)
     : base(chartLine)
 {
     line = chartLine;
 }
Example #36
0
 public ChartLineSerializer(ChartLine line)
     : base(line)
 {
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartLineBuilder" /> class.
 /// </summary>
 /// <param name="chartLine">The chart line.</param>
 public ChartLineBuilderBase(ChartLine chartLine)
 {
     line = chartLine;
 }
 public ChartLineSerializerTests()
 {
     line = new ChartLine();
     serializer = new ChartLineSerializer(line);
 }
Example #39
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ChartSeriesHighlight" /> class.
 /// </summary>
 public ChartSeriesHighlight()
 {
     Border = new ChartElementBorder();
     Line = new ChartLine();
 }
Example #40
0
 /// <summary>
 /// Initializes a new instance of the <see cref="GugeLineBuilder" /> class.
 /// </summary>
 /// <param name="gaugeLine">The chart line.</param>
 public GaugeLineBuilder(ChartLine gaugeLine)
     : base(gaugeLine)
 {
     line = gaugeLine;
 }
        public ChartLine AttachDataSet(IChart chart, MultiDimensionalPoint point, int pointDimension, object tag)
        {
            var chartPoints = new ChartPoint[pointDimension];
            var chartLineSegments = new ChartLineSegment[pointDimension - 1];

            for (int i = 0; i < pointDimension; i++)
            {
                chartPoints[i] = new ChartPoint { Data = point };
                chart.Axes[i].Points.Add(chartPoints[i]);
                chart.Axes[i].Transformation.Transform(chart.Axes[i], chartPoints[i]);
            }

            for (int i = 0; i < pointDimension - 1; i++)
            {
                chartLineSegments[i] = new ChartLineSegment(chartPoints[i], chartPoints[i + 1]);
            }

            foreach (var chartPoint in chartPoints)
            {
                chart.Points.Add(chartPoint);
            }

            var line = new ChartLine(chartLineSegments) { Tag = tag };
            chart.Lines.Add(line);

            return line;
        }