public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { int maxValue = (int)values[0]; int minValue = (int)values[1]; double graphHeight = (double)values[2]; double graphWidth = (double)values[3]; ObservableCollection <HRData> hrData = (ObservableCollection <HRData>)values[4]; int numOfVisibleItems = (int)values[5]; IList <int> bpms = new List <int>(); for (int hrDataIndex = 0; hrDataIndex < hrData.Count; hrDataIndex++) { bpms.Add(hrData[hrDataIndex].Bpm); } int valuesRange = maxValue - minValue; IList <Point> normalizedToGraphBpms = new List <Point>(); for (int i = 0; i < bpms.Count; i++) { Point point = new Point(); if (i == 0) { point = new Point(0, ScaleConverterUtility.GetTopOffset(graphHeight, bpms[i], minValue, maxValue)); } else { point = new Point(normalizedToGraphBpms[i - 1].X + (ScaleConverterUtility.GetLeftOffset(graphWidth, numOfVisibleItems)), ScaleConverterUtility.GetTopOffset(graphHeight, bpms[i], minValue, maxValue)); } normalizedToGraphBpms.Add(point); } return(normalizedToGraphBpms); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { int index = (int)values[0]; double graphWidth = (double)values[1]; int numOfVisibleItems = (int)values[2]; double leftMargin = (ScaleConverterUtility.GetLeftOffset(graphWidth, numOfVisibleItems)) * index; return(new Thickness(leftMargin - 5, 0, 0, 0)); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { int itemsCount = (int)values[0]; var item = (HRData)values[1]; int itemIndex = item.Index; double graphWidth = (double)values[2]; double graphHeight = (double)values[3]; if (itemIndex == 0) { return(new Thickness(-15, graphHeight, 0, 0)); } double leftMargin = (ScaleConverterUtility.GetLeftOffset(graphWidth, itemsCount)) * itemIndex; return(new Thickness(leftMargin - 15, graphHeight, 0, 0)); }