private void SetOfftrackPoints(DriverOfftrackLine line)
        {
            line.Line.Points.Clear();
            int count = 0;
            foreach (var offtrack in line.Driver.Driver.OfftrackHistory.Offtracks.OrderBy(o => o.StartTime))
            {
                var x = offtrack.StartTime;
                line.Line.AddPoint(x, count);
                line.Line.AddPoint(x, ++count);
            }

            if (Connection.Instance.IsRunning && !Connection.Instance.IsSimulated)
            {
                // add final point on current time
                line.Line.AddPoint(Simulator.Instance.Telemetry.SessionTime.Value, count);
            }
        }
        private DriverOfftrackLine GetLine(DriverContainer driver)
        {
            DriverOfftrackLine line;

            if (!_lines.ContainsKey(driver.Driver.Id))
            {
                line = new DriverOfftrackLine();
                line.Driver = driver;
                line.Line = _chart.CreateXY();
                line.Line.IsHitTest = true;
                line.Line.LineThickness = 2;
                line.Line.LineColor = GetColor();
                //line.Line.LegendColor = line.Line.LineColor;
                //line.Line.Label = driver.Driver.ShortName;
                //line.Line.LegendLabel = new ColorLabel(driver.Driver.ShortName, Colors.White);
                
                _lines.Add(driver.Driver.Id, line);
            }
            else
            {
                line = _lines[driver.Driver.Id];
            }

            this.SetOfftrackPoints(line);

            line.Taken = true;
            return line;
        }