-
Notifications
You must be signed in to change notification settings - Fork 5
/
datatransformation.js
32 lines (31 loc) · 4.81 KB
/
datatransformation.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
var copy = {
type: 'horizontalBar',
data: {
labels: ["totesbasic (18,781)", "kittencream (18,536)", "granitegrey (17,462)", "luckystripe (12,901)", "thicccbrowz (12,078)", "crazy (11,598)", "soserious (9,307)", "himalayan (9,244)", "pouty (9,102)", "sizzurp (8,801)", "happygokitty (8,792)", "strawberry (8,634)", "ragamuffin (8,602)", "greymatter (7,796)", "sphynx (7,517)", "munchkin (7,164)", "mintgreen (7,162)", "aquamarine (7,104)", "orangesoda (7,025)", "topaz (6,986)", "chocolate (6,967)", "lemonade (6,870)", "swampgreen (6,812)", "simple (6,643)", "raisedbrow (6,614)", "royalpurple (6,371)", "coffee (5,864)", "salmon (5,814)", "shadowgrey (5,714)", "tongue (4,218)", "chestnut (3,599)", "cloudwhite (3,413)", "laperm (3,338)", "saycheese (3,257)", "calicool (3,179)", "barkbrown (3,116)", "cymric (2,990)", "beard (2,743)", "tigerpunk (2,419)", "mauveover (2,324)", "limegreen (2,243)", "skyblue (1,935)", "spock (1,746)", "dali (1,671)", "emeraldgreen (1,537)", "otaku (1,458)", "bubblegum (1,316)", "bloodred (1,163)", "scarlet (1,028)", "fabulous (674)", "peach (473)", "gold (448)", "chartreux (260)", "cerulian (226)", "jaguar (156)", "wingtips (125)", "whixtensions (94)", "mainecoon (81)"],
datasets: [{
label: null,
data: [18781, 18536, 17462, 12901, 12078, 11598, 9307, 9244, 9102, 8801, 8792, 8634, 8602, 7796, 7517, 7164, 7162, 7104, 7025, 6986, 6967, 6870, 6812, 6643, 6614, 6371, 5864, 5814, 5714, 4218, 3599, 3413, 3338, 3257, 3179, 3116, 2990, 2743, 2419, 2324, 2243, 1935, 1746, 1671, 1537, 1458, 1316, 1163, 1028, 674, 473, 448, 260, 226, 156, 125, 94, 81],
backgroundColor: ["rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)", "rgba(95,193,182,0.5)", "rgba(236,80,85,0.5)", "rgba(229,85,193,0.5)", "rgba(121,217,75,0.5)", "rgba(188,134,111,0.5)", "rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)", "rgba(95,193,182,0.5)", "rgba(236,80,85,0.5)", "rgba(229,85,193,0.5)", "rgba(121,217,75,0.5)", "rgba(188,134,111,0.5)", "rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)", "rgba(95,193,182,0.5)", "rgba(236,80,85,0.5)", "rgba(229,85,193,0.5)", "rgba(121,217,75,0.5)", "rgba(188,134,111,0.5)", "rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)", "rgba(95,193,182,0.5)", "rgba(236,80,85,0.5)", "rgba(229,85,193,0.5)", "rgba(121,217,75,0.5)", "rgba(188,134,111,0.5)", "rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)", "rgba(95,193,182,0.5)", "rgba(236,80,85,0.5)", "rgba(229,85,193,0.5)", "rgba(121,217,75,0.5)", "rgba(188,134,111,0.5)", "rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)", "rgba(95,193,182,0.5)", "rgba(236,80,85,0.5)", "rgba(229,85,193,0.5)", "rgba(121,217,75,0.5)", "rgba(188,134,111,0.5)", "rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)", "rgba(95,193,182,0.5)", "rgba(236,80,85,0.5)", "rgba(229,85,193,0.5)", "rgba(121,217,75,0.5)", "rgba(188,134,111,0.5)", "rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)", "rgba(95,193,182,0.5)", "rgba(236,80,85,0.5)", "rgba(229,85,193,0.5)", "rgba(121,217,75,0.5)", "rgba(188,134,111,0.5)", "rgba(91,96,229,0.5)", "rgba(232,213,67,0.5)"],
borderColor: ["rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)", "rgba(95,193,182,1.0)", "rgba(236,80,85,1.0)", "rgba(229,85,193,1.0)", "rgba(121,217,75,1.0)", "rgba(188,134,111,1.0)", "rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)", "rgba(95,193,182,1.0)", "rgba(236,80,85,1.0)", "rgba(229,85,193,1.0)", "rgba(121,217,75,1.0)", "rgba(188,134,111,1.0)", "rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)", "rgba(95,193,182,1.0)", "rgba(236,80,85,1.0)", "rgba(229,85,193,1.0)", "rgba(121,217,75,1.0)", "rgba(188,134,111,1.0)", "rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)", "rgba(95,193,182,1.0)", "rgba(236,80,85,1.0)", "rgba(229,85,193,1.0)", "rgba(121,217,75,1.0)", "rgba(188,134,111,1.0)", "rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)", "rgba(95,193,182,1.0)", "rgba(236,80,85,1.0)", "rgba(229,85,193,1.0)", "rgba(121,217,75,1.0)", "rgba(188,134,111,1.0)", "rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)", "rgba(95,193,182,1.0)", "rgba(236,80,85,1.0)", "rgba(229,85,193,1.0)", "rgba(121,217,75,1.0)", "rgba(188,134,111,1.0)", "rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)", "rgba(95,193,182,1.0)", "rgba(236,80,85,1.0)", "rgba(229,85,193,1.0)", "rgba(121,217,75,1.0)", "rgba(188,134,111,1.0)", "rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)", "rgba(95,193,182,1.0)", "rgba(236,80,85,1.0)", "rgba(229,85,193,1.0)", "rgba(121,217,75,1.0)", "rgba(188,134,111,1.0)", "rgba(91,96,229,1.0)", "rgba(232,213,67,1.0)"],
borderWidth: 1
}]
},
options: {
legend: {
display: false
},
borderSkipped: 'left',
label: null,
responsive: true,
maintainAspectRatio: false
}
};
let myData = {};
copy.data.labels.forEach((item, index) => {
const name = item.split(' ')[0];
const value = copy.data.datasets[0].data[index];
myData[name] = {
value: value
};
});
console.log(JSON.stringify(myData));