Comments (5)
No, there's not. But that seems reasonable to add. I'm assuming what you're interesting in is more like timeseries.last("15m")
-> new TimeSeries
than TimeRange.last("15m") -> a TimeRange
?
from pond.
@pjm17971 Yes, something along the lines of timeseries.last("15m")
would work very well! Not a priority, but nice to have feature.
from pond.
@cathal-killeen: Thanks for the offer to work on this. This one is a little tricky, because of the typescript port (#65). In particular, instead of periods (or durations) being specified as just a string, e.g. "1h" they will be a period("1d"). That constructor actually then work with either a ms duration, a string like above, a moment.duration or a moment.duration style object (as you described).
const m = moment.duration(24, "hours");
const p = period(m);
expect(+p).toBe(86400000);
// OR
const p = period({
seconds: 2,
minutes: 2,
hours: 2,
days: 2,
weeks: 2,
months: 2,
years: 2
});
expect(+p).toBe(69732122000);
That said, I haven't implemented this specific item. I'll ping you here when there's a branch here that you could implement that on top of without it being difficult to port over to typescript in the near future. There's a collection implementation in Typescript, but no TimeSeries on top of that yet.
It's pretty simple, because you can substract +period from the end time of the timeseries and use that time with bisect
or atTime
to get the index, and then slice
to the end.
from pond.
This is the current way I am doing it now:
new TimeRange(moment(trafficSeries.end()).subtract(15, 'minutes'), moment(trafficSeries.end()))
Was just wondering if there is a built in method.
from pond.
Has anyone been working on this @pjm17971? I would be interested in such a feature and would love to implement it. Ideally, I think the method API should follow the various Moment duration formats. Arbitrary durations could then easily be requested, such as timeseries.last({ minutes: 15, seconds: 30 })
from pond.
Related Issues (20)
- Timeseries with names containing dots are not compatible with fieldSpecs
- fixedWindowRollup of less than 1 second HOT 3
- Strong-type data points, avoid magic strings HOT 3
- How to use a Rolling/Sliding Window HOT 1
- How to append new events? HOT 4
- Suggested addition to rollup callendar intervals
- Remove moment.js to improve bundle sizes HOT 2
- TimeEvent implementation does not exist in index.d.ts HOT 5
- Displaying a specific column from TS
- TimeSeries.columns() throws iterator exception instead of returning empty array
- A time-series database? HOT 1
- Time-Index in Milliseconds? HOT 1
- duplicate *events def in timeseries.js v0.9.0
- Filter TimeSeries in pond 0.9
- Sampling of TimeSeries
- one of my favourite projects on github
- Creating a TimeSeries of IndexedEvent with indexes before epoch throws TypeError
- Use Generator for events generator function return type
- Property 'range' does not exist on type 'TimeSeries' in v0.9.0
- Index.getIndexString parameter definition missed in v0.9.0
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pond.