lagotto / alm-report

ALM Reports
http://almreports.plos.org/
MIT License
8 stars 3 forks source link

Bubble chart axis (Test.parascope.io) #98

Closed jenniferlin15 closed 9 years ago

jenniferlin15 commented 9 years ago

In the test instance, the new bubble charts offer the user the choice of the following additional axis:

Please use this selection instead and label them as listed (in the exact order)

It should default to Scopus citations. If there are no counts for these sources, hide the selection so that only the sources which have counts are displayed in the dropdown box. The description for the first option: "No source selected" is detailed in this ticket: https://github.com/articlemetrics/alm-report/issues/102.

jure commented 9 years ago

Cool. What about Nature, PubMed, Copernicus, DataCite, and others that are sometimes present in the API, but are not on the above list?

The "no counts" is a bit fuzzy. There is no difference between a source that has no data, and a source that has data where the count is 0. What would be a good metrics to hide a selection? One idea is to hide it only if all of the individual items' source.metrics.total counts are 0. Is that what you had in mind?

jure commented 9 years ago

The hiding is implemented like this now:

  removeEmptySources: function () {
    var emptySources = _.intersection.apply(this, this.get('items').map(
      function (d) {
        return _(d.get('sources')).map(function(s) {
          if(!s.metrics || s.metrics.total == 0) {
            return s.name
          }
        }).compact().value();
    }));

    this.set('axes', _.filter(this.get('axes'), function (selection) {
      return emptySources.indexOf(selection.key) == -1;
    }));
  }

So it checks for source.metrics.total equal to 0, and if it finds such a source in all of the items of the report, it will hide that source.

mfenner commented 9 years ago

There is a small difference between a source that has no data and the source for which we have an event_count of 0, i.e. in the latter case we know that there are no events, whereas in the former case we might not have checked or received an error.

Because all these 0 event_counts can dramatically increase the size both of the table storing this information and of the JSON payload, I want to move away from sending event_count = 0 in the API, so that your code changes are a good fit.