internal NumericVariable(string kind, TimeSeriesExpression filter, TimeSeriesExpression value, InterpolationOperation interpolation, TimeSeriesExpression aggregation) : base(kind, filter) { Value = value; Interpolation = interpolation; Aggregation = aggregation; Kind = kind ?? "numeric"; }
internal CategoricalVariable(string kind, TimeSeriesExpression filter, TimeSeriesExpression value, InterpolationOperation interpolation, IList <TimeSeriesAggregateCategory> categories, TimeSeriesDefaultCategory defaultCategory) : base(kind, filter) { Value = value; Interpolation = interpolation; Categories = categories; DefaultCategory = defaultCategory; Kind = kind ?? "categorical"; }
internal static NumericVariable DeserializeNumericVariable(JsonElement element) { TimeSeriesExpression value = default; Optional <InterpolationOperation> interpolation = default; TimeSeriesExpression aggregation = default; string kind = default; Optional <TimeSeriesExpression> filter = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { value = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } if (property.NameEquals("interpolation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } interpolation = InterpolationOperation.DeserializeInterpolationOperation(property.Value); continue; } if (property.NameEquals("aggregation")) { aggregation = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("filter")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } filter = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } } return(new NumericVariable(kind, filter.Value, value, interpolation.Value, aggregation)); }
private async Task HandleMarkers(InterpolationOperation operation) { if (operation.Markers != null && operation.Markers.Length != 0) { SearchingGraphObject SGObj = (SearchingGraphObject)BindingContext; if (CurrentMarkers.Count() != 0) { // change colour of current markers on graph ClearMarkersOnGraph(CurrentMarkers); await Task.Delay(SGObj.SpeedDictionary[SGObj.Speed]); } // add new markers foreach (Entry entry in operation.Markers) { int index = CurrentEntriesOnGraph.ToList().IndexOf(entry); CurrentEntriesOnGraph.ToArray()[index].Color = SKColor.Parse(operation.ChangeToColour); CurrentMarkers.Add(entry); } DisplayGraph(CurrentEntriesOnGraph); await Task.Delay(SGObj.SpeedDictionary[SGObj.Speed]); } }
internal static CategoricalVariable DeserializeCategoricalVariable(JsonElement element) { TimeSeriesExpression value = default; Optional <InterpolationOperation> interpolation = default; Optional <IList <TimeSeriesAggregateCategory> > categories = default; TimeSeriesDefaultCategory defaultCategory = default; string kind = default; Optional <TimeSeriesExpression> filter = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) { value = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } if (property.NameEquals("interpolation")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } interpolation = InterpolationOperation.DeserializeInterpolationOperation(property.Value); continue; } if (property.NameEquals("categories")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } List <TimeSeriesAggregateCategory> array = new List <TimeSeriesAggregateCategory>(); foreach (var item in property.Value.EnumerateArray()) { array.Add(TimeSeriesAggregateCategory.DeserializeTimeSeriesAggregateCategory(item)); } categories = array; continue; } if (property.NameEquals("defaultCategory")) { defaultCategory = TimeSeriesDefaultCategory.DeserializeTimeSeriesDefaultCategory(property.Value); continue; } if (property.NameEquals("kind")) { kind = property.Value.GetString(); continue; } if (property.NameEquals("filter")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } filter = TimeSeriesExpression.DeserializeTimeSeriesExpression(property.Value); continue; } } return(new CategoricalVariable(kind, filter.Value, value, interpolation.Value, Optional.ToList(categories), defaultCategory)); }