Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .aggregate() function to timelion #11556

Merged
merged 1 commit into from
May 12, 2017

Conversation

rashidkpc
Copy link
Contributor

The purpose of .aggregate() is to reduce the set of points in a series to a single, static, value. This is especially useful for things like using aggregate(first) for calculating growth since inception of stocks

@rashidkpc rashidkpc self-assigned this May 1, 2017
@rashidkpc rashidkpc requested a review from ppisljar May 1, 2017 23:42
@tbragin tbragin added Feature:Visualizations Generic visualization features (in case no more specific feature label is available) Feature:Timelion Timelion app and visualization labels May 2, 2017
import _ from 'lodash';

module.exports = function (points) {
return _.first(points);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we really need a wrapper around lodash ? we use it directly everywhere else in our codebase ? (goes for this, min, max, sum, last)

@ppisljar
Copy link
Member

ppisljar commented May 3, 2017

maybe add median and standard deviation, to match whats offered in visualize ?

Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@thomasneirynck thomasneirynck self-requested a review May 3, 2017 12:15
@rashidkpc
Copy link
Contributor Author

@thomasneirynck Did you still want to review this? I'd like to get it merge for 5.5

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice addition!

I'd consider inlining the implementations to reduce the footprint.

max: require('./max'),
last: require('./last'),
first: require('./first'),
sum: require('./sum')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

similar comment as @ppisljar. Why not just inline the implementations here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They're separate because I reuse them in a function I haven't submitted a pull for yet: https://github.com/rashidkpc/timelion-extras/blob/master/functions/orderby/index.js

@rashidkpc rashidkpc merged commit f593eb3 into elastic:master May 12, 2017
snide pushed a commit to snide/kibana that referenced this pull request May 30, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Timelion Timelion app and visualization Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:enhancement v5.5.0 v6.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants