public void Update() { var xList = ChartView.GetDataKeyList(); var yList = ChartView.GetDataValueList(); if ((double)_verticals[0].X1 < xList.Min()) { _verticals[0].X1 = xList.Min(); } else if ((double)_verticals[0].X1 >= xList.Max()) { _verticals[0].X1 = xList.Max(); } if ((double)_verticals[1].X1 < xList.Min()) { _verticals[1].X1 = xList.Min(); } else if ((double)_verticals[1].X1 >= xList.Max()) { _verticals[1].X1 = xList.Max(); } Width = Math.Round(Math.Abs( (double)(_verticals[0].X1) - (double)(_verticals[1].X1)), 6); Value2 = String.Format("Width:{0:0.######}", Width); var dataSeries = ChartView.GetRenderableSeriesCollection()[0].DataSeries; var startVertical = (double)(_verticals[0].X1) > (double)(_verticals[1].X1) ? (double)(_verticals[1].X1) : (double)(_verticals[0].X1); var endVertical = (double)(_verticals[0].X1) > (double)(_verticals[1].X1) ? (double)(_verticals[0].X1) : (double)(_verticals[1].X1); var startIndex = dataSeries.FindIndex(startVertical, SciChart.Charting.Common.Extensions.SearchMode.Nearest); var endIndex = dataSeries.FindIndex(endVertical, SciChart.Charting.Common.Extensions.SearchMode.Nearest); int subRangeLength = endIndex - startIndex + 1; List <double> yValues = new List <double>(); for (int i = startIndex; i <= endIndex; i++) { yValues.Add((double)dataSeries.YValues[i]); } double min = yValues.Min(); double max = yValues.Max(); Min = Math.Round(min, 6); Value3 = String.Format("Min:{0:0.######}", Min); Max = Math.Round(max, 6); Value4 = String.Format("Max:{0:0.######}", Max); Height = Math.Round(Math.Abs(Min - Max), 6); Value1 = String.Format("Height:{0:0.######}", Height); }
public void Update() { var xList = ChartView.GetDataKeyList(); var yList = ChartView.GetDataValueList(); if ((double)_horizontals[0].Y1 < yList.Min()) { _horizontals[0].Y1 = yList.Min(); } else if ((double)_horizontals[0].Y1 >= yList.Max()) { _horizontals[0].Y1 = yList.Max(); } if ((double)_horizontals[1].Y1 < yList.Min()) { _horizontals[1].Y1 = yList.Min(); } else if ((double)_horizontals[1].Y1 >= yList.Max()) { _horizontals[1].Y1 = yList.Max(); } if ((double)_verticals[0].X1 < xList.Min()) { _verticals[0].X1 = xList.Min(); } else if ((double)_verticals[0].X1 >= xList.Max()) { _verticals[0].X1 = xList.Max(); } if ((double)_verticals[1].X1 < xList.Min()) { _verticals[1].X1 = xList.Min(); } else if ((double)_verticals[1].X1 >= xList.Max()) { _verticals[1].X1 = xList.Max(); } Height = Math.Round(Math.Abs( (double)(_horizontals[0].Y1) - (double)(_horizontals[1].Y1)), 6); Value1 = String.Format("Height:{0:0.######}", Height.ToString()); Width = Math.Round(Math.Abs( (double)(_verticals[0].X1) - (double)(_verticals[1].X1)), 6); Value2 = String.Format("Width:{0:0.######}", Width.ToString()); }