private void UpdatePoint(Point mousePoint) { // On Mouse-move, update the latest point if (_dataSeries != null) { _dataSeries.XValues[_dataSeries.Count - 1] = (DateTime)XAxis.GetDataValue(mousePoint.X); _dataSeries.YValues[_dataSeries.Count - 1] = (double)YAxis.GetDataValue(mousePoint.Y); _dataSeries.InvalidateParentSurface(RangeMode.None); } }
private void AppendPoint(Point mousePoint) { // On Mouse-down, append another point if (_dataSeries != null) { _dataSeries.Append( (DateTime)XAxis.GetDataValue(mousePoint.X), (double)YAxis.GetDataValue(mousePoint.Y)); } }
/// <summary> /// Called internally to marshal pixel points to X1,Y1,X2,Y2 values. /// Taking a pixel point (<paramref name="newPoint"/>) and base point <paramref name="index"/>, sets the X,Y data-values. /// </summary> /// <param name="newPoint">The pixel point</param> /// <param name="index">The base point index, where 0, 1, 2, 3 refer to the four corners of an Annotation</param> /// <param name="yAxis">The current Y-Axis</param> /// <param name="xAxis">The current X-Axis </param> protected override void SetBasePoint(Point newPoint, int index, IAxis xAxis, IAxis yAxis) { var xValue = XAxis.GetDataValue(newPoint.X); var yValue = YAxis.GetDataValue(newPoint.Y); var lineAnnotations = Annotations; if (index == 0) { lineAnnotations[0].X1 = xValue; lineAnnotations[0].Y1 = yValue; lineAnnotations[3].X2 = xValue; lineAnnotations[3].Y2 = yValue; } else if (index == 1) { lineAnnotations[1].X1 = xValue; lineAnnotations[1].Y1 = yValue; lineAnnotations[0].X2 = xValue; lineAnnotations[0].Y2 = yValue; } else if (index == 2) { lineAnnotations[2].X1 = xValue; lineAnnotations[2].Y1 = yValue; lineAnnotations[1].X2 = xValue; lineAnnotations[1].Y2 = yValue; } else { lineAnnotations[3].X1 = xValue; lineAnnotations[3].Y1 = yValue; lineAnnotations[2].X2 = xValue; lineAnnotations[2].Y2 = yValue; } }