From 853c7a45e1bee8bbc4ff9bba1923216c5024d094 Mon Sep 17 00:00:00 2001 From: Shelby Sturgis Date: Wed, 6 Apr 2016 00:23:49 -0700 Subject: [PATCH] init commit --- public/heatmap.js | 2 +- public/lib/heatmap_controller.js | 16 ++++++++++++---- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/public/heatmap.js b/public/heatmap.js index 040c50e..9fbf324 100644 --- a/public/heatmap.js +++ b/public/heatmap.js @@ -16,7 +16,7 @@ function HeatmapProvider(Private) { params: { defaults: { margin: { top: 20, right: 200, bottom: 100, left: 100 }, - stroke: '#eee', + stroke: '#ffffff', strokeWidth: 1, padding: 0 }, diff --git a/public/lib/heatmap_controller.js b/public/lib/heatmap_controller.js index 35fae80..8dad2ff 100644 --- a/public/lib/heatmap_controller.js +++ b/public/lib/heatmap_controller.js @@ -12,6 +12,14 @@ module.controller('HeatmapController', function ($scope) { var rowAggId = _.first(_.pluck($scope.vis.aggs.bySchemaName['rows'], 'id')); var metricsAgg = _.first($scope.vis.aggs.bySchemaName['metric']); + var colFormatter = _.head($scope.vis.aggs.bySchemaName['columns']); + var rowFormatter = _.head($scope.vis.aggs.bySchemaName['rows']); + + function formatter(value) { return value; } + + colFormatter = colFormatter ? colFormatter.fieldFormatter() : formatter; + rowFormatter = rowFormatter ? rowFormatter.fieldFormatter() : formatter; + function aggregate(resp, columnAggId, rowAggId) { var columns = resp.aggregations[columnAggId]; var rows = resp.aggregations[rowAggId]; @@ -42,16 +50,16 @@ module.controller('HeatmapController', function ($scope) { if (second) { return second.map(function (subBucket) { return { - col: columns ? key : subBucket.key, - row: rows ? key : subBucket.key, + col: columns ? colFormatter(key) : colFormatter(subBucket.key), + row: rows ? rowFormatter(key) : rowFormatter(subBucket.key), value: metricsAgg.getValue(subBucket) }; }); } return { - col: columns ? key : undefined, - row: rows ? key : undefined, + col: columns ? colFormatter(key) : undefined, + row: rows ? rowFormatter(key) : undefined, value: metricsAgg.getValue(bucket) }; });