Skip to content

Commit

Permalink
ensure we are working with data-series (elastic#13266)
Browse files Browse the repository at this point in the history
This fixes a regression introduced by elastic#13217.
  • Loading branch information
thomasneirynck committed Aug 1, 2017
1 parent bdf6c32 commit eb91ae1
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/ui/public/vislib/lib/dispatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,16 @@ export function VislibLibDispatchProvider(Private, config) {
};

if (isSeries) {
// Find object with the actual d value and add it to the point object
const aggId = d3.event.target.parentElement.__data__.aggId;
const percentageMode = handler.charts[0].getSeries(aggId).getValueAxis().axisConfig.isPercentage();
let percentageMode = false;
//only series charts work in percentage mode.
if (handler.charts && handler.charts[0] && handler.charts[0].getSeries && d3.event.target.parentElement.__data__) {
const aggId = d3.event.target.parentElement.__data__.aggId;
const seriesFromAggId = handler.charts[0].getSeries(aggId);
if (seriesFromAggId && seriesFromAggId.getValueAxis) {
percentageMode = seriesFromAggId.getValueAxis().axisConfig.isPercentage();
}
}

const object = _.find(series, { 'label': label });
if (object) {
eventData.value = +object.values[i].y;
Expand Down

0 comments on commit eb91ae1

Please sign in to comment.