mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
Merge pull request #3918 from stormpython/pieHighlighting
Fixes issues with highlighting of numeric and date values in pie charts
This commit is contained in:
commit
3c28b3d870
4 changed files with 11 additions and 27 deletions
|
@ -13,19 +13,12 @@ define(function () {
|
|||
|| (col && col.label)
|
||||
|| ('level ' + item.depth);
|
||||
|
||||
// Set the bucket name, and use the converter to format the field if
|
||||
// the field exists.
|
||||
var bucket = item.name;
|
||||
if (col) {
|
||||
bucket = col.fieldFormatter()(bucket);
|
||||
}
|
||||
|
||||
// Add the row to the tooltipScope.rows
|
||||
memo.unshift({
|
||||
aggConfig: col,
|
||||
depth: depth,
|
||||
field: field,
|
||||
bucket: bucket,
|
||||
bucket: item.name,
|
||||
metric: item.size,
|
||||
item: item
|
||||
});
|
||||
|
|
|
@ -5,19 +5,16 @@ define(function (require) {
|
|||
var AggConfigResult = require('components/vis/_agg_config_result');
|
||||
return function transformAggregation(agg, metric, aggData, parent) {
|
||||
return _.map(extractBuckets(aggData), function (bucket) {
|
||||
// Pick the appropriate value, if the metric doesn't exist then we just
|
||||
// use the count.
|
||||
var value = bucket.doc_count;
|
||||
if (bucket[metric.id] && !_.isUndefined(bucket[metric.id].value)) {
|
||||
value = bucket[metric.id].value;
|
||||
}
|
||||
var aggConfigResult = new AggConfigResult(
|
||||
agg,
|
||||
parent && parent.aggConfigResult,
|
||||
metric.getValue(bucket),
|
||||
agg.getKey(bucket)
|
||||
);
|
||||
|
||||
// Create the new branch record
|
||||
var $parent = parent && parent.aggConfigResult;
|
||||
var aggConfigResult = new AggConfigResult(agg, $parent, value, agg.getKey(bucket));
|
||||
var branch = {
|
||||
name: bucket.key,
|
||||
size: value,
|
||||
name: agg.fieldFormatter()(bucket.key),
|
||||
size: aggConfigResult.value,
|
||||
aggConfig: agg,
|
||||
aggConfigResult: aggConfigResult
|
||||
};
|
||||
|
|
|
@ -461,8 +461,7 @@ define(function (require) {
|
|||
var self = this;
|
||||
|
||||
_.forEach(array, function (obj) {
|
||||
var fieldFormatter = obj.aggConfig ? obj.aggConfig.fieldFormatter() : String;
|
||||
names.push({ key: fieldFormatter(obj.name), index: index });
|
||||
names.push({ key: obj.name, index: index });
|
||||
|
||||
if (obj.children) {
|
||||
var plusIndex = index + 1;
|
||||
|
|
|
@ -106,11 +106,6 @@ define(function (require) {
|
|||
var tooltip = self.tooltip;
|
||||
var isTooltip = self._attr.addTooltip;
|
||||
|
||||
var format = function (d, label) {
|
||||
var formatter = d.aggConfig ? d.aggConfig.fieldFormatter() : String;
|
||||
return formatter(label);
|
||||
};
|
||||
|
||||
var partition = d3.layout.partition()
|
||||
.sort(null)
|
||||
.value(function (d) {
|
||||
|
@ -155,7 +150,7 @@ define(function (require) {
|
|||
.style('stroke', '#fff')
|
||||
.style('fill', function (d) {
|
||||
if (d.depth === 0) { return 'none'; }
|
||||
return color(format(d, d.name));
|
||||
return color(d.name);
|
||||
});
|
||||
|
||||
if (isTooltip) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue