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

Added percent values in the tooltip and legend for stacked series #3362

Conversation

toni-moreno
Copy link
Contributor

With this PR you can see the percent of each series to the total stacked series by only move the mouse over the graph.

Useful to see in one view how big is a measurement and it's relative amount against other measurements and the total stacked

image

A new checkbox enable/disable this new feature.

image

You can disable this feature for individual series by only overriding the stack

image

This is the full editor

image

@toni-moreno
Copy link
Contributor Author

Hi @torkelo , while working in this PR I've found something strange. Perhaps a "impossible condition" like that

if ( a ) {
 if (!a ) {
  //impossible to reach this code
 }
}

in:
https://github.com/grafana/grafana/blob/master/public/app/panels/graph/graph.tooltip.js#L61-L62

If you agree I can include the fix in this PR.

@torkelo
Copy link
Member

torkelo commented Nov 30, 2015

yes you are right about that condition

@toni-moreno
Copy link
Contributor Author

Hi @torkelo , ready to merge. ;)

@torkelo
Copy link
Member

torkelo commented Nov 30, 2015

Not sure there is enough demand for this option, maybe if there is many +1 votes :)

@torkelo
Copy link
Member

torkelo commented Nov 30, 2015

seems like a very special case to show percent in the tooltip only.

@sbengo
Copy link
Contributor

sbengo commented Nov 30, 2015

👍!

@nopzor1200
Copy link
Contributor

+1

(really useful to see the distribution of things in the series without having to parse the values in your head)

@toni-moreno
Copy link
Contributor Author

Hi @torkelo I think this case is not any special case.

Consider memory metrics from collectd

https://collectd.org/wiki/index.php/Plugin:Memory

We have rendering from graphite as:

image

Can you "in a fast view" say us the % of used memory, now?

If you merge this you will see the % of used memory only with a look!

@utkarshcmu
Copy link
Collaborator

+1

@torkelo
Copy link
Member

torkelo commented Dec 1, 2015

@toni-moreno I agree, sounds pretty useful for memory graphs. But still another option to maintain. With some unit tests and +1 votes it will very likely be merged :)

@toni-moreno
Copy link
Contributor Author

Ok. @torkelo unit test added..

...this few line of code are easy to maintain ( only one more variable and a loop to compute percent values).. nothing more!!

@holozip
Copy link

holozip commented Dec 2, 2015

+1

@shanielh
Copy link
Contributor

shanielh commented Dec 4, 2015

Super feature. I'm looking for this one a lot of time, and also an option to add the percent of total in the legend.

@toni-moreno
Copy link
Contributor Author

Hi @shanielh I like your idea, but I need to understand in which time are you computing the % ?

In the tooltip is clear that % depends on the time where mouse are placed, but legend values references a window time rather than a point.
As I saw in the code

sumTotal += series.stats.total;

Why are you computing % with total of series? perhaps could be more logical % on the average of each serie or perhaps the last value. ( I would prefer last value)

Indeed you could compute different % values based on ( avg,max,min,total, last).

What do you thing about @torkelo ?

@shanielh
Copy link
Contributor

shanielh commented Dec 4, 2015

%avg will be the same as %total if the series have the same number of points. If they don't have the same number of points it might be logical to add %avg.

The %current (last values) can be given by the tooltip when pointing to the last point.

And I wasn't sure %min and %max would mean anything. In my case I really needed the %total because I have two graphs (or more) that splits the data to "buckets" and difference between the %totals points to success / failure. Think about graph of impressions and graph of conversions and two series of two algorithms that serves ads. So, if the first one has 40% impressions and 45% conversions, it might mean that it's better.

@toni-moreno
Copy link
Contributor Author

You are right , I think is not possible stacked series with different number of points... in this case %total is good enough for us. I will merge and test tomorrow or Monday.

Thank you very much to share this code with me ( and I hope with everybody if @torkelo, can accept it)

@toni-moreno toni-moreno changed the title Added percent values in the tooltip for stacked series Added percent values in the tooltip and legend for stacked series Dec 5, 2015
@toni-moreno toni-moreno force-pushed the add_percent_on_stacked_series_tooltip branch from 1a77e19 to c1fb20f Compare December 5, 2015 06:34
@toni-moreno
Copy link
Contributor Author

Hi @torkelo I've rebased to resolve conficts after merge the changes from @shanielh .

Now this PR is more consistent. you can see % on stacked series on both places (tooltip for instant percent ) and legend from window based percent.

On legend

image

On tooltip

image

And here instant and window based percent

image

@Qtax
Copy link
Contributor

Qtax commented Dec 5, 2015

+1

@shanielh
Copy link
Contributor

shanielh commented Dec 6, 2015

@toni-moreno Thanks for merging. I hope it's going to get to the next version or to 2.6 👍

@torkelo
Copy link
Member

torkelo commented Jan 13, 2016

I not sure about this one. And right now it also included a new legend value which I think is a seperate feature.

@barvinograd
Copy link

+1

@nordewal
Copy link

+1

1 similar comment
@inbilla
Copy link

inbilla commented Oct 5, 2016

+1

@torkelo
Copy link
Member

torkelo commented Dec 7, 2016

Sorry, closing this as it's drifted a bit from master. If you have time please reopen as a feature request so that people who have a need for this has a place to vote for it.

@torkelo torkelo closed this Dec 7, 2016
@ying-jeanne ying-jeanne added the pr/external This PR is from external contributor label Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.