private void SplitYearlyClick(object sender, RoutedEventArgs e) { try { var ts = TsParser.ParseTimeseries(tbSource.Text); var tsWithInserts = new Periodizer().InsertPoints(ts, Interval.Year); var splitPerYear = new Splitter().SplitPerYear(tsWithInserts); string result = string.Empty; var maxEntries = splitPerYear.Max(x => x.Count); for (var i = 0; i < maxEntries; i++) { string line = string.Empty; foreach (var series in splitPerYear) { if (series.Count > i) { line += series[i]; line += ColumnSeparator; } } result += line + "\r\n"; } tbResult.Text = result; } catch (Exception ex) { tbResult.Text = ex.ToString(); } }
/// <summary> /// Periodizes a timeseries /// </summary> /// <param name="id">a tab-separated list of times and values</param> /// <returns></returns> /// <remarks>It seems that the parameter must be named id for this /// method to be hit. Otherwise the parameterless Get is called.</remarks> public string Get(string id) { //var id = 12345; var ts = TsParser.ParseTimeseries(id); // Problem: A tab in the request is not accepted by the browser var periodizer = new Periodizer(); return(periodizer.InsertPoints(ts, Interval.Year).ToString()); //return $"the value of {id} is {id * id}"; }
public async Task <AddRegisterEntryResult> Handle(AddRegisterEntriesCommand request, CancellationToken cancellationToken) { var timeseries = TsParser.ParseTimeseries(request.Model.EntriesString); var repo = _factory.GetRegistryEntryRepo(request.IdentityName); await repo.AddRegistryEntries(timeseries); return(new AddRegisterEntryResult()); }
private void InsertPointsClick(object sender, RoutedEventArgs e) { try { var ts = TsParser.ParseTimeseries(tbSource.Text); var result = new Periodizer().InsertPoints(ts, Interval.Year); tbResult.Text = result.ToString(); } catch (Exception ex) { tbResult.Text = ex.ToString(); } }
public ActionResult SubmitRegisterEntries(RegisterEntriesModel model) { var timeseries = TsParser.ParseTimeseries(model.EntriesString); var repo = GetRegistryEntryRepo(); foreach (var tvq in timeseries) { repo.AddRegistryEntry(tvq); } ViewBag.Title = "Mätarställningar registrerade"; ViewBag.SubTitle = "Mätarställningarna blev registrerade"; return(View(model)); }
static void Main(string[] args) { var files = new[] { "backbone.d.ts", "node.d.ts", "lib.d.ts", }; foreach (var file in files) { var parser = new TsParser(); var filename = @"..\\..\\res\\" + file; var code = File.ReadAllText(filename); var parsed = parser.Parse(code); } }
private void SplitMonthlyClick(object sender, RoutedEventArgs e) { try { var ts = TsParser.ParseTimeseries(tbSource.Text); var tsMonthly = new Periodizer().MonthlyAverage(ts); var splitPerYear = new Splitter().SplitPerYear(tsMonthly); var writer = new StringWriter(); var renderer = new MonthlyValueTextRenderer(CultureInfo.CurrentCulture, ColumnSeparator); renderer.Render(splitPerYear, writer); tbResult.Text = writer.ToString(); } catch (Exception ex) { tbResult.Text = ex.ToString(); } }
public ActionResult SubmitRegisterEntries(RegisterEntriesModel model) { try { var timeseries = TsParser.ParseTimeseries(model.EntriesString); var repo = new RegistryEntryRepoFactory().GetRegistryEntryRepo(User.Identity.Name); foreach (var tvq in timeseries) { repo.AddRegistryEntry(tvq); } ViewBag.Title = "Mätarställningar registrerade"; ViewBag.SubTitle = "Mätarställningarna blev registrerade"; return(View(model)); } catch (Exception e) { _logger.TrackException(e); return(View("Error")); } }