@d3fc/d3fc-group
Advanced tools
Comparing version 2.0.8 to 2.0.9
@@ -8,70 +8,72 @@ (function (global, factory) { | ||
var group = (function () { | ||
var key = ''; | ||
var orient = 'vertical'; // D3 CSV returns all values as strings, this converts them to numbers | ||
// by default. | ||
var key = ''; | ||
var orient = 'vertical'; | ||
// D3 CSV returns all values as strings, this converts them to numbers | ||
// by default. | ||
var value = function value(row, column) { | ||
return Number(row[column]); | ||
}; | ||
var value = function value(row, column) { | ||
return Number(row[column]); | ||
}; | ||
var verticalgroup = function verticalgroup(data) { | ||
return Object.keys(data[0]).filter(function (k) { | ||
return k !== key; | ||
}).map(function (k) { | ||
var values = data.filter(function (row) { | ||
return row[k]; | ||
}).map(function (row) { | ||
var cell = [row[key], value(row, k)]; | ||
cell.data = row; | ||
return cell; | ||
}); | ||
values.key = k; | ||
return values; | ||
}); | ||
}; | ||
var verticalgroup = function verticalgroup(data) { | ||
return Object.keys(data[0]).filter(function (k) { | ||
return k !== key; | ||
}).map(function (k) { | ||
var values = data.filter(function (row) { | ||
return row[k]; | ||
}).map(function (row) { | ||
var cell = [row[key], value(row, k)]; | ||
cell.data = row; | ||
return cell; | ||
}); | ||
values.key = k; | ||
return values; | ||
}); | ||
}; | ||
var horizontalgroup = function horizontalgroup(data) { | ||
return data.map(function (row) { | ||
var values = Object.keys(row).filter(function (d) { | ||
return d !== key; | ||
}).map(function (k) { | ||
var cell = [k, value(row, k)]; | ||
cell.data = row; | ||
return cell; | ||
}); | ||
values.key = row[key]; | ||
return values; | ||
}); | ||
}; | ||
var horizontalgroup = function horizontalgroup(data) { | ||
return data.map(function (row) { | ||
var values = Object.keys(row).filter(function (d) { | ||
return d !== key; | ||
}).map(function (k) { | ||
var cell = [k, value(row, k)]; | ||
cell.data = row; | ||
return cell; | ||
}); | ||
values.key = row[key]; | ||
return values; | ||
}); | ||
}; | ||
var group = function group(data) { | ||
return orient === 'vertical' ? verticalgroup(data) : horizontalgroup(data); | ||
}; | ||
var group = function group(data) { | ||
return orient === 'vertical' ? verticalgroup(data) : horizontalgroup(data); | ||
}; | ||
group.key = function () { | ||
if (!arguments.length) { | ||
return key; | ||
} | ||
key = arguments.length <= 0 ? undefined : arguments[0]; | ||
return group; | ||
}; | ||
group.key = function () { | ||
if (!arguments.length) { | ||
return key; | ||
} | ||
group.value = function () { | ||
if (!arguments.length) { | ||
return value; | ||
} | ||
value = arguments.length <= 0 ? undefined : arguments[0]; | ||
return group; | ||
}; | ||
key = arguments.length <= 0 ? undefined : arguments[0]; | ||
return group; | ||
}; | ||
group.orient = function () { | ||
if (!arguments.length) { | ||
return orient; | ||
} | ||
orient = arguments.length <= 0 ? undefined : arguments[0]; | ||
return group; | ||
}; | ||
group.value = function () { | ||
if (!arguments.length) { | ||
return value; | ||
} | ||
value = arguments.length <= 0 ? undefined : arguments[0]; | ||
return group; | ||
}; | ||
group.orient = function () { | ||
if (!arguments.length) { | ||
return orient; | ||
} | ||
orient = arguments.length <= 0 ? undefined : arguments[0]; | ||
return group; | ||
}; | ||
return group; | ||
}); | ||
@@ -78,0 +80,0 @@ |
@@ -6,2 +6,10 @@ # Change Log | ||
## [2.0.9](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-group@2.0.8...@d3fc/d3fc-group@2.0.9) (2019-09-04) | ||
**Note:** Version bump only for package @d3fc/d3fc-group | ||
<a name="2.0.8"></a> | ||
@@ -8,0 +16,0 @@ ## [2.0.8](https://github.com/d3fc/d3fc/compare/@d3fc/d3fc-group@2.0.7...@d3fc/d3fc-group@2.0.8) (2019-08-12) |
{ | ||
"name": "@d3fc/d3fc-group", | ||
"version": "2.0.8", | ||
"version": "2.0.9", | ||
"description": "A utility for manipulating CSV / TSV data to allow rendering of grouped series.", | ||
@@ -27,3 +27,4 @@ "license": "MIT", | ||
"access": "public" | ||
} | ||
}, | ||
"gitHead": "d216bebca76b9bde7456f1c06e768bc67814dd2e" | ||
} |
Sorry, the diff of this file is not supported yet
18797
12
313