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

Y-axis as percentage of total of all x-values #4612

Closed
joshsuihn opened this issue Aug 7, 2015 · 12 comments
Closed

Y-axis as percentage of total of all x-values #4612

joshsuihn opened this issue Aug 7, 2015 · 12 comments
Labels
Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:enhancement stalled Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@joshsuihn
Copy link

I'd like to create a percentage histogram (distribution) visualization in Kibana.
Each document has a 'DurationInSeconds' field and I can create a histogram with a bucket size (e.g. 10, so each bucket interval should be [0,9], [10,19], [20,29], ...) and count (number of documents when the duration is within one bucket ) on y-axis.
But, I'd like to have this histogram in Percentage on Y-axis.
I think using JSON Input it might be possible, but don't know how to do this exactly.
Is there any way to do this?

Thanks!

@rashidkpc
Copy link
Contributor

Can you maybe post an example of the chart you're trying to create? Its possible to create percentage histograms in the bar chart, but its unclear if this option is what you're looking for. See Bar Mode on this page: https://www.elastic.co/guide/en/kibana/current/vertical-bar-chart.html

@joshsuihn
Copy link
Author

Thanks for your reply and sorry for not making my question clear.
I elaborate my question :)
Each document in ElasticSearch has a 'DurationInSeconds', timestamp, etc,
e.g.
_source": {
"CallId": "123456",
"Timestamp": "2015-07-01T00:00:01.832+0000",
"DurationInSeconds": 1,
}

I created one visualization with bar chart. In X-Axis option, aggregation was set to "Histogram" and in the Field drop-down menu, I selected 'DurationInSeconds' which is integer value (long type), and the interval was set to 5. In Y-xis option, I selected "Count".
So, I can see the duration distribution.
i.e. In the first bar in the histogram, value (count on y-axis) is 100, where 0 <= Duration < 5, (bucket size (interval) is 5)
Second bar in the histogram, value is 50, where 5 <= Duration < 10,
Third bar in the histogram, value is 70, where 5 <= Duration < 10.

Currently, Y-axis shows count, but I'd like to see this in %.
So, First bar value in the histogram should be (100/(100+50+70))_100
second bar value in the histogram should be (50/(100+50+70))_100
thrid bar value in the histogram should be (70/(100+50+70))*100

if I change 'Bar Mode' from stacked to percentage, all bars in the histogram reach 100% (just flat distribution in %).

@Maran123
Copy link

Not sure if I understand you correctly, but before I was trying to make something similar in Kibana but I ended upp manually doing it in excel. I'm charting X-axis as response time and Y-axis as percentiles.

I think it would be a great edition to Kibana if you could chart percentiles in this way.

Here I'm charting one functionality
image

Here i'm comparing two functionalities
image

@rashidkpc
Copy link
Contributor

Ok, so you want each bar to show as a percentage of a total of all of the bars. I can't think of an elasticsearch aggregation that would accomplish this, but maybe there is one?

@rashidkpc rashidkpc changed the title Percentage histogram in Kibana Y-axis as percentage of total of all bars Sep 15, 2015
@rashidkpc rashidkpc changed the title Y-axis as percentage of total of all bars Y-axis as percentage of total of all x-values Sep 15, 2015
@tbragin tbragin added the Feature:Visualizations Generic visualization features (in case no more specific feature label is available) label Nov 15, 2016
@tripleee
Copy link

I don't think this is very hard to understand. You want to visualize the buckets as stacked bars so that the total is always exactly 100%. So the top of the Y range is 100% for every stack and what's interesting is how the buckets are distributed in the stacked bars in that sample. Quick googling gets me e.g. this (which is for Excel): http://myexcelonline.com/blog/100-stacked-column-chart-percentage-contributions/ and this (for R): http://stackoverflow.com/questions/8757680/how-can-i-create-a-100-stacked-histogram-in-r

@nrlewis
Copy link

nrlewis commented Mar 1, 2017

I'm noticing the same thing. When I use a Bar Graph with Y axis to "count" and the X axis to some field, I get a binned histogram. When I select Options-BarMode-> Percentage, all of the percentages turn to 100%, as if it's doing something like binCount/binCount instead of binCount/TotalCount

@timroes timroes added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Sep 16, 2018
@dpasqualin
Copy link

I know it has been 5 years since @joshsuihn created this issue and three years since @nrlewis posted the comment with more thumbs up, which is the issue that I'm facing now. Do you guys have any solution for this?

This is what I see here. First picture is on "normal" mode and second on "percentage".

ex1
ex2

@RasmusO95
Copy link

@dpasqualin Im facing same difficulties as you are :/

@FlorianHeigl
Copy link

soon 6 years? it has been so long since i ran into this that i practically unlearned how to use kibana.

@tripleee
Copy link

Also, for what it's worth, the direct competition i.e. Splunk trivially supports this out of the box. Just click "stacked 100%" in the Stack Mode selector in the General tab of the Format dialog when creating a visualization.

Screen Shot 2021-02-17 at 18 55 40

@timroes
Copy link
Contributor

timroes commented Jun 21, 2021

This will be possible using the upcoming Lens Formulas (see #91087) in 7.14, by using an expression like the following:

Screenshot 2021-06-21 at 16 49 58

I'll close this issue in favor of the above linked Lens formular issue.

@timroes timroes closed this as completed Jun 21, 2021
@ajocelynpatrick
Copy link

Any evolution on this subject? I still reproduce the problem on Kibana 7.16

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Visualizations Generic visualization features (in case no more specific feature label is available) release_note:enhancement stalled Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests