/// <summary> /// Provides derived classes an opportunity to handle changes to the HorizontalScaleIndex property. /// </summary> /// <param name="newIndex"> /// The new Index. /// </param> private void OnHorizontalScaleIndexChanged(int newIndex) { string config; if (HorizontalScales.TryGetValue(newIndex, out config) == false) { return; } var curMax = this.AxisX.Max; var items = config.Split(','); string desiredSpan; if (items[0].TryConvertTo(out desiredSpan)) { this.TimeSpan = TimeSpan.Parse(desiredSpan); } //if (this.IsStaticCursor) //{ // //this.MinDateTime = Math2.DoubleToDateTime(this._oldPosition) - // // TimeSpan.FromSeconds(this.CurrentTimeSpan.TotalSeconds / 2); //} //else { this.MinDateTime = Math2.DoubleToDateTime(curMax) - this.CurrentTimeSpan; if (this.IsTracking) { this.MoveCursorToLast(); } } this.AdjustCursorPos(); }
/// <summary> /// Called when [data cursor moved to]. /// </summary> /// <param name="infos">The infos.</param> /// <param name="xValue">The x value.</param> /// <param name="yValue">The y value.</param> public void OnDataCursorMovedTo(IChannelInfos infos, double xValue, double yValue) { if (DoubleUtil.AreClose(this._oldPosition, xValue) == false) { this._oldPosition = xValue; var positionAsDateTime = Math2.DoubleToDateTime(xValue); this.CursorPosition = positionAsDateTime; } var pen = infos as PenDeltaV; if (pen != null) { pen.ValueAtCursor = yValue; var cursorPosition = this.CursorPosition; var timeStamp = $"{cursorPosition.Day:00}/{cursorPosition.Month:00}/{cursorPosition.Year - 2000} {cursorPosition.Hour:00}:{cursorPosition.Minute:00}:{cursorPosition.Second:00}"; pen.TimeStamp = timeStamp; } }