public static DataItem getNewItem(List <DataItem> array, int index) { var random = new Random(); var lastItem = DataChartSharedData.getLastItem(array); var newValue = lastItem.Value + random.NextDouble() * 4.0 - 2.0; return(new DataItem { Label = index.ToString(), Value = newValue }); }
public static List <DataItem> getDataItems(double startValue, int maxPoints, bool useShortLabels) { var data = new List <DataItem>(); var value = startValue; var random = new Random(); for (var i = 0; i <= maxPoints; i++) { value += random.NextDouble() * 4.0 - 2.0; var v = Math.Round(value); var l = i.ToString(); if (useShortLabels) { l = DataChartSharedData.toShortString(i); } data.Add(new DataItem { Label = l, Value = v }); } return(data); }