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

Metric vis should display a ? or 0 for empty sets #5532

Merged
merged 18 commits into from
Dec 16, 2015

Conversation

stormpython
Copy link
Contributor

Closes #3682.

In metric visualizations, when no data are available, a no results message should not be displayed. In the case of an empty (data) set, for Count, Unique Count, and Sum, 0 should be displayed. For all other metrics, a ? should be displayed.

…clude metric vis from showing no results. The metric vis should fall through to its own controller.
… 0 or ? for empty sets where appropropriate.
…and cleaning up code in the metric vis controller.
@tsullivan
Copy link
Member

I tested this out, and see that when no data is available, the Count, Sum, and Unique count metrics are showing "0" as expected. But other metrics are showing different - some are showing "NaN" and others are showing blank.

With Data:
screen shot 2015-12-01 at 10 29 51 am

No Data:
screen shot 2015-12-01 at 10 30 08 am

@tsullivan tsullivan assigned stormpython and unassigned tsullivan Dec 1, 2015
…that null and NaN values can be returned and needed to be handled. I re-organized the code to handle null, undefined, and NaN values in the metric controller.
@stormpython
Copy link
Contributor Author

@tsullivan I fixed the issues, assigning it back to you.

@stormpython stormpython assigned tsullivan and unassigned stormpython Dec 2, 2015
@@ -8,13 +9,22 @@ define(function (require) {

var metrics = $scope.metrics = [];

$scope.isNullorNaN = function (val) {
return _.isNull(val) || isNaN(val);
Copy link
Member

Choose a reason for hiding this comment

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

Can you change this to _.isNaN(val)? The global isNaN is not a good part of JS, it has weird behavior for non-numeric arguments.

@tsullivan tsullivan assigned stormpython and unassigned tsullivan Dec 3, 2015
@stormpython
Copy link
Contributor Author

@tsullivan made the corrections, passing back to you.

@stormpython stormpython assigned tsullivan and unassigned stormpython Dec 4, 2015
@tsullivan
Copy link
Member

LGTM

@stormpython stormpython assigned rashidkpc and unassigned tsullivan Dec 4, 2015
@@ -8,13 +9,22 @@ define(function (require) {

var metrics = $scope.metrics = [];

$scope.isNullorNaN = function (val) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this attached to $scope? I don't see it used in any views or child scopes.

@@ -44,6 +44,19 @@ define(function (require) {
var getVisEl = getter('.visualize-chart');
var getVisContainer = getter('.vis-container');

// Show no results message when hasZeroHits is true and it requires search
$scope.showNoResultsMessage = function () {
var requiresSearch = _.get($scope, 'vis.type.requiresSearch');
Copy link
Member

Choose a reason for hiding this comment

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

can _.has be used for requireSearch and shouldNotShowMessage?

Copy link
Member

Choose a reason for hiding this comment

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

my bad, I didn't notice these were both already booleans. it looks like the has check works fine but probably wasn't needed

@stormpython stormpython assigned jbudz and unassigned rashidkpc Dec 16, 2015
@stormpython
Copy link
Contributor Author

@jbudz I made changes based on your comments. Passing it back to you.

@jbudz
Copy link
Member

jbudz commented Dec 16, 2015

LGTM

@jbudz jbudz assigned stormpython and unassigned jbudz Dec 16, 2015
stormpython added a commit that referenced this pull request Dec 16, 2015
Metric vis should display a `?` or 0 for empty sets
@stormpython stormpython merged commit e6257c7 into elastic:master Dec 16, 2015
@stormpython stormpython deleted the fix/3682 branch December 16, 2015 19:15
@epixa epixa added v4.5.0 and removed v4.4.0 labels Jan 11, 2016
@epixa
Copy link
Contributor

epixa commented Feb 29, 2016

Backported in #5877

@JuanCarniglia
Copy link

I am not sure if 0 (zero) is a correct default value for SUM(of "no results"). If your data domain includes negative numbers, then zero is as good a number as fourteen. Maybe in that case, a N/A or something is more appropriate? Just saying...

@marksarnold
Copy link

I am using Kibana 5.5.1 and I do get the "No results found :-| " message for a simple count aggregation when there are no records. I really would expect a "0" there, and reading the above discussion, it sounds like "0" is what it should be doing...

@b8sell
Copy link

b8sell commented Nov 9, 2017

Also seeing "No results found" message in 5.5.2. Regression or do I have to switch something "on?"

@evisong
Copy link

evisong commented Nov 15, 2017

I'm using 5.2.2, I still get "No results found" prompt. Is there any special configuration?

@ppisljar
Copy link
Member

no results found actually indicates there were no records in the time range you are looking at (i think)
could you open up a spy panel and see what elasticsearch returns ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.