return function (event) {
      const datum = event.datum;

      // Collect the current leaf and parents into an array of values
      $tooltipScope.rows = collectBranch(datum);

      const metricCol = $tooltipScope.metricCol = _.find(columns, { categoryName: 'metric' });

      // Map those values to what the tooltipSource.rows format.
      _.forEachRight($tooltipScope.rows, function (row, i, rows) {
        row.spacer = $sce.trustAsHtml(_.repeat(' ', row.depth));

        let percent;
        if (row.item.percentOfGroup != null) {
          percent = row.item.percentOfGroup;
        }

        row.metric = metricCol.aggConfig.fieldFormatter()(row.metric);

        if (percent != null) {
          row.metric += ' (' + numeral(percent).format('0.[00]%') + ')';
        }

        return row;
      });

      $tooltipScope.$apply();
      return $tooltip[0].outerHTML;
    };
Beispiel #2
0
 beforeEach(function () {
   results = collectBranch({
     name: 'bucket3',
     depth: 3,
     size: 6,
     field: { format: { convert: convert } },
     aggConfig: {
       getFieldDisplayName: _.constant('field3'),
       fieldFormatter: _.constant(String),
       makeLabel: () => {},
     },
     parent: {
       name: 'bucket2',
       depth: 2,
       size: 12,
       aggConfig: {
         fieldFormatter: _.constant(String),
         getFieldDisplayName: _.constant('field2'),
         makeLabel: () => {},
       },
       parent: {
         name: 'bucket1',
         depth: 1,
         size: 24,
         parent: {}
       }
     }
   });
 });
Beispiel #3
0
 beforeEach(function () {
   results = collectBranch({
     name: 'bucket3',
     depth: 3,
     size: 6,
     field: { format: { convert: convert } },
     aggConfig: { params: { field: { displayName: 'field3' } }, fieldFormatter: _.constant(String) },
     parent: {
       name: 'bucket2',
       depth: 2,
       size: 12,
       aggConfig: { label: 'field2', fieldFormatter: _.constant(String) },
       parent: {
         name: 'bucket1',
         depth: 1,
         size: 24,
         parent: {}
       }
     }
   });
 });