public void CombineWith(ElementValuesJournal nextElementValuesJournal) { DoubleValueStatusCodes.Add(nextElementValuesJournal.DoubleValueStatusCodes); DoubleTimestamps.Add(nextElementValuesJournal.DoubleTimestamps); DoubleValues.Add(nextElementValuesJournal.DoubleValues); UintValueStatusCodes.Add(nextElementValuesJournal.UintValueStatusCodes); UintTimestamps.Add(nextElementValuesJournal.UintTimestamps); UintValues.Add(nextElementValuesJournal.UintValues); }
public void CombineWith(ElementValuesCollection nextElementValuesCollection) { Guid = nextElementValuesCollection.Guid; NextCollectionGuid = nextElementValuesCollection.NextCollectionGuid; DoubleAliases.Add(nextElementValuesCollection.DoubleAliases); DoubleValueStatusCodes.Add(nextElementValuesCollection.DoubleValueStatusCodes); DoubleTimestamps.Add(nextElementValuesCollection.DoubleTimestamps); DoubleValues.Add(nextElementValuesCollection.DoubleValues); UintAliases.Add(nextElementValuesCollection.UintAliases); UintValueStatusCodes.Add(nextElementValuesCollection.UintValueStatusCodes); UintTimestamps.Add(nextElementValuesCollection.UintTimestamps); UintValues.Add(nextElementValuesCollection.UintValues); ObjectAliases.Add(nextElementValuesCollection.ObjectAliases); ObjectValueStatusCodes.Add(nextElementValuesCollection.ObjectValueStatusCodes); ObjectTimestamps.Add(nextElementValuesCollection.ObjectTimestamps); ObjectValues = Google.Protobuf.ByteString.CopyFrom( ObjectValues.Concat(nextElementValuesCollection.ObjectValues).ToArray() ); }
private static IValues <double> CreateValues(int index) { var values = new DoubleValues(Width * Height); var random = new Random(); var angle = Math.PI * 2 * index / SeriesPerPeriod; var cx = 150; var cy = 100; for (int x = 0; x < Width; x++) { for (int y = 0; y < Height; y++) { var v = (1 + Math.Sin(x * 0.04 + angle)) * 50 + (1 + Math.Sin(y * 0.1 + angle)) * 50 * (1 + Math.Sin(angle * 2)); var r = Math.Sqrt((x - cx) * (x - cx) + (y - cy) * (y - cy)); var exp = Math.Max(0, 1 - r * 0.008); values.Add(v * exp + random.NextDouble() * 50); } } return(values); }
public void AddValue(Parameter param) { switch (param.StorageType) { case StorageType.ElementId: ElementId eId = param.AsElementId(); if (eId != ElementId.InvalidElementId && !ElementIDValues.Contains(eId)) { ElementIDValues.Add(eId); } break; case StorageType.Double: double dbl = param.AsDouble(); if (!DoubleValues.Contains(dbl)) { DoubleValues.Add(dbl); } break; case StorageType.Integer: int intVal = param.AsInteger(); if (!IntValues.Contains(intVal)) { IntValues.Add(intVal); } break; case StorageType.String: string str = param.AsString(); if (!string.IsNullOrEmpty(str) && !StringValues.Contains(str)) { StringValues.Add(str); } break; } }
private void CreateCollectionVariable(List <string> lst, int type) { for (int i = 0; i < lst.Count; i++) { if (type == 0) { BitVar bv = new BitVar("Klapany"); bv.VarName = lst[i]; BitValues.Add(bv); } if (type == 1) { BoolVar bov = new BoolVar("Klapany"); bov.VarName = lst[i]; BoolValues.Add(bov); } if (type == 2) { IntVar iv = new IntVar("Klapany"); iv.VarName = lst[i]; IntValues.Add(iv); } if (type == 3) { DoubleVar dv = new DoubleVar("Klapany"); dv.VarName = lst[i]; DoubleValues.Add(dv); } if (type == 4) { BoolVarFMS bvfms = new BoolVarFMS("Klapany"); bvfms.VarName = lst[i]; BoolFMSValues.Add(bvfms); } } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); // Set our view from the "main" layout resource SetContentView(Resource.Layout.Main); // Get our chart from the layout resource, var chart = FindViewById <SciChartSurface>(Resource.Id.Chart); // Create a numeric X axis var xAxis = new NumericAxis(this) { AxisTitle = "Number of Samples (per Series)" }; // Create a numeric Y axis var yAxis = new NumericAxis(this) { AxisTitle = "Value", VisibleRange = new DoubleRange(-1, 1) }; // Add xAxis to the XAxes collection of the chart chart.XAxes.Add(xAxis); // Add yAxis to the YAxes collection of the chart chart.YAxes.Add(yAxis); // Create XyDataSeries to host data for our chart var lineData = new XyDataSeries <double, double>() { SeriesName = "Sin(x)" }; var scatterData = new XyDataSeries <double, double>() { SeriesName = "Cos(x)" }; // Append data which should be drawn for (var i = 0; i < 1000; i++) { lineData.Append(i, Math.Sin(i * 0.1)); scatterData.Append(i, Math.Cos(i * 0.1)); } double phase = 0; var timer = new Timer(30) { AutoReset = true }; var lineBuffer = new DoubleValues(1000); var scatterBuffer = new DoubleValues(1000); // Update on each tick of timer timer.Elapsed += (s, e) => { lineBuffer.Clear(); scatterBuffer.Clear(); for (int i = 0; i < 1000; i++) { lineBuffer.Add(Math.Sin(i * 0.1 + phase)); scatterBuffer.Add(Math.Cos(i * 0.1 + phase)); } using (chart.SuspendUpdates()) { lineData.UpdateRangeYAt(0, lineBuffer); scatterData.UpdateRangeYAt(0, scatterBuffer); } phase += 0.01; }; timer.Start(); var lineSeries = new FastLineRenderableSeries() { DataSeries = lineData, StrokeStyle = new SolidPenStyle(Color.LightBlue, 2) }; // Create scatter series with data appended into scatterData var scatterSeries = new XyScatterRenderableSeries() { DataSeries = scatterData, PointMarker = new EllipsePointMarker() { Width = 10, Height = 10, StrokeStyle = new SolidPenStyle(Color.Green, 2), FillStyle = new SolidBrushStyle(Color.LightBlue) } }; // Add the renderable series to the RenderableSeries collection of the chart chart.RenderableSeries.Add(lineSeries); chart.RenderableSeries.Add(scatterSeries); // Create interactivity modifiers var pinchZoomModifier = new PinchZoomModifier(); pinchZoomModifier.SetReceiveHandledEvents(true); var zoomPanModifier = new ZoomPanModifier(); zoomPanModifier.SetReceiveHandledEvents(true); var zoomExtentsModifier = new ZoomExtentsModifier(); zoomExtentsModifier.SetReceiveHandledEvents(true); var yAxisDragModifier = new YAxisDragModifier(); yAxisDragModifier.SetReceiveHandledEvents(true); // Create and configure legend var legendModifier = new LegendModifier(this); legendModifier.SetLegendPosition(GravityFlags.Bottom | GravityFlags.CenterHorizontal, 10); legendModifier.SetOrientation(Orientation.Horizontal); // Create RolloverModifier to show tooltips var rolloverModifier = new RolloverModifier(); rolloverModifier.SetReceiveHandledEvents(true); // Create modifier group from declared modifiers var modifiers = new ModifierGroup(pinchZoomModifier, zoomPanModifier, zoomExtentsModifier, yAxisDragModifier, rolloverModifier, legendModifier); // Add the interactions to the ChartModifiers collection of the chart chart.ChartModifiers.Add(modifiers); }
public virtual void ReadFrom(XElement xE) { FeedAttributeId = null; IntegerValue = null; DoubleValue = null; BooleanValue = null; StringValue = null; IntegerValues = null; DoubleValues = null; BooleanValues = null; StringValues = null; MoneyWithCurrencyValue = null; foreach (var xItem in xE.Elements()) { var localName = xItem.Name.LocalName; if (localName == "feedAttributeId") { FeedAttributeId = long.Parse(xItem.Value); } else if (localName == "integerValue") { IntegerValue = long.Parse(xItem.Value); } else if (localName == "doubleValue") { DoubleValue = double.Parse(xItem.Value); } else if (localName == "booleanValue") { BooleanValue = bool.Parse(xItem.Value); } else if (localName == "stringValue") { StringValue = xItem.Value; } else if (localName == "integerValues") { if (IntegerValues == null) { IntegerValues = new List <long>(); } IntegerValues.Add(long.Parse(xItem.Value)); } else if (localName == "doubleValues") { if (DoubleValues == null) { DoubleValues = new List <double>(); } DoubleValues.Add(double.Parse(xItem.Value)); } else if (localName == "booleanValues") { if (BooleanValues == null) { BooleanValues = new List <bool>(); } BooleanValues.Add(bool.Parse(xItem.Value)); } else if (localName == "stringValues") { if (StringValues == null) { StringValues = new List <string>(); } StringValues.Add(xItem.Value); } else if (localName == "moneyWithCurrencyValue") { MoneyWithCurrencyValue = new MoneyWithCurrency(); MoneyWithCurrencyValue.ReadFrom(xItem); } } }
public ExecutionState LoadData(ByteReader br) { while (br.Avaliable > 0) { var Name = br.ReadString(); if (!Name) { return(ExecutionState.Failed()); } var Type = br.ReadByte(); if (!Type) { return(ExecutionState.Failed()); } if (!DataTypeHelper.TryParse(Type.Result, out DataType TypeResult)) { return(ExecutionState.Failed()); } switch (TypeResult) { case DataType.type_byte: var ValueByte = br.ReadByte(); if (!ValueByte) { return(ExecutionState.Failed()); } if (ByteValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } ByteValues.Add(Name.Result, ValueByte.Result); break; case DataType.type_sbyte: var ValueSByte = br.ReadSByte(); if (!ValueSByte) { return(ExecutionState.Failed()); } if (SByteValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } SByteValues.Add(Name.Result, ValueSByte.Result); break; case DataType.type_short: var ValueShort = br.ReadShort(); if (!ValueShort) { return(ExecutionState.Failed()); } if (ShortValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } ShortValues.Add(Name.Result, ValueShort.Result); break; case DataType.type_ushort: var ValueUShort = br.ReadUShort(); if (!ValueUShort) { return(ExecutionState.Failed()); } if (UShortValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } UShortValues.Add(Name.Result, ValueUShort.Result); break; case DataType.type_int: var ValueInt = br.ReadInt(); if (!ValueInt) { return(ExecutionState.Failed()); } if (IntValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } IntValues.Add(Name.Result, ValueInt.Result); break; case DataType.type_uint: var ValueUInt = br.ReadUInt(); if (!ValueUInt) { return(ExecutionState.Failed()); } if (UIntValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } UIntValues.Add(Name.Result, ValueUInt.Result); break; case DataType.type_long: var ValueLong = br.ReadLong(); if (!ValueLong) { return(ExecutionState.Failed()); } if (LongValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } LongValues.Add(Name.Result, ValueLong.Result); break; case DataType.type_ulong: var ValueULong = br.ReadULong(); if (!ValueULong) { return(ExecutionState.Failed()); } if (ULongValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } ULongValues.Add(Name.Result, ValueULong.Result); break; case DataType.type_single: var ValueSingle = br.ReadSingle(); if (!ValueSingle) { return(ExecutionState.Failed()); } if (SingleValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } SingleValues.Add(Name.Result, ValueSingle.Result); break; case DataType.type_double: var ValueDobule = br.ReadDouble(); if (!ValueDobule) { return(ExecutionState.Failed()); } if (DoubleValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } DoubleValues.Add(Name.Result, ValueDobule.Result); break; case DataType.type_string: var ValueString = br.ReadString(); if (!ValueString) { return(ExecutionState.Failed()); } if (StringValues.ContainsKey(Name.Result)) { return(ExecutionState.Failed()); } StringValues.Add(Name.Result, ValueString.Result); break; } } return(ExecutionState.Succeeded()); }