JavaScript
var allLabels = ['1st', '2nd', '3rd', '4th', '5th'];
var allValues = [
[38, 27, 18, 10, 7],
[28, 26, 21, 15, 10],
[38, 19, 16, 14, 13],
[31, 24, 19, 18, 8]
];
var ultimateColors = [
['rgb(56, 75, 126)', 'rgb(18, 36, 37)', 'rgb(34, 53, 101)', 'rgb(36, 55, 57)', 'rgb(6, 4, 4)'],
['rgb(177, 127, 38)', 'rgb(205, 152, 36)', 'rgb(99, 79, 37)', 'rgb(129, 180, 179)', 'rgb(124, 103, 37)'],
['rgb(33, 75, 99)', 'rgb(79, 129, 102)', 'rgb(151, 179, 100)', 'rgb(175, 49, 35)', 'rgb(36, 73, 147)'],
['rgb(146, 123, 21)', 'rgb(177, 180, 34)', 'rgb(206, 206, 40)', 'rgb(175, 51, 21)', 'rgb(35, 36, 21)']
];
var data = [{
values: allValues[0],
labels: allLabels,
type: 'pie',
name: 'Starry Night',
marker: {
colors: ultimateColors[0]
},
domain: {
//x: [0, .48],NOT FIX: DYNAMICALLY
//y: [0, .49]
},
hoverinfo: 'label+percent+name',
textinfo: 'none'
},{
values: allValues[1],
labels: allLabels,
type: 'pie',
name: 'Sunflowers',
marker: {
colors: ultimateColors[1]
},
domain: {
//x: [0.52, 1],NOT FIX: DYNAMICALLY
//y: [0, .49]
},
hoverinfo: 'label+percent+name',
textinfo: 'none'
},{
values: allValues[2],
labels: allLabels,
type: 'pie',
name: 'Irises',
marker: {
colors: ultimateColors[2]
},
domain: {
//x: [0, .48],NOT FIX: DYNAMICALLY
//y: [.51, 1]
},
hoverinfo: 'label+percent+name',
textinfo: 'none'
},{
values: allValues[3],
labels: allLabels,
type: 'pie',
name: 'The Night Cafe',
marker: {
colors: ultimateColors[3]
},
domain: {
//x: [0.52, 1],NOT FIX: dynamically
//y: [0.52, 1]
},
hoverinfo: 'label+percent+name',
textinfo: 'none'
}];
//iterate dynamically over piecharts and put the name as subtitle of the plot
var annotations=[];
var xPerTrace = 1/data.length;
var startX = 0;
for(var i = 0; i<data.length; i++){
//set domain of
data[i].domain={
x:[startX, startX+xPerTrace],
y:[0.1,1]
}
//create annotation for it
...