Skip to content

Commit

Permalink
Merge pull request #3 from w33ble/feature/tilemap
Browse files Browse the repository at this point in the history
Feature/tilemap fixes...
  • Loading branch information
spenceralger committed Nov 7, 2014
2 parents 9ad726e + 7ad94c3 commit 0055620
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
7 changes: 6 additions & 1 deletion src/kibana/components/agg_response/flat.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,15 @@ define(function (require) {

if (resp.aggregations) {
splitAndFlatten(chartData, resp.aggregations);
} else {
} else if (colStack.length === 1 && colStack[0].aggConfig.type.name === 'count') {
writeRow(chartData, { doc_count: resp.hits.total });
}

// ensure chart container is always created
if (!chartData.rows && !chartData.splits) {
writeRow(chartData);
}

// add labels to each config before they are processed
configs.forEach(function (config) {
if (config.label) return;
Expand Down
3 changes: 3 additions & 0 deletions src/kibana/components/vislib/visualizations/tile_map.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ define(function (require) {
}
TileMap.Super.apply(this, arguments);

// track the map objects
this.maps = [];

// add allmin and allmax to geoJSON
var mapDataExtents = handler.data.mapDataExtents(handler.data.data.raw);
chartData.geoJSON.properties.allmin = mapDataExtents[0];
Expand Down
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 0055620

Please sign in to comment.