Skip to content
Snippets Groups Projects
Commit 3a0d3034 authored by Benjamin Ledel's avatar Benjamin Ledel
Browse files

*

parent 51b2f64f
Branches master
No related tags found
No related merge requests found
......@@ -35,7 +35,7 @@ export class SimpleGroupedBarChartWidget extends BaseChartWidget {
data.flatMap(
item => Object.keys(item)
)
));
)).filter(s => s != "name");
const names = data.reduce( (agg, curr) => [...agg, curr["name"]], [])
const dataFlatted = categories.flatMap(category => data.map(d => ({name : d.name, category : category, value: d[category]}))) // pivot longer
......@@ -64,7 +64,7 @@ export class SimpleGroupedBarChartWidget extends BaseChartWidget {
xDomain: names,
//yDomain : [0,40],
zDomain: categories,
colors: d3.schemeSpectral[categories.length]
colors: d3.schemeSpectral[categories.length < 10 ? 10 : categories.length]
}
super(title, description, dataFlatted, options);
......@@ -174,7 +174,7 @@ export class SimpleGroupedBarChartWidget extends BaseChartWidget {
if(drawLegend)
{
// custom legend
let runner = 2;
let runner = 2;
(zDomain??[]).forEach( (ele) => {
runner+=1
const color = zScale(ele)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment