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 }); }
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); } } }); }
/// <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); }
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 }); }
protected virtual bool Add(object textLine) { if (Translator != null) { Translator.TextLine = textLine; DataPoints.Add(Translator.Translate()); return(true); } return(false); }
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 }); }
/// <summary> /// Gets a list of timeseries datapoints on the specified date range asynchronously /// </summary> /// <param name="from">The from date</param> /// <param name="to">The to date</param> /// <returns></returns> public async Task <List <TimeSeriesDataPoint> > GetDataAsync(DateTime from, DateTime to) { client.KeepAlive(); var tmp = await client.GetTimeSeriesData(this, from, to); foreach (var line in Regex.Split(tmp, "\r\n|\r|\n")) { DataPoints.Add(new TimeSeriesDataPoint(line)); } DataPoints.RemoveAll(x => x.Timestamp == DateTime.MinValue); return(DataPoints); }
public ViewModel() { this.DataPoints = new ObservableCollection <Model>(); DateTime year = new DateTime(1995, 1, 1); DataPoints.Add(new Model() { Year = year.AddYears(0), Profit = 80 }); DataPoints.Add(new Model() { Year = year.AddYears(1), Profit = 200 }); DataPoints.Add(new Model() { Year = year.AddYears(2), Profit = 400 }); DataPoints.Add(new Model() { Year = year.AddYears(3), Profit = 600 }); DataPoints.Add(new Model() { Year = year.AddYears(4), Profit = 700 }); DataPoints.Add(new Model() { Year = year.AddYears(5), Profit = 1400 }); DataPoints.Add(new Model() { Year = year.AddYears(6), Profit = 2000 }); DataPoints.Add(new Model() { Year = year.AddYears(7), Profit = 4000 }); DataPoints.Add(new Model() { Year = year.AddYears(8), Profit = 6000 }); DataPoints.Add(new Model() { Year = year.AddYears(9), Profit = 8000 }); DataPoints.Add(new Model() { Year = year.AddYears(10), Profit = 11000 }); }
internal override int ReadParameters(List <string> parameters, IgesReaderBinder binder) { var index = 0; _pointFormat = (IgesCopiousDataPointFormat)Integer(parameters, index++); var tupleCount = Integer(parameters, index++); double x, y, z, i, j, k; switch (_pointFormat) { case IgesCopiousDataPointFormat.CommonZ: z = Double(parameters, index++); for (int n = 0; n < tupleCount; n++) { x = Double(parameters, index++); y = Double(parameters, index++); DataPoints.Add(new IgesPoint(x, y, z)); } break; case IgesCopiousDataPointFormat.Coordinates: for (int n = 0; n < tupleCount; n++) { x = Double(parameters, index++); y = Double(parameters, index++); z = Double(parameters, index++); DataPoints.Add(new IgesPoint(x, y, z)); } break; case IgesCopiousDataPointFormat.CoordinatesAndVectors: for (int n = 0; n < tupleCount; n++) { x = Double(parameters, index++); y = Double(parameters, index++); z = Double(parameters, index++); i = Double(parameters, index++); j = Double(parameters, index++); k = Double(parameters, index++); DataPoints.Add(new IgesPoint(x, y, z)); DataVectors.Add(new IgesVector(i, j, k)); } break; } return(index); }
public void AddDataPoint(MarketDataPoint dataPoint) { if (DataPoints.Count == 0) { Ticker = dataPoint.Ticker; DateTime = dataPoint.DateTime.Date; DataPoints.Add(dataPoint); } else if (dataPoint.DateTime.Date == DateTime.Date && dataPoint.Ticker == Ticker) { DataPoints.Add(dataPoint); } CalculateDay(); }
public async Task AddLine(IDataPoint datapoint) { var line = await CreateLineDrawer(datapoint); if (line == null) { throw new ArgumentException("Could not create line"); } AddLine(line); DataPoints.Add(datapoint); var container = XamarinHelpers.GetFigureContainerFromParents(Parent); container?.InvokeDatapointAdded(datapoint, _context); }
public EvoDataframe(List <HelixEvoSensor> filteredData, List <string> headerList, List <int> columns) //First col is ID col, 2nd col is label col, rest are data { Columns = columns; //FilteredData is list of all Evo sensors that are data-complete foreach (int col in Columns) { Headers.Add(headerList[col]); } foreach (HelixEvoSensor sensor in filteredData) { List <string> data = sensor.GetDataList(); List <double> doubleData = new List <double>(); for (int i = 2; i < Columns.Count; i++) { if (double.TryParse(data[Columns[i]], out double dataPoint)) { doubleData.Add(dataPoint); } } if (double.TryParse(data[Columns[1]], out double label)) { DataPoints.Add(new EvoDataPoint(data[Columns[0]], label, doubleData)); } } foreach (HelixEvoSensor sensor in filteredData) { List <string> data = sensor.GetDataList(); List <double> doubleData = new List <double>(); for (int i = 2; i < Columns.Count; i++) { if (double.TryParse(data[Columns[i]], out double dataPoint)) { doubleData.Add(dataPoint); } } if (double.TryParse(data[Columns[1]], out double label)) { OriginalDataPoints.Add(new EvoDataPoint(data[Columns[0]], label, doubleData)); } } Timestamp = DateTime.UtcNow; NumNeighbors = (int)Math.Sqrt((double)DataPoints.Count); //NumNeighbors = 7; }
/// <summary> /// Open a PAT file, parse it and store it /// </summary> /// <param name="fileName">path to the PAT file, including full path and extension</param> public PathFile(string fileName) { try { using (STFReader stf = new STFReader(fileName, false)) stf.ParseFile(new STFReader.TokenProcessor[] { new STFReader.TokenProcessor("trackpdps", () => { stf.MustMatchBlockStart(); stf.ParseBlock(new STFReader.TokenProcessor[] { new STFReader.TokenProcessor("trackpdp", () => { DataPoints.Add(new PathDataPoint(stf)); }), }); }), new STFReader.TokenProcessor("trackpath", () => { stf.MustMatchBlockStart(); stf.ParseBlock(new STFReader.TokenProcessor[] { new STFReader.TokenProcessor("trpathname", () => { PathID = stf.ReadStringBlock(null); }), new STFReader.TokenProcessor("name", () => { Name = stf.ReadStringBlock(null); }), new STFReader.TokenProcessor("trpathflags", () => { Flags = (PathFlags)stf.ReadHexBlock(null); }), new STFReader.TokenProcessor("trpathstart", () => { Start = stf.ReadStringBlock(null); }), new STFReader.TokenProcessor("trpathend", () => { End = stf.ReadStringBlock(null); }), new STFReader.TokenProcessor("trpathnodes", () => { stf.MustMatchBlockStart(); int count = stf.ReadInt(null); stf.ParseBlock(new STFReader.TokenProcessor[] { new STFReader.TokenProcessor("trpathnode", () => { if (--count < 0) { STFException.TraceWarning(stf, "Skipped extra TrPathNodes"); } else { PathNodes.Add(new PathNode(stf)); } }), }); if (count > 0) { STFException.TraceWarning(stf, count + " missing TrPathNodes(s)"); } }), }); }), }); } catch (Exception error) { Trace.TraceWarning(error.Message); } }
/// <summary> /// Gets a list of timeseries datapoints on the specified date range /// </summary> /// <param name="from">The from date</param> /// <param name="to">The to date</param> /// <returns></returns> public List <TimeSeriesDataPoint> GetData(DateTime from, DateTime to) { try { client.KeepAlive(); //var tmp = AsyncHelpers.RunSync(() => client.GetTimeSeriesData(this, from, to)); var tmp = client.GetTimeSeriesDataSync(this, from, to); foreach (var line in Regex.Split(tmp, "\r\n|\r|\n")) { DataPoints.Add(new TimeSeriesDataPoint(line)); } DataPoints.RemoveAll(x => x.Timestamp == DateTime.MinValue); return(DataPoints); } catch (Exception) { return(null); } }
//********************************************************************* // // This method collects all data points and calculate all the necessary dimensions // to draw the bar graph. It is the method called before invoking the Draw() method. // labels is the x values. // values is the y values. // //********************************************************************* public void CollectDataPoints(string[] labels, string[] values) { if (labels.Length == values.Length) { for (int i = 0; i < labels.Length; i++) { float temp = Convert.ToSingle(values[i]); string shortLbl = MakeShortLabel(labels[i]); // For now put 0.0 for start position and sweep size DataPoints.Add(new DataItem(shortLbl, labels[i], temp, 0.0f, 0.0f, GetColor(i))); // Find max value from data; this is only temporary _maxValue if (_maxValue < temp) { _maxValue = temp; } // Find the longest description if (_displayLegend) { string currentLbl = labels[i] + " (" + shortLbl + ")"; float currentWidth = CalculateImgFontWidth(currentLbl, _legendFontSize, FontFamily); if (_maxLabelWidth < currentWidth) { _longestLabel = currentLbl; _maxLabelWidth = currentWidth; } } } CalculateTickAndMax(); CalculateGraphDimension(); CalculateBarWidth(DataPoints.Count, _graphWidth); CalculateSweepValues(); } else { throw new Exception("X data count is different from Y data count"); } }
/// <inheritdoc /> protected override double CalculateEnergyExerted() { // Recover _snapForceVolatility *= 1 - ForceVolatilityRecovery(_deltaTime); _actualForceVolatility *= 1 - ForceVolatilityRecovery(_deltaTime); // Calculate snappiness double snappiness = CalculateSnappiness(); // Calculate snap and flow energy double snapEnergy = CalculateSnappingEnergy(snappiness); // for now, snap needs to be done first, because flowing uses _previousSnapForce, which is set in snapping double flowEnergy = CalculateFlowingEnergy(snappiness); // TODO: refactor to fix that ^ // Data points DataPoints.Add("Snap Force Volatility", _snapForceVolatility); DataPoints.Add("Actual Force Volatility", _actualForceVolatility); DataPoints.Add("Snappiness", snappiness); // Sum up parts with weights return(snapEnergy + flowEnergy); }
protected override void LoadDataPoints() { Application.Current.Dispatcher.Invoke(() => { DataFilter filter = GetFilter(ReportType); DataPoints.Clear(); var dataPoints = new List <LineChartDataPoint>(); //Add an empty data point to start at the origin. dataPoints.Add(new LineChartDataPoint { X = StartDate, Y = 0, }); dataPoints.AddRange(filter.Filter <LineChartDataPoint>(_dataModel.Transactions, StartDate, EndDate)); foreach (var dataPoint in dataPoints) { DataPoints.Add(dataPoint); } }); }
public void AddDataPoint(DataPoint dp) => DataPoints.Add(dp);
internal void AddDataPoint(int X, int Y, bool draw) { DataPoints.Add(new DataPoint(X, Y, Index, draw)); }
/// <summary> /// Add a Data Point to the DataSeries. /// </summary> /// <param name="axisEntry1"></param> /// <param name="axisEntry2"></param> public void AddDataPoint(TXAxisDataType axisEntry1, TYAxisDataType axisEntry2) { DataPoints.Add(new DataPoint <TXAxisDataType, TYAxisDataType, TDataPointData>(axisEntry1, axisEntry2)); }
public ViewModel() { this.DataPoints = new ObservableCollection <Model>(); DataPoints.Add(new Model() { Eruptions = 3.600f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 1.800f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 3.333f, WaitingTime = 74 }); DataPoints.Add(new Model() { Eruptions = 2.283f, WaitingTime = 62 }); DataPoints.Add(new Model() { Eruptions = 4.533f, WaitingTime = 85 }); DataPoints.Add(new Model() { Eruptions = 2.883f, WaitingTime = 55 }); DataPoints.Add(new Model() { Eruptions = 4.700f, WaitingTime = 88 }); DataPoints.Add(new Model() { Eruptions = 3.600f, WaitingTime = 85 }); DataPoints.Add(new Model() { Eruptions = 1.950f, WaitingTime = 51 }); DataPoints.Add(new Model() { Eruptions = 4.350f, WaitingTime = 85 }); DataPoints.Add(new Model() { Eruptions = 1.833f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 3.917f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 4.200f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 1.750f, WaitingTime = 47 }); DataPoints.Add(new Model() { Eruptions = 4.700f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 2.167f, WaitingTime = 52 }); DataPoints.Add(new Model() { Eruptions = 1.750f, WaitingTime = 62 }); DataPoints.Add(new Model() { Eruptions = 4.800f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 1.600f, WaitingTime = 52 }); DataPoints.Add(new Model() { Eruptions = 4.250f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 1.800f, WaitingTime = 51 }); DataPoints.Add(new Model() { Eruptions = 1.750f, WaitingTime = 47 }); DataPoints.Add(new Model() { Eruptions = 3.450f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 3.067f, WaitingTime = 69 }); DataPoints.Add(new Model() { Eruptions = 4.533f, WaitingTime = 74 }); DataPoints.Add(new Model() { Eruptions = 3.600f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 1.967f, WaitingTime = 55 }); DataPoints.Add(new Model() { Eruptions = 4.083f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 3.850f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 4.433f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 4.300f, WaitingTime = 73 }); DataPoints.Add(new Model() { Eruptions = 4.467f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 3.367f, WaitingTime = 66 }); DataPoints.Add(new Model() { Eruptions = 4.033f, WaitingTime = 80 }); DataPoints.Add(new Model() { Eruptions = 3.833f, WaitingTime = 74 }); DataPoints.Add(new Model() { Eruptions = 2.017f, WaitingTime = 52 }); DataPoints.Add(new Model() { Eruptions = 1.867f, WaitingTime = 48 }); DataPoints.Add(new Model() { Eruptions = 4.833f, WaitingTime = 80 }); DataPoints.Add(new Model() { Eruptions = 1.833f, WaitingTime = 59 }); DataPoints.Add(new Model() { Eruptions = 4.783f, WaitingTime = 90 }); DataPoints.Add(new Model() { Eruptions = 4.350f, WaitingTime = 80 }); DataPoints.Add(new Model() { Eruptions = 1.883f, WaitingTime = 58 }); DataPoints.Add(new Model() { Eruptions = 4.567f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 1.750f, WaitingTime = 58 }); DataPoints.Add(new Model() { Eruptions = 4.533f, WaitingTime = 73 }); DataPoints.Add(new Model() { Eruptions = 3.317f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 3.833f, WaitingTime = 64 }); DataPoints.Add(new Model() { Eruptions = 2.100f, WaitingTime = 53 }); DataPoints.Add(new Model() { Eruptions = 4.633f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 2.000f, WaitingTime = 59 }); DataPoints.Add(new Model() { Eruptions = 4.800f, WaitingTime = 75 }); DataPoints.Add(new Model() { Eruptions = 4.716f, WaitingTime = 90 }); DataPoints.Add(new Model() { Eruptions = 1.833f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 4.833f, WaitingTime = 80 }); DataPoints.Add(new Model() { Eruptions = 1.733f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 4.883f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 3.717f, WaitingTime = 71 }); DataPoints.Add(new Model() { Eruptions = 1.667f, WaitingTime = 64 }); DataPoints.Add(new Model() { Eruptions = 4.567f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 4.317f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 2.233f, WaitingTime = 59 }); DataPoints.Add(new Model() { Eruptions = 4.500f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 1.750f, WaitingTime = 48 }); DataPoints.Add(new Model() { Eruptions = 4.800f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 1.817f, WaitingTime = 60 }); DataPoints.Add(new Model() { Eruptions = 4.400f, WaitingTime = 92 }); DataPoints.Add(new Model() { Eruptions = 4.167f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 4.700f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 2.067f, WaitingTime = 65 }); DataPoints.Add(new Model() { Eruptions = 4.700f, WaitingTime = 73 }); DataPoints.Add(new Model() { Eruptions = 4.033f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 1.967f, WaitingTime = 56 }); DataPoints.Add(new Model() { Eruptions = 4.500f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 4.000f, WaitingTime = 71 }); DataPoints.Add(new Model() { Eruptions = 1.983f, WaitingTime = 62 }); DataPoints.Add(new Model() { Eruptions = 5.067f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 2.017f, WaitingTime = 60 }); DataPoints.Add(new Model() { Eruptions = 4.567f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 3.883f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 3.600f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 4.133f, WaitingTime = 75 }); DataPoints.Add(new Model() { Eruptions = 4.333f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 4.100f, WaitingTime = 70 }); DataPoints.Add(new Model() { Eruptions = 2.633f, WaitingTime = 65 }); DataPoints.Add(new Model() { Eruptions = 4.067f, WaitingTime = 73 }); DataPoints.Add(new Model() { Eruptions = 4.933f, WaitingTime = 88 }); DataPoints.Add(new Model() { Eruptions = 3.950f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 4.517f, WaitingTime = 80 }); DataPoints.Add(new Model() { Eruptions = 2.167f, WaitingTime = 48 }); DataPoints.Add(new Model() { Eruptions = 4.000f, WaitingTime = 86 }); DataPoints.Add(new Model() { Eruptions = 2.200f, WaitingTime = 60 }); DataPoints.Add(new Model() { Eruptions = 4.333f, WaitingTime = 90 }); DataPoints.Add(new Model() { Eruptions = 1.867f, WaitingTime = 50 }); DataPoints.Add(new Model() { Eruptions = 4.817f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 1.833f, WaitingTime = 63 }); DataPoints.Add(new Model() { Eruptions = 4.300f, WaitingTime = 72 }); DataPoints.Add(new Model() { Eruptions = 4.667f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 3.750f, WaitingTime = 75 }); DataPoints.Add(new Model() { Eruptions = 1.867f, WaitingTime = 51 }); DataPoints.Add(new Model() { Eruptions = 4.900f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 2.483f, WaitingTime = 62 }); DataPoints.Add(new Model() { Eruptions = 4.367f, WaitingTime = 88 }); DataPoints.Add(new Model() { Eruptions = 2.100f, WaitingTime = 49 }); DataPoints.Add(new Model() { Eruptions = 4.500f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 4.050f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 1.867f, WaitingTime = 47 }); DataPoints.Add(new Model() { Eruptions = 4.700f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 1.783f, WaitingTime = 52 }); DataPoints.Add(new Model() { Eruptions = 4.850f, WaitingTime = 86 }); DataPoints.Add(new Model() { Eruptions = 3.683f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 4.733f, WaitingTime = 75 }); DataPoints.Add(new Model() { Eruptions = 2.300f, WaitingTime = 59 }); DataPoints.Add(new Model() { Eruptions = 4.900f, WaitingTime = 89 }); DataPoints.Add(new Model() { Eruptions = 4.417f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 1.700f, WaitingTime = 59 }); DataPoints.Add(new Model() { Eruptions = 4.633f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 2.317f, WaitingTime = 50 }); DataPoints.Add(new Model() { Eruptions = 4.600f, WaitingTime = 85 }); DataPoints.Add(new Model() { Eruptions = 1.817f, WaitingTime = 59 }); DataPoints.Add(new Model() { Eruptions = 4.417f, WaitingTime = 87 }); DataPoints.Add(new Model() { Eruptions = 2.617f, WaitingTime = 53 }); DataPoints.Add(new Model() { Eruptions = 4.067f, WaitingTime = 69 }); DataPoints.Add(new Model() { Eruptions = 4.250f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 1.967f, WaitingTime = 56 }); DataPoints.Add(new Model() { Eruptions = 4.600f, WaitingTime = 88 }); DataPoints.Add(new Model() { Eruptions = 3.767f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 1.917f, WaitingTime = 45 }); DataPoints.Add(new Model() { Eruptions = 4.500f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 2.267f, WaitingTime = 55 }); DataPoints.Add(new Model() { Eruptions = 4.650f, WaitingTime = 90 }); DataPoints.Add(new Model() { Eruptions = 1.867f, WaitingTime = 45 }); DataPoints.Add(new Model() { Eruptions = 4.167f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 2.800f, WaitingTime = 56 }); DataPoints.Add(new Model() { Eruptions = 4.333f, WaitingTime = 89 }); DataPoints.Add(new Model() { Eruptions = 1.833f, WaitingTime = 46 }); DataPoints.Add(new Model() { Eruptions = 4.383f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 1.883f, WaitingTime = 51 }); DataPoints.Add(new Model() { Eruptions = 4.933f, WaitingTime = 86 }); DataPoints.Add(new Model() { Eruptions = 2.033f, WaitingTime = 53 }); DataPoints.Add(new Model() { Eruptions = 3.733f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 4.233f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 2.233f, WaitingTime = 60 }); DataPoints.Add(new Model() { Eruptions = 4.533f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 4.817f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 4.333f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 1.983f, WaitingTime = 59 }); DataPoints.Add(new Model() { Eruptions = 4.633f, WaitingTime = 80 }); DataPoints.Add(new Model() { Eruptions = 2.017f, WaitingTime = 49 }); DataPoints.Add(new Model() { Eruptions = 5.100f, WaitingTime = 96 }); DataPoints.Add(new Model() { Eruptions = 1.800f, WaitingTime = 53 }); DataPoints.Add(new Model() { Eruptions = 5.033f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 4.000f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 2.400f, WaitingTime = 65 }); DataPoints.Add(new Model() { Eruptions = 4.600f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 3.567f, WaitingTime = 71 }); DataPoints.Add(new Model() { Eruptions = 4.000f, WaitingTime = 70 }); DataPoints.Add(new Model() { Eruptions = 4.500f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 4.083f, WaitingTime = 93 }); DataPoints.Add(new Model() { Eruptions = 1.800f, WaitingTime = 53 }); DataPoints.Add(new Model() { Eruptions = 3.967f, WaitingTime = 89 }); DataPoints.Add(new Model() { Eruptions = 2.200f, WaitingTime = 45 }); DataPoints.Add(new Model() { Eruptions = 4.150f, WaitingTime = 86 }); DataPoints.Add(new Model() { Eruptions = 2.000f, WaitingTime = 58 }); DataPoints.Add(new Model() { Eruptions = 3.833f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 3.500f, WaitingTime = 66 }); DataPoints.Add(new Model() { Eruptions = 4.583f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 2.367f, WaitingTime = 63 }); DataPoints.Add(new Model() { Eruptions = 5.000f, WaitingTime = 88 }); DataPoints.Add(new Model() { Eruptions = 1.933f, WaitingTime = 52 }); DataPoints.Add(new Model() { Eruptions = 4.617f, WaitingTime = 93 }); DataPoints.Add(new Model() { Eruptions = 1.917f, WaitingTime = 49 }); DataPoints.Add(new Model() { Eruptions = 2.083f, WaitingTime = 57 }); DataPoints.Add(new Model() { Eruptions = 4.583f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 3.333f, WaitingTime = 68 }); DataPoints.Add(new Model() { Eruptions = 4.167f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 4.333f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 4.500f, WaitingTime = 73 }); DataPoints.Add(new Model() { Eruptions = 2.417f, WaitingTime = 50 }); DataPoints.Add(new Model() { Eruptions = 4.000f, WaitingTime = 85 }); DataPoints.Add(new Model() { Eruptions = 4.167f, WaitingTime = 74 }); DataPoints.Add(new Model() { Eruptions = 1.883f, WaitingTime = 55 }); DataPoints.Add(new Model() { Eruptions = 4.583f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 4.250f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 3.767f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 2.033f, WaitingTime = 51 }); DataPoints.Add(new Model() { Eruptions = 4.433f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 4.083f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 1.833f, WaitingTime = 46 }); DataPoints.Add(new Model() { Eruptions = 4.417f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 2.183f, WaitingTime = 55 }); DataPoints.Add(new Model() { Eruptions = 4.800f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 1.833f, WaitingTime = 57 }); DataPoints.Add(new Model() { Eruptions = 4.800f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 4.100f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 3.966f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 4.233f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 3.500f, WaitingTime = 87 }); DataPoints.Add(new Model() { Eruptions = 4.366f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 2.250f, WaitingTime = 51 }); DataPoints.Add(new Model() { Eruptions = 4.667f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 2.100f, WaitingTime = 60 }); DataPoints.Add(new Model() { Eruptions = 4.350f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 4.133f, WaitingTime = 91 }); DataPoints.Add(new Model() { Eruptions = 1.867f, WaitingTime = 53 }); DataPoints.Add(new Model() { Eruptions = 4.600f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 1.783f, WaitingTime = 46 }); DataPoints.Add(new Model() { Eruptions = 4.367f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 3.850f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 1.933f, WaitingTime = 49 }); DataPoints.Add(new Model() { Eruptions = 4.500f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 2.383f, WaitingTime = 71 }); DataPoints.Add(new Model() { Eruptions = 4.700f, WaitingTime = 80 }); DataPoints.Add(new Model() { Eruptions = 1.867f, WaitingTime = 49 }); DataPoints.Add(new Model() { Eruptions = 3.833f, WaitingTime = 75 }); DataPoints.Add(new Model() { Eruptions = 3.417f, WaitingTime = 64 }); DataPoints.Add(new Model() { Eruptions = 4.233f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 2.400f, WaitingTime = 53 }); DataPoints.Add(new Model() { Eruptions = 4.800f, WaitingTime = 94 }); DataPoints.Add(new Model() { Eruptions = 2.000f, WaitingTime = 55 }); DataPoints.Add(new Model() { Eruptions = 4.150f, WaitingTime = 76 }); DataPoints.Add(new Model() { Eruptions = 1.867f, WaitingTime = 50 }); DataPoints.Add(new Model() { Eruptions = 4.267f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 1.750f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 4.483f, WaitingTime = 75 }); DataPoints.Add(new Model() { Eruptions = 4.000f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 4.117f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 4.083f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 4.267f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 3.917f, WaitingTime = 70 }); DataPoints.Add(new Model() { Eruptions = 4.550f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 4.083f, WaitingTime = 70 }); DataPoints.Add(new Model() { Eruptions = 2.417f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 4.183f, WaitingTime = 86 }); DataPoints.Add(new Model() { Eruptions = 2.217f, WaitingTime = 50 }); DataPoints.Add(new Model() { Eruptions = 4.450f, WaitingTime = 90 }); DataPoints.Add(new Model() { Eruptions = 1.883f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 1.850f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 4.283f, WaitingTime = 77 }); DataPoints.Add(new Model() { Eruptions = 3.950f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 2.333f, WaitingTime = 64 }); DataPoints.Add(new Model() { Eruptions = 4.150f, WaitingTime = 75 }); DataPoints.Add(new Model() { Eruptions = 2.350f, WaitingTime = 47 }); DataPoints.Add(new Model() { Eruptions = 4.933f, WaitingTime = 86 }); DataPoints.Add(new Model() { Eruptions = 2.900f, WaitingTime = 63 }); DataPoints.Add(new Model() { Eruptions = 4.583f, WaitingTime = 85 }); DataPoints.Add(new Model() { Eruptions = 3.833f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 2.083f, WaitingTime = 57 }); DataPoints.Add(new Model() { Eruptions = 4.367f, WaitingTime = 82 }); DataPoints.Add(new Model() { Eruptions = 2.133f, WaitingTime = 67 }); DataPoints.Add(new Model() { Eruptions = 4.350f, WaitingTime = 74 }); DataPoints.Add(new Model() { Eruptions = 2.200f, WaitingTime = 54 }); DataPoints.Add(new Model() { Eruptions = 4.450f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 3.567f, WaitingTime = 73 }); DataPoints.Add(new Model() { Eruptions = 4.500f, WaitingTime = 73 }); DataPoints.Add(new Model() { Eruptions = 4.150f, WaitingTime = 88 }); DataPoints.Add(new Model() { Eruptions = 3.817f, WaitingTime = 80 }); DataPoints.Add(new Model() { Eruptions = 3.917f, WaitingTime = 71 }); DataPoints.Add(new Model() { Eruptions = 4.450f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 2.000f, WaitingTime = 56 }); DataPoints.Add(new Model() { Eruptions = 4.283f, WaitingTime = 79 }); DataPoints.Add(new Model() { Eruptions = 4.767f, WaitingTime = 78 }); DataPoints.Add(new Model() { Eruptions = 4.533f, WaitingTime = 84 }); DataPoints.Add(new Model() { Eruptions = 1.850f, WaitingTime = 58 }); DataPoints.Add(new Model() { Eruptions = 4.250f, WaitingTime = 83 }); DataPoints.Add(new Model() { Eruptions = 1.983f, WaitingTime = 43 }); DataPoints.Add(new Model() { Eruptions = 2.250f, WaitingTime = 60 }); DataPoints.Add(new Model() { Eruptions = 4.750f, WaitingTime = 75 }); DataPoints.Add(new Model() { Eruptions = 4.117f, WaitingTime = 81 }); DataPoints.Add(new Model() { Eruptions = 2.150f, WaitingTime = 46 }); DataPoints.Add(new Model() { Eruptions = 4.417f, WaitingTime = 90 }); DataPoints.Add(new Model() { Eruptions = 1.817f, WaitingTime = 46 }); DataPoints.Add(new Model() { Eruptions = 4.467f, WaitingTime = 74 }); }
//public void LoadNewUserWhite() //{ // NewUser.DNI = string.Empty; // NewUser.Email = string.Empty; // NewUser.FirstName = string.Empty; // NewUser.LastName = string.Empty; // NewUser.Motherslastname = string.Empty; // NewUser.Password = string.Empty; // NewUser.PasswordConfirm = string.Empty; // NewUser.Phone = string.Empty; //} private void LoadDataPoint() { DataPoints.Add(new ChartDataPoint(64, 14.4, 20)); DataPoints.Add(new ChartDataPoint(71, 2, 15)); DataPoints.Add(new ChartDataPoint(74, 7, 30)); DataPoints.Add(new ChartDataPoint(80, 4, 22)); DataPoints.Add(new ChartDataPoint(94, 1, 8)); DataPoints.Add(new ChartDataPoint(96, 6, 18)); DataPoints.Add(new ChartDataPoint(98, 12.3, 28)); //SplineSeries splineSeries = new SplineSeries() //{ // ItemsSource = DataPoints, // XBindingPath = "Month", // YBindingPath = "Value", // SplineType = SplineType.Cardinal //}; //chart.Series.Add(splineSeries); Data = new List <Person>() { new Person { Name = "David", Height = 180 }, new Person { Name = "Michael", Height = 170 }, new Person { Name = "Steve", Height = 160 }, new Person { Name = "Joel", Height = 182 }, new Person { Name = "David", Height = 100 }, new Person { Name = "Michael", Height = 110 }, new Person { Name = "Steve", Height = 40 }, new Person { Name = "Joel", Height = 12 }, new Person { Name = "David", Height = 50 }, new Person { Name = "Michael", Height = 150 }, new Person { Name = "Steve", Height = 100 }, new Person { Name = "Joel", Height = 60 } }; Data2 = new List <Person>() { new Person { Name = "David", Height = 10 }, new Person { Name = "Michael", Height = 154 }, new Person { Name = "Steve", Height = 30 }, new Person { Name = "Joel", Height = 15 } }; //CategoryAxis primaryAxis = new CategoryAxis(); // primaryAxis.Title.Text = "Name"; // chart.PrimaryAxis = primaryAxis; // //Initializing secondary Axis // NumericalAxis secondaryAxis = new NumericalAxis(); // secondaryAxis.Title.Text = "Height (in cm)"; // chart.SecondaryAxis = secondaryAxis; // //Initializing column series // ColumnSeries series = new ColumnSeries(); // series.SetBinding(ChartSeries.ItemsSourceProperty, "Data"); // series.XBindingPath = "Name"; // series.YBindingPath = "Height"; // chart.Series.Add(series); //Initializing primary axis CategoryAxis primaryAxis = new CategoryAxis(); primaryAxis.Title.Text = "Name"; chart.PrimaryAxis = primaryAxis; //Initializing secondary Axis NumericalAxis secondaryAxis = new NumericalAxis(); secondaryAxis.Title.Text = "Height (in cm)"; chart.SecondaryAxis = secondaryAxis; //Initializing column series //ColumnSeries series = new ColumnSeries(); //series.ItemsSource = Data; //series.XBindingPath = "Name"; //series.YBindingPath = "Height"; //series.Label = "Heights"; //ColumnSeries series = new ColumnSeries(); //series.ItemsSource = Data; //series.XBindingPath = "Name"; //series.YBindingPath = "Height"; //series.Label = "Heights"; SplineSeries splineSeri = new SplineSeries() { ItemsSource = Data, XBindingPath = "Name", YBindingPath = "Height", SplineType = SplineType.Monotonic, DataMarker = new ChartDataMarker(), }; SplineSeries splineSeries = new SplineSeries() { ItemsSource = Data, //XBindingPath = "Month", //YBindingPath = "Value", XBindingPath = "Name", YBindingPath = "Height", SplineType = SplineType.Monotonic, DataMarker = new ChartDataMarker(), }; SplineSeries splineSerie = new SplineSeries() { ItemsSource = Data2, //XBindingPath = "Month", //YBindingPath = "Value", XBindingPath = "Name", YBindingPath = "Height", SplineType = SplineType.Clamped, DataMarker = new ChartDataMarker(), }; chart.Series.Add(splineSeries); chart.Series.Add(splineSerie); chart.Series.Add(splineSeri); //SplineSeries splineSerie = new SplineSeries() //{ // ItemsSource = Data, // XBindingPath = "Month", // YBindingPath = "Value", // SplineType = SplineType.Cardinal //}; //chart.Series.Add(splineSerie); //series.DataMarker = new ChartDataMarker(); //series.EnableTooltip = true; //chart.Legend = new ChartLegend(); //chart.Series.Add(series); }
private void OnCoordinates(eye_tracking_mouse.TobiiCoordinates coordinates) { coordinatesProvider.Restart(); Dispatcher.BeginInvoke((Action)(() => { Point gaze_point = new Point(coordinates.gaze_point.X, coordinates.gaze_point.Y); if (PresentationSource.FromVisual(Circle) == null) { return; } Point location_of_point_on_screen = this.Circle.PointToScreen(new Point(size_of_circle, size_of_circle / 2)); if (Point.Subtract(gaze_point, location_of_point_on_screen).Length < 100) { if (!is_user_looking_at_point) { is_user_looking_at_point = true; time_when_user_started_looking_at_point = DateTime.Now; } Circle.RenderTransform = new RotateTransform(current_angle, size_of_circle, size_of_circle / 2); if ((DateTime.Now - time_when_user_started_looking_at_point).TotalMilliseconds > 500) { current_angle_delta += 0.4f; if (current_angle_delta > 10) { current_angle_delta = 10; } } else { current_angle_delta -= 0.4f; if (current_angle_delta < 0) { current_angle_delta = 0; } } current_angle += current_angle_delta; if ((DateTime.Now - time_when_user_started_looking_at_point).TotalMilliseconds > 1000) { DataPoints.Add(new DataPoint { true_location_on_screen = location_of_point_on_screen, tobii_coordinates = coordinates }); is_user_looking_at_point = false; var dt = new System.Windows.Threading.DispatcherTimer(System.Windows.Threading.DispatcherPriority.Send); dt.Tick += (s, e) => { dt.Stop(); is_user_looking_at_point = false; NextPoint(null, null); }; dt.Interval = TimeSpan.FromMilliseconds(450); dt.Start(); } } else { is_user_looking_at_point = false; } })); }
public List <string> Export(DateTime start, DateTime end, int interval, StrategyParameters parameters) { //Read the OHLC from database var connectionString = ConfigurationManager.ConnectionStrings["marketdata-local"].ConnectionString; List <OHLC> ohlcList = new List <OHLC>(); try { using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlCommand command = new SqlCommand("", connection)) { command.CommandType = System.Data.CommandType.Text; command.CommandText = "SELECT o.Id, o.[Open], o.High, o.Low, o.[Close], Start, Volume FROM dbo.OHLC o " + "WHERE o.[Start] >= @start AND o.[End] < @end ORDER BY o.Id ASC"; command.Parameters.Add(new SqlParameter("start", start)); command.Parameters.Add(new SqlParameter("end", end)); using (SqlDataReader reader = command.ExecuteReader()) { while (reader.Read()) { var ohlc = new OHLC(); ohlc.Open = reader.GetDecimal(1); ohlc.High = reader.GetDecimal(2); ohlc.Low = reader.GetDecimal(3); ohlc.Close = reader.GetDecimal(4); ohlc.Start = reader.GetDateTime(5); var volume = reader.GetDecimal(6); ohlc.Volume = (volume * 1000); ohlcList.Add(ohlc); } } } } } catch (Exception ex) { throw ex; } //l h o c //Find the first trade //Find all trades within the next 5 minutes //If there are any trade //Calculate low, high, open, close if (ohlcList.Any()) { start = ohlcList.First().Start > start?ohlcList.First().Start : start; for (DateTime i = start; i < end; i = i.AddMinutes(interval)) { var windowStart = i; var windowEnd = windowStart.AddMinutes(interval); var ohlcInTheSameWindow = ohlcList.Where(o => o.Start >= windowStart && o.Start < windowEnd).ToList(); if (ohlcInTheSameWindow.Any()) { var low = Math.Round(ohlcInTheSameWindow.Select(t => t.Low).Min(), 2); var high = Math.Round(ohlcInTheSameWindow.Select(t => t.High).Max(), 2); var open = Math.Round(ohlcInTheSameWindow.First().Open, 2); var close = Math.Round(ohlcInTheSameWindow.Last().Close, 2); var volume = Math.Round(ohlcInTheSameWindow.Sum(t => t.Volume), 2); var ohlc = new OhlcIndicators(open, high, low, close) { Volume = volume, Start = windowStart, End = windowEnd, }; DataPoints.Add(ohlc); var prices = DataPoints.Select(d => d.Close).ToList(); ohlc.Mva10 = Math.Round(CalculateMovingAverage(prices, 10), 2); ohlc.Mva200 = Math.Round(CalculateMovingAverage(prices, 200), 2); ohlc.Rsi2 = Math.Round(CalculateRelativeStrengthIndex(prices, 3), 2); ohlc.Rsi14 = Math.Round(CalculateRelativeStrengthIndex(prices, 15), 2); var bb = CalculateBollingerBands(prices, 20, 2); ohlc.PercentB = Math.Round(bb.PercentB, 2); ohlc.Bandwidth = Math.Round(bb.Bandwidth, 2); } } } //Annotate //Calculate action - looking backward and forward //which is obviously not possible in real time trading CalculateAction(10, 4); //var balanced = OverSample(10); var normalized = Normalize(DataPoints); var exportLines = normalized.Select(d => $"{d.Start:M/d/yyyy H:mm},{d.Open},{d.High},{d.Low},{d.Close},{d.Volume},{d.Mva10},{d.Mva200},{d.Rsi2},{d.Rsi14},{d.PercentB},{d.Bandwidth},{d.Action}").ToList(); exportLines.Insert(0, "Date,Open,High,Low,Close,Volume,Mva10,Mva200,Rsi2,Rsi14,PercentB,Bandwidth,Action"); return(exportLines); }
public void AddDataPoint(Duration duration) { DataPoints.Add(new DataPoint <DateTime, string, Duration>(duration.StartDateTime, Name, duration)); }
public AxisViewModel() { this.DataPoints = new ObservableCollection <AxisModel>(); DateTime year = new DateTime(1995, 1, 1); DataPoints.Add(new AxisModel() { Year = year.AddYears(0), Profit = 80 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(1), Profit = 200 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(2), Profit = 400 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(3), Profit = 600 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(4), Profit = 700 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(5), Profit = 1400 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(6), Profit = 2000 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(7), Profit = 4000 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(8), Profit = 6000 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(9), Profit = 8000 }); DataPoints.Add(new AxisModel() { Year = year.AddYears(10), Profit = 11000 }); this.CategoryData1 = new ObservableCollection <AxisModel>(); CategoryData1.Add(new AxisModel() { XValue = "South Korea", YValue = 39 }); CategoryData1.Add(new AxisModel() { XValue = "India", YValue = 20 }); CategoryData1.Add(new AxisModel() { XValue = "China", YValue = 65 }); this.CategoryData2 = new ObservableCollection <AxisModel>(); CategoryData2.Add(new AxisModel() { XValue = "France", YValue = 45 }); CategoryData2.Add(new AxisModel() { XValue = "Italy", YValue = 16 }); CategoryData2.Add(new AxisModel() { XValue = "United Kingdom", YValue = 31 }); this.DateTimeData = new ObservableCollection <AxisModel>(); Random rand = new Random(); double value = 100; DateTime date = new DateTime(2017, 1, 1); for (int i = 0; i < 365; i++) { if (rand.NextDouble() > 0.5) { value += rand.NextDouble(); } else { value -= rand.NextDouble(); } DateTimeData.Add(new AxisModel { Growth = value, Date = date }); date = date.AddDays(1); } NumericData = new ObservableCollection <AxisModel>(); NumericData.Add(new AxisModel() { Value = 16, Size = 2 }); NumericData.Add(new AxisModel() { Value = 17, Size = 14 }); NumericData.Add(new AxisModel() { Value = 18, Size = 7 }); NumericData.Add(new AxisModel() { Value = 19, Size = 7 }); NumericData.Add(new AxisModel() { Value = 20, Size = 10 }); NumericData1 = new ObservableCollection <AxisModel>(); NumericData1.Add(new AxisModel() { Value = 16, Size = 7 }); NumericData1.Add(new AxisModel() { Value = 17, Size = 7 }); NumericData1.Add(new AxisModel() { Value = 18, Size = 11 }); NumericData1.Add(new AxisModel() { Value = 19, Size = 8 }); NumericData1.Add(new AxisModel() { Value = 20, Size = 24 }); }
public ViewModelKhachHang() { this.DataPoints = new ObservableCollection <ModelKhachHang>(); if (TrangThongKe.KieuThongKe == 0) { int YearXet = TrangThongKe.Year; int MonthXet = TrangThongKe.Month; DateTime DateXet = new DateTime(YearXet, MonthXet, 1); int DaysOfMonthXet = DateTime.DaysInMonth(YearXet, MonthXet); for (int i = 1; i <= DaysOfMonthXet; ++i) { DateTime date = new DateTime(YearXet, MonthXet, i); double TongNhap = 0; double TongBan = 0; var db = new MyDatabaseEntities(); foreach (var DH in db.DonHangs.ToList()) { DateTime ngayTao = (DateTime)DH.NgayTao; if (ngayTao.Day == date.Day && ngayTao.Month == date.Month && ngayTao.Year == date.Year) { TongNhap = (double)DH.TongGiaTriNhap; TongBan = (double)DH.TongGiaTriBan; } } DataPoints.Add(new ModelKhachHang() { TimeXet = i.ToString(), TienNhap = TongNhap / 1000000, TienBan = TongBan / 1000000, }); } } else if (TrangThongKe.KieuThongKe == 1) { int YearXet = TrangThongKe.Year; for (int i = 1; i <= 12; ++i) { DateTime datestart = new DateTime(YearXet, i, 1); DateTime dateEnd; if (i + 1 > 12) { dateEnd = new DateTime(YearXet + 1, i, 1); } else { dateEnd = new DateTime(YearXet, i + 1, 1); } double TongNhap = 0; double TongBan = 0; var db = new MyDatabaseEntities(); foreach (var DH in db.DonHangs.ToList()) { if (DH.NgayTao >= datestart && DH.NgayTao < dateEnd) { TongNhap += (double)DH.TongGiaTriNhap; TongBan += (double)DH.TongGiaTriBan; } } DataPoints.Add(new ModelKhachHang() { TimeXet = i.ToString(), TienNhap = TongNhap / 1000000, TienBan = TongBan / 1000000, }); } } else if (TrangThongKe.KieuThongKe == 2) { int YearXet = TrangThongKe.Year; int i = 1; while (true) { DateTime datestart = new DateTime(YearXet, i, 1); DateTime dateEnd; if (i == 10) { dateEnd = new DateTime(YearXet + 1, 1, 1); } else { dateEnd = new DateTime(YearXet, i + 3, 1); } double TongNhap = 0; double TongBan = 0; var db = new MyDatabaseEntities(); foreach (var DH in db.DonHangs.ToList()) { if (DH.NgayTao >= datestart && DH.NgayTao < dateEnd) { TongNhap += (double)DH.TongGiaTriNhap; TongBan += (double)DH.TongGiaTriBan; } } if (i == 1) { DataPoints.Add(new ModelKhachHang() { TimeXet = "Quý 1", TienNhap = TongNhap / 1000000, TienBan = TongBan / 1000000, }); i = 4; } else if (i == 4) { DataPoints.Add(new ModelKhachHang() { TimeXet = "Quý 2", TienNhap = TongNhap / 1000000, TienBan = TongBan / 1000000, }); i = 7; } else if (i == 7) { DataPoints.Add(new ModelKhachHang() { TimeXet = "Quý 3", TienNhap = TongNhap / 1000000, TienBan = TongBan / 1000000, }); i = 10; } else if (i == 10) { DataPoints.Add(new ModelKhachHang() { TimeXet = "Quý 4", TienNhap = TongNhap / 1000000, TienBan = TongBan / 1000000, }); break; } } } else if (TrangThongKe.KieuThongKe == 3) { int YearNow = DateTime.Now.Year; for (int i = 2015; i <= YearNow; ++i) { DateTime datestart = new DateTime(i, 1, 1); DateTime dateEnd = new DateTime(i + 1, 1, 1);; double TongNhap = 0; double TongBan = 0; var db = new MyDatabaseEntities(); foreach (var DH in db.DonHangs.ToList()) { if (DH.NgayTao >= datestart && DH.NgayTao < dateEnd) { TongNhap += (double)DH.TongGiaTriNhap; TongBan += (double)DH.TongGiaTriBan; } } DataPoints.Add(new ModelKhachHang() { TimeXet = i.ToString(), TienNhap = TongNhap / 1000000, TienBan = TongBan / 1000000, }); } } else if (TrangThongKe.KieuThongKe == 4) { DateTime datestart = TrangThongKe.DateStart; DateTime dateEnd = TrangThongKe.DateEnd; DateTime dateXet = datestart; while (true) { double TongNhap = 0; double TongBan = 0; var db = new MyDatabaseEntities(); foreach (var DH in db.DonHangs.ToList()) { DateTime ngayTao = (DateTime)DH.NgayTao; if (ngayTao.Day == dateXet.Day && ngayTao.Month == dateXet.Month && ngayTao.Year == dateXet.Year) { TongNhap = (double)DH.TongGiaTriNhap; TongBan = (double)DH.TongGiaTriBan; } } DataPoints.Add(new ModelKhachHang() { TimeXet = dateXet.ToShortDateString(), TienNhap = TongNhap / 1000000, TienBan = TongBan / 1000000, }); dateXet = dateXet.AddDays(1); if (dateXet == dateEnd) { break; } } } }
public void AddDataPoint(double x, double y) => DataPoints.Add(new DataPoint(x, y));
/// <summary> /// Adds the data point. /// </summary> /// <param name="dataPoint">The data point.</param> public void AddDataPoint(DataPoint dataPoint) { DataPoints.Add(dataPoint); }
public MainViewModel() { if (DataSeriesSources == null) { DataSeriesSources = new ObservableCollection <DataSeries>(); } var dataSeries = new DataSeries(); IAxisDataType yAxisDataType = new DoubleAxisData(); IAxisDataType xAxisDataType = new DoubleAxisData(); dataSeries.XAxis = new LinearXAxis(xAxisDataType); dataSeries.YAxis = new LinearYAxis(yAxisDataType); dataSeries.VisualType = ChartVisualType.VERTICALBAR; dataSeries.SeriesName = "My Test Series"; IDataPoints dataPoints = new DataPoints <double, double>(); dataPoints.Initialize(dataSeries); var point1 = new DataPoint <double, double>(1, 1, false); var point2 = new DataPoint <double, double>(2, 2, false); var point3 = new DataPoint <double, double>(3, 3, false); dataPoints.Add(point1); dataPoints.Add(point2); dataPoints.Add(point3); dataPoints.Add(point1); dataPoints.Add(point3); dataPoints.Add(point3); dataPoints.Add(point3); dataPoints.Add(point1); dataPoints.Add(point3); dataPoints.Add(point1); dataPoints.Add(point3); dataPoints.Add(point1); dataPoints.Add(point3); dataSeries.Points = dataPoints; dataSeries.PlotFlowAxisOption = PlotFlowAxisOptions.XAxis; dataSeries.BarWidth = 20; dataSeries.IsVisible = true; dataSeriesSources.Add(dataSeries); }