问题
I've gone through this particular ticket, which pretty much talks about adding a threshold line, to a line graph
.
In my case, I'm having a bar graph
like this where I need to have a threshold, lets say for example in the above graph itself I should be able to show the difference in each and every bar.
In other words as per the above graph, it's displaying the sum
of chargeamount
according to the filter
I've given. What I need to do is, to show the difference using a color in the same bar itself if the sum
of chargeamount
is greater than 50,000.
So is there a way that I can show the bar with the default color for the filter (ie: the ones which are less than 50,000) and the rest should be shown in a different color conveying the threshold. So that the user can see the difference in the bar itself, whether they've achieved more than 50k.
Is this possible using a bar graph
or should I be get going with some other graph?
EDIT:
Just noticed that this issue is still open. Any enhancement over that, or any work around available atm?
Any help could be appreciated. :)
回答1:
Timelion to the rescue! Altough haven't figured out stacking something like this could work for now:
.es(*).if(gt,100,.es(*),null).bars().color(red) .es(*).if(lte,100,.es(*),null).bars().color(blue) .static(100)
Here is what it does:
1.Get every datapoint with a value greater than 100 and null everything else. Make a bar graph with color red.
2.Get every datapoint with a value less than equal 100 and null everything else. Make a bar graph and color it red.
3.Finally draw a line at value 100.
What you need to do is replace the *
with a valid expression and you should be good to go!
There might be a way to subtract the value and add it on another graph but I haven't figured out how to do that. If I find a solution I will update this answer.
来源:https://stackoverflow.com/questions/41478503/how-can-i-apply-a-threshold-for-a-bar-graph-in-kibana