Slackbot
05/23/2023, 7:15 AMtan tan
05/23/2023, 7:19 AMAdam Roberts
05/23/2023, 7:20 AMtan tan
05/23/2023, 7:23 AMconst groupLabels = ["Group 1", "Group 2", "Group 3"];
const dataSeries1 = [10, 20, 30];
const dataSeries2 = [15, 25, 35];
const dataSeries3 = [5, 15, 25];
I guess this is enough?tan tan
05/23/2023, 7:24 AMtan tan
05/23/2023, 7:25 AMcombinedData
tan tan
05/23/2023, 7:26 AMconst groupLabels = ["Group 1", "Group 2", "Group 3"];
const dataset =
[[10, 20, 30],
[15, 25, 35],
[5, 15, 25]];
that's the more accurate input.tan tan
05/23/2023, 7:29 AMpenguins
to dataset
https://observablehq.com/@observablehq/plot-stacked-bars?intent=forkAdam Roberts
05/23/2023, 7:40 AMAdam Roberts
05/23/2023, 7:43 AMAdam Roberts
05/23/2023, 7:44 AMAdam Roberts
05/23/2023, 7:44 AMtan tan
05/23/2023, 8:04 AMtan tan
05/23/2023, 8:11 AMGroup1, Group2, Group3
Tag1: [[10, 20, 30],
Tag2: [15, 25, 35],
Tag3: [5, 15, 25]];
Tag1,2,3
sum up to a single bar for each group, dataset is a matrix instead of an array of objectAdam Roberts
05/23/2023, 9:32 AMconst groupLabels = ["Group 1", "Group 2", "Group 3"];
const dataset =
[[10, 20, 30],
[15, 25, 35],
[5, 15, 25]];
const datasetAsArray = groupLabels.map((label, i) => dataset[i].map(d => ({group: label, value: d}))).flat()
Adam Roberts
05/23/2023, 9:43 AM