public override void Update() { var xyRenderPassData = (OhlcRenderPassData)RenderableSeries.CurrentRenderPassData; var xValues = xyRenderPassData.XValues; var x1 = (double)_annotation.X1Value; var x2 = (double)_annotation.X2Value; var min = Math.Min(x1, x2); var max = Math.Max(x1, x2); _colors.Clear(); for (int i = 0; i < xyRenderPassData.PointsCount(); i++) { var value = xValues.Get(i); if (value > min && value < max) { _colors.Add(_color); } else { _colors.Add(DefaultColor); } } }
private void DoAppendLoop(Random random) { using (Surface.SuspendUpdates()) { _xValues.Clear(); _firstYValues.Clear(); _secondYValues.Clear(); _thirdYValues.Clear(); for (var i = 0; i < BufferSize; i++) { _xValue++; _yValue += random.NextDouble() - 0.5; _xValues.Add(_xValue); _firstYValues.Add((float)_yValue); _secondYValues.Add((float)_maLow.Push(_yValue).Current); _thirdYValues.Add((float)_maHigh.Push(_yValue).Current); } _mainSeries.Append(_xValues, _firstYValues); _maLowSeries.Append(_xValues, _secondYValues); _maHighSeries.Append(_xValues, _thirdYValues); var count = _mainSeries.Count + _maLowSeries.Count + _maHighSeries.Count; var text = "Amount of points: " + count; // need to set text from UI thread to prevent exception _uiThreadHandler.Post(() => { _textView.SetText(text, TextView.BufferType.Normal); }); } }
private void DoAppendLoop() { using (Surface.SuspendUpdates()) { _xValues.Clear(); _firstYValues.Clear(); _secondYValues.Clear(); _thirdYValues.Clear(); for (var i = 0; i < BufferSize; i++) { _xValue++; _yValue += _random.NextDouble() - 0.5; _xValues.Add(_xValue); _firstYValues.Add((float)_yValue); _secondYValues.Add((float)_maLow.Push(_yValue).Current); _thirdYValues.Add((float)_maHigh.Push(_yValue).Current); } _mainSeries.Append(_xValues, _firstYValues); _maLowSeries.Append(_xValues, _secondYValues); _maHighSeries.Append(_xValues, _thirdYValues); } }
private void AccelY_doAppendLoop(double[] dataMean, double[] dataVar) { int len = dataMean.Length; IntegerValues XValues = new IntegerValues(len); FloatValues YValues_mean = new FloatValues(len); FloatValues YValues_var = new FloatValues(len); using (g_accelY_Surface.SuspendUpdates()) { g_accelY_XValue++; XValues.Clear(); YValues_mean.Clear(); YValues_var.Clear(); for (var i = 0; i < dataMean.Length; i++) { XValues.Add(g_accelY_XValue); YValues_mean.Add((float)dataMean[i]); YValues_var.Add((float)dataVar[i]); } g_accelY_MeanSeries.Append(XValues, YValues_mean); g_accelY_VarSeries.Append(XValues, YValues_var); } }
public override void Update() { _colors.Clear(); var pointsCount = RenderableSeries.CurrentRenderPassData.PointsCount(); for (int i = 0; i < pointsCount; i++) { _colors.Add((int)_desiredColors[i % 3]); } }
/// <summary> /// Inserts all of the values that were specified without keys at the first open integer indexes. /// </summary> public void NormalizeValues() { for (int autoInt = 0; autoInt < AutoIntegerValues.Count; autoInt++) { for (int i = 0;; i++) { if (!IntegerValues.ContainsKey(i)) { IntegerValues.Add(i, AutoIntegerValues[autoInt]); break; } } } AutoIntegerValues.Clear(); /* Rest of the code in C++ is simply outputting the table to the console (I think), probably for debugging purposes */ }
public bool InsertValue(ASTExpressionBase key, ASTExpressionBase value) { if (key == null) { AutoIntegerValues.Add(AutoIntegerValues.Count, new ASTTableElement(AutoIntegerValues.Count, value)); return(true); } if (key.Type == ExpressionType.NUMBER) { var numberKey = key as ASTNumber; if (IntegerValues.ContainsKey((int)numberKey.Value)) // TODO: Do something to stop this from possibly crashing.. someday. (double to int cast) { return(false); } IntegerValues.Add((int)numberKey.Value, new ASTTableElement((int)numberKey.Value, value)); } else if (key.Type == ExpressionType.STRING) { var stringKey = key as ASTString; if (StringValues.ContainsKey(stringKey.Text)) { return(false); } StringValues.Add(stringKey.Text, new ASTTableElement(stringKey.Text, value)); } else if (key.Type == ExpressionType.IDENTIFIER) { var identifierKey = key as ASTIdentifier; if (StringValues.ContainsKey(identifierKey.Name)) { return(false); } StringValues.Add(identifierKey.Name, new ASTTableElement(identifierKey.Name, value)); } else { return(false); } return(true); }
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); } } }