Skip to content

Commit

Permalink
set default values correctly when there is no data
Browse files Browse the repository at this point in the history
  • Loading branch information
w33ble committed Nov 7, 2014
1 parent 0c246df commit 7ad94c3
Showing 1 changed file with 18 additions and 13 deletions.
31 changes: 18 additions & 13 deletions src/kibana/plugins/vis_types/converters/tile_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,26 +65,31 @@ define(function (require) {
var center;
var rectangle;

var buckettingCol = _.find(columns, { categoryName: 'segment' });
var metricCol = _.find(columns, { categoryName: 'metric' });
if (!buckettingCol || !metricCol) return;

var length = rows.length;
var min = rows[rows.length - 1][1];
var max = rows[0][1];
var precision = rows[0][0].length;
var properties = {
label: chart.label,
length: length,
min: 0,
max: 0,
precision: buckettingCol.aggConfig.params.precision
};

if (length) {
properties.min = rows[rows.length - 1][1];
properties.max = rows[0][1];
properties.precision = rows[0][0].length;
}

var geoJSON = chart.geoJSON = {
properties: {
label: chart.label,
length: length,
min: min,
max: max,
precision: precision
},
properties: properties,
type: 'FeatureCollection',
features: []
};

var buckettingCol = _.find(columns, { categoryName: 'segment' });
var metricCol = _.find(columns, { categoryName: 'metric' });
if (!buckettingCol || !metricCol) return;

var aggConfig = metricCol.aggConfig;
var metricLabel = aggConfig.makeLabel();
Expand Down

0 comments on commit 7ad94c3

Please sign in to comment.