component-horizontal-stacked-bar
Advanced tools
Comparing version 2.0.0 to 2.0.1
@@ -38,3 +38,3 @@ (function (global, factory) { | ||
function decorateSeriesWithOriginalData(series) { | ||
var data = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
var data = arguments.length <= 1 || arguments[1] === undefined ? [] : arguments[1]; | ||
@@ -44,5 +44,6 @@ return series.map(function (items) { | ||
return items.map(function (item) { | ||
item.name = key; | ||
item.value = data[key]; | ||
return item; | ||
var matchedOrginalItem = data.find(function (originalItem) { | ||
return originalItem.name === key; | ||
}); | ||
return Object.assign(item, matchedOrginalItem); | ||
}); | ||
@@ -129,3 +130,3 @@ }); | ||
var seriesGenerator = d3Shape.stack().keys(names); | ||
var decoratedSeries = decorateSeriesWithOriginalData(seriesGenerator([dataAsObject]), dataAsObject); | ||
var decoratedSeries = decorateSeriesWithOriginalData(seriesGenerator([dataAsObject]), data); | ||
@@ -132,0 +133,0 @@ var total = sumValues(data); |
{ | ||
"name": "component-horizontal-stacked-bar", | ||
"version": "2.0.0", | ||
"version": "2.0.1", | ||
"description": "A horizontal stacked bar component created with React and d3", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
30179
146