public async Task <DataPoints <DateTime, double> > GetDailyCostGraphData() { Procedures proc = new Procedures(_db, _config); var ret = await proc.SummaryPeriodCostsAsync(Procedures.Period.Daily); var outV = new DataPoints <DateTime, double>(); var dummyHours = new List <DateTime>(); for (int i = 0; i < 24; i++) { DateTime tempTime = DateTime.Now; DateTime returnV = new DateTime(tempTime.Year, tempTime.Month, tempTime.Day, i, 0, 0); for (int j = 0; j < ret.Count(); j++) { if (ret.ElementAt(j).dataPoints.Count < 1) { continue; } var dateValue = ret.ElementAt(j).getvalueT(); var reading = ret.ElementAt(j).getValueY(); if (dateValue.ElementAt(0).Hour == returnV.Hour) { outV.AddPoint(dateValue.ElementAt(0), reading.ElementAt(0)); } else { outV.AddPoint(dateValue.ElementAt(0), 0); } } } return(outV); }
public void FollowCurrentPoint(int pointIndex, bool force = false, Direction dir = Direction.forward) { if (followMode || force) { DataPoint p = DataPoints.GetPoint(pointIndex); Transform t = mainCamera.transform.root; t.position = p.GetPosition(); if (lastPoint != null) { Vector3 pathForwardDirection = p.GetPosition() - lastPoint.GetPosition(); pathForwardDirection.y = 0; if (dir == Direction.backward) { pathForwardDirection *= -1; } if (pathForwardDirection.magnitude > 0.01f) { t.forward = pathForwardDirection; } } car.transform.position = p.GetPosition(); car.transform.rotation = p.GetRotation(); graphAnchor.UpdatePosition(); tractionCircleAnchor.UpdatePosition(); currentFollowIndex = pointIndex; lastPoint = p; } }
public ViewModel() { this.DataPoints = new ObservableCollection <Model>(); DateTime year = new DateTime(2005, 5, 1); DataPoints.Add(new Model() { Year = year.AddYears(1), India = 28, Germany = 31, England = 36, France = 39 }); DataPoints.Add(new Model() { Year = year.AddYears(2), India = 25, Germany = 28, England = 32, France = 36 }); DataPoints.Add(new Model() { Year = year.AddYears(3), India = 26, Germany = 30, England = 34, France = 40 }); DataPoints.Add(new Model() { Year = year.AddYears(4), India = 27, Germany = 36, England = 41, France = 44 }); DataPoints.Add(new Model() { Year = year.AddYears(5), India = 32, Germany = 36, England = 42, France = 45 }); DataPoints.Add(new Model() { Year = year.AddYears(6), India = 35, Germany = 39, England = 42, France = 48 }); DataPoints.Add(new Model() { Year = year.AddYears(7), India = 30, Germany = 38, England = 43, France = 46 }); }
public async void OpenDataPoints(int index, DataPoints point) { FreshMasterDetailNavigation nav = App.GetNavigationContainer(); switch (point) { case DataPoints.BloodSugar: await nav.PushPage(new AddBloodSugarPage(pluginCollector, SettingsModel.BloodSugarDataPoints[index]), null, false, true); //CoreMethods.PushPageModel<AddBloodSugarPageModel>(null, true); break; case DataPoints.Meal: await nav.PushPage(new AddMealPage(pluginCollector, SettingsModel.MealDataPoints[index]), null, false, true); break; case DataPoints.Medicine: await nav.PushPage(new AddMedicinePage(pluginCollector, SettingsModel.MedicineDataPoints[index]), null, false, true); break; } }
/// <inheritdoc /> public double CalculateDifficulty() { // Calculate energy, semantic, and error range values double energyExerted = CalculateEnergyExerted(); double semanticBonus = CalculateSemanticBonus(); double imprecision = CalculateImprecision(); // Add to exertion values _speed += energyExerted; _stamina += energyExerted; // Recover exertion values (note this is done after exertion values are added so the current action is included in the recovery) (this needs to be revisited) _speed *= 1 - SpeedRecovery(_deltaTime, energyExerted); _stamina *= 1 - StaminaRecovery(_deltaTime, energyExerted); // Imprecision for binary skills (clicking) is the hit window, // and for dimensional skills, is the time spent within the error range when moving in the expected path according to flow and snap motions double rawDifficulty = 1 / imprecision; double speedBonus = _speed * SpeedWeight; double staminaBonus = _stamina * StaminaWeight; // Data points DataPoints.Add("Current Speed", _speed); DataPoints.Add("Current Stamina", _stamina); DataPoints.Add("Imprecision", imprecision); return rawDifficulty * (1 + semanticBonus) * (1 + speedBonus) * (1 + staminaBonus); }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (Name != null) { hashCode = hashCode * 59 + Name.GetHashCode(); } if (Per100g != null) { hashCode = hashCode * 59 + Per100g.GetHashCode(); } if (MeasurementUnit != null) { hashCode = hashCode * 59 + MeasurementUnit.GetHashCode(); } if (Rank != null) { hashCode = hashCode * 59 + Rank.GetHashCode(); } if (DataPoints != null) { hashCode = hashCode * 59 + DataPoints.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } return(hashCode); } }
public TooltipViewModel() { this.DataPoints = new ObservableCollection <TooltipModel>(); DateTime year = new DateTime(2005, 5, 1); DataPoints.Add(new TooltipModel() { Year = "2005", Germany = 21, England = 28 }); DataPoints.Add(new TooltipModel() { Year = "2006", Germany = 24, England = 44 }); DataPoints.Add(new TooltipModel() { Year = "2007", Germany = 36, England = 48 }); DataPoints.Add(new TooltipModel() { Year = "2008", Germany = 38, England = 50 }); DataPoints.Add(new TooltipModel() { Year = "2009", Germany = 54, England = 66 }); DataPoints.Add(new TooltipModel() { Year = "2010", Germany = 57, England = 78 }); DataPoints.Add(new TooltipModel() { Year = "2011", Germany = 70, England = 84 }); }
private void ExecuteOpenDataPointsCommand() { DataPointsViewModel dpvm = new DataPointsViewModel(); if (dpvm.IsOpen == false) { dpvm.IsOpen = true; DataPoints dataPoints = new DataPoints(); dataPoints.DataContext = dpvm; dataPoints.AnalogInputs.ItemsSource = dpvm.AnalogInputPoints; ShellFillerShell sfs = new ShellFillerShell() { DataContext = this }; sfs.MainScroll.Content = dataPoints; sfs.Header.Text = "Data Points"; PlaceOrFocusControlInShell(DataPointsViewModel.Position, sfs, false, null); return; } PlaceOrFocusControlInShell(DataPointsViewModel.Position, null, true, "Data Points"); }
internal override void OnBeforeWrite() { base.OnBeforeWrite(); if (DataVectors.Count == DataPoints.Count) { PointFormat = IgesCopiousDataPointFormat.CoordinatesAndVectors; } else if (DataPoints.Select(p => p.Z).Distinct().Count() <= 1) { PointFormat = IgesCopiousDataPointFormat.CommonZ; } else { PointFormat = IgesCopiousDataPointFormat.Coordinates; } if ((FormNumber >= 20 && FormNumber <= 21) || (FormNumber >= 31 && FormNumber <= 38) || FormNumber == 40) { EntityUseFlag = IgesEntityUseFlag.Annotation; } Debug.Assert(FormNumber != 0); }
public Location(string name, int dataWidth) { this.name = name; this.dataWidth = dataWidth; stats = new Statistics(dataWidth); dataPoints = new DataPoints(); }
protected override void UpdateChartDisplay() { if (DataPoints != null) { Console.WriteLine(DataPoints.Last().Label + " --- " + DataPoints.Last().Value); } }
/// Remove datapoint (by removing this image view) if present here. protected override void RemoveDataPoint(IDataPoint datapoint) { if (DataPoints.Contains(datapoint)) { RemoveThisView(); } }
/// <summary> /// Gets the hash code /// </summary> /// <returns>Hash code</returns> public override int GetHashCode() { unchecked // Overflow is fine, just wrap { var hashCode = 41; // Suitable nullity checks etc, of course :) if (MeasurementUnit != null) { hashCode = hashCode * 59 + MeasurementUnit.GetHashCode(); } if (Description != null) { hashCode = hashCode * 59 + Description.GetHashCode(); } if (Modifier != null) { hashCode = hashCode * 59 + Modifier.GetHashCode(); } if (GramWeight != null) { hashCode = hashCode * 59 + GramWeight.GetHashCode(); } if (DataPoints != null) { hashCode = hashCode * 59 + DataPoints.GetHashCode(); } if (Footnote != null) { hashCode = hashCode * 59 + Footnote.GetHashCode(); } return(hashCode); } }
void Update() { if (Input.GetKeyDown(KeyCode.Escape)) { receivingUdpClient.Close(); Debug.Log("Packet queue watcher stopped by user"); } else if (Input.GetKeyDown(KeyCode.N)) { NewCapture(); } if (listener.IsAlive || packetQueue.Count > 0) { ForzaPacket packet; if (packetQueue.TryDequeue(out packet)) { DataPoint newPoint = DataPoints.AddPoint(packet); int lapNum = trackInfo.CheckNewLap(DataPoints.GetLatestPacketIndex()); newPoint.GetPacket().LapNum = (uint)lapNum; visualizations.DrawTrail(newPoint, lapNum); uiVisualizations.DrawUI(packet); } } }
public void SetUp() { _dataPoints1D = new DataPoints(x: _x); _dataPoints2D = new DataPoints(x: _x, y: _y); _dataPoints3D = new DataPoints(x: _x, y: _y, z: _z); _dataPoints4D = new DataPoints(x1: _x, x2: _y, y1: _z, y2: _z); }
public int CheckNewLap(int packetIndex) { if (lapStartingPoints.Count == 0 && DataPoints.GetLatestPacketIndex() >= 0) { lapStartingPoints.Add(0); } Vector3 firstPointPosition = DataPoints.GetPoint(0).GetPosition(); float distance = Vector3.Distance(firstPointPosition, DataPoints.GetPoint(packetIndex).GetPosition()); if (distance >= searchDistance) { startingLap = false; } if (distance < searchDistance && !startingLap) { if (distance < lastDistance) { lastDistance = distance; } else { Debug.Log("Lap recorded, node position: " + packetIndex); lapStartingPoints.Add(packetIndex); lastDistance = float.MaxValue; startingLap = true; currentLapIndex += 1f; } } return(lapStartingPoints.Count); }
private BollingerBandsAlgorithm.Result CalculateBollingerBands(int period, int sigmaWeight) { var bb = new BollingerBandsAlgorithm(); var result = bb.Calculate(DataPoints.Take(period).Select(p => p.Close).ToList(), period, sigmaWeight); return(result); }
private void CalculateDay() { DataPoints = DataPoints.OrderBy(x => x.DateTime).ToList(); Open = DataPoints[0].Open; Close = DataPoints[DataPoints.Count - 1].Close; High = 0; Low = double.MaxValue; Volume = 0; foreach (MarketDataPoint dataPoint in DataPoints) { if (dataPoint.High > High) { High = dataPoint.High; } if (dataPoint.Low < Low) { Low = dataPoint.Low; } Volume += dataPoint.Volume; } }
protected override void LoadDataPoints() { Application.Current.Dispatcher.Invoke(() => { DataFilter filter = GetFilter(ReportType); DataPoints.Clear(); var dataPoints = filter.Filter <PieChartDataPoint>(_dataModel.Transactions, StartDate, EndDate); foreach (var dataPoint in dataPoints) { DataPoint existingDataPoint = GetDataPoint(dataPoint.Name); if (existingDataPoint != null) { PieChartDataPoint newDataPoint = new PieChartDataPoint { Name = dataPoint.Name, Value = ((PieChartDataPoint)existingDataPoint).Value += dataPoint.Value, }; DataPoints.Remove(existingDataPoint); DataPoints.Add(newDataPoint); } else { DataPoints.Add(dataPoint); } } }); }
void GhostPositionViz() { int currentLap = trackInfo.CurrentLap(); if (ghostMarkers.Count < currentLap) { GameObject go = Instantiate(ghostMarkerPrefab, Vector3.zero, Quaternion.identity, ghostMarkersRoot); GhostMarker marker = go.GetComponent <GhostMarker>(); marker.markerText.text = "LAP " + currentLap; ghostMarkers.Add(marker); } for (int i = 0; i < ghostMarkers.Count; i++) { int positionIndex = trackInfo.GetGhostPosition(i); if (DataPoints.IsValidIndex(positionIndex)) { Vector3 pos = DataPoints.GetPoint(positionIndex).GetPosition(); ghostMarkers[i].transform.position = pos; } ghostMarkers[i].gameObject.SetActive(i + 1 != currentLap); } }
public PointsViewer() { InitializeComponent(); data = new DataPoints(-60, 60); //data.RandomData(1024, 15, 0, this); //data.Draw(); //DrawData(); }
private bool IsEngulfingOfCorrectType(DataPoints previousDayQuote, DataPoints currentDayQuote) { if (previousDayQuote.PercentageChange > 0 && currentDayQuote.PercentageChange < 0) { return this.engulfingType == SentimentType.Bearish; } return this.engulfingType == SentimentType.Bullish; }
public void Clear() { DataPoints.Clear(); LowActivityDataPoints.Clear(); HighActivityDataPoints.Clear(); Categories.Clear(); WatchDataNotYetLoaded = SetDataNotYetLoaded = true; }
private DataPoints <DateTime, double> GetTestExpectedSummer() { //Build data var list = new DataPoints <DateTime, double>(); list.AddPoint((Convert.ToDateTime("2/12/2019 12:04:00 PM")), 2.0); list.AddPoint((Convert.ToDateTime("1/1/2019 12:10:15 PM")), 20.0); return(list); }
void LineTrailViz(int lapNum) { if (DataPoints.GetLatestPacketIndex() <= 1) { return; } if (currentLapNum != lapNum) { Mesh lineMesh = new Mesh(); lineMesh.SetVertices(lineMeshVertices); lineMesh.SetTriangles(lineMeshTriangles, 0); lineMesh.SetColors(lineMeshColours); oldLapMeshes.Add(lineMesh); lineMeshVertices.Clear(); lineMeshTriangles.Clear(); lineMeshColours.Clear(); currentLapNum = lapNum; } float gforce = DataPoints.GetCurrentPoint().GetPacket().AccelerationZ / 9.80665f; Vector3 currPoint = DataPoints.GetCurrentPoint().GetPosition(); Vector3 lastPoint = DataPoints.GetPrevPoint().GetPosition(); Color gforceColour; Vector3 offset = new Vector3(lastPoint.z - currPoint.z, 0, currPoint.x - lastPoint.x).normalized *lineTrailWidth / 2f; if (lineMeshVertices.Count == 0) { lineMeshVertices.Add(lastPoint - offset); lineMeshVertices.Add(lastPoint + offset); gforceColour = gForceGradient.Evaluate(0.5f); lineMeshColours.Add(gforceColour); lineMeshColours.Add(gforceColour); } lineMeshVertices.Add(currPoint - offset); lineMeshVertices.Add(currPoint + offset); int vertexCount = lineMeshVertices.Count; lineMeshTriangles.Add(vertexCount - 4); lineMeshTriangles.Add(vertexCount - 3); lineMeshTriangles.Add(vertexCount - 2); lineMeshTriangles.Add(vertexCount - 1); lineMeshTriangles.Add(vertexCount - 2); lineMeshTriangles.Add(vertexCount - 3); gforceColour = gForceGradient.Evaluate(gforce * 0.5f + 0.5f); lineMeshColours.Add(gforceColour); lineMeshColours.Add(gforceColour); }
System.Numerics.Quaternion CalculateQuaternion(DataPoints datapoints, DataPoints targetpoints) { System.Numerics.Quaternion q = new System.Numerics.Quaternion(); System.Numerics.Vector3 cp = System.Numerics.Vector3.Cross(datapoints.points[0].point, targetpoints.points[0].point); q.X = cp.X; q.Y = cp.Y; q.Z = cp.Z; q.W = Mathf.Sqrt(Mathf.Pow(datapoints.points[0].point.Length(), 2) * Mathf.Pow(targetpoints.points[0].point.Length(), 2)) + System.Numerics.Vector3.Dot(datapoints.points[0].point, targetpoints.points[0].point); return(q); }
public LineChartViewModel() { this.DataPoints = new ObservableCollection <LineChartModel>(); DateTime year = new DateTime(2005, 5, 1); DataPoints.Add(new LineChartModel() { Year = year.AddYears(1), Germany = 24, England = 34 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(2), Germany = 14, England = 24 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(3), Germany = 25, England = 35 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(4), Germany = 08, England = 18 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(5), Germany = 27, England = 37 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(6), Germany = 34, England = 44 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(7), Germany = 39, England = 49 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(8), Germany = 17, England = 27 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(9), Germany = 24, England = 34 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(10), Germany = 28, England = 38 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(11), Germany = 34, England = 44 }); DataPoints.Add(new LineChartModel() { Year = year.AddYears(12), Germany = 39, England = 49 }); }
// lapNum is zero index public int GetGhostPosition(int lapNum) { if (lapNum < 0 || lapNum >= lapStartingPoints.Count) { return(-1); } else { return(lapStartingPoints[lapNum] + DataPoints.GetLatestPacketIndex() - lapStartingPoints[lapStartingPoints.Count - 1]); } }
public DataPoints <DateTime, double> GetTestExpectedSummaryDaily() { //Build data DataPoints <DateTime, double> list = new DataPoints <DateTime, double>(); list.AddPoint((Convert.ToDateTime("1/1/2019 12:04:00 PM")), 12.0); list.AddPoint((Convert.ToDateTime("1/1/2019 13:10:15 PM")), 16.0); list.AddPoint((Convert.ToDateTime("1/1/2019 14:05:15 PM")), 4.0); return(list); }
private DataPoints <String, double> GetTestExpectedSummarySummerCost() { //Build data DataPoints <String, double> list = new DataPoints <String, double>(); list.AddPoint("Summer", 1184.0); list.AddPoint("Winter", 0.0); list.AddPoint("Spring", 0.0); list.AddPoint("Autum", 0.0); return(list); }
public void TestSummarySeasonallyCost() { var build = new ConfigurationBuilder(); var _config = build.Build(); var proc = new Procedures(new DatabaseContext(), _config); var expected = GetTestExpectedSummarySummerCost(); var dataset = GetTestDataSummarySummer(); var empty = new List <SegmentEventsEntry>(); var seasons = proc.SummarySeasonallyUsage(dataset, empty, empty, empty); DataPoints <DateTime, double> list = new DataPoints <DateTime, double>(); }
public HorizontalBarChart(DataPoints dps, string[] cats) : base(dps,cats) { }
public VerticalBarChart(DataPoints dps, string[] cats) : base(dps,cats) { }
public PieSliceChart(DataPoints dps, string [] cats) : base(dps,cats) { }
public DoughnutSliceChart(DataPoints dps, string[] cats) : base(dps,cats) { }
protected GridChart(DataPoints dps, string[] cats) : base(dps,cats) { this.DataPoints = dps; this.CategoryLabels = cats; }