Flexmonster - Percentage on count
HTML
<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="https://s3.amazonaws.com/flexmonster/2.3/flexmonster.js"></script>
<div id="pivot-container"></div>
JavaScript
var pivot = $("#pivot-container").flexmonster({
componentFolder: "https://s3.amazonaws.com/flexmonster/2.3/",
width: "100%",
height: 430,
toolbar: true,
report: {
dataSource: {
dataSourceType: "json",
data: getData()
},
slice: {
"rows": [{
"uniqueName": "question",
"sort": "asc"
}, {
"uniqueName": "answer",
"sort": "asc"
}],
"columns": [{
"uniqueName": "[Measures]"
}],
"measures": [{
"uniqueName": "answer_counter",
"aggregation": "percent",
"active": true
}],
"expands": {
"expandAll": true
},
},
options: {
datePattern: "yyyy-MM-dd HH:00",
configuratorActive: false
}
}
});
function getData() {
return [{
"name": "Hester",
"question": "Question 1",
"answer": "yes",
"answer_counter": 1
}, {
"name": "Bruce",
"question": "Question 1",
"answer": "yes",
"answer_counter": 1
}, {
"name": "Fleming",
"question": "Question 1",
"answer": "yes",
"answer_counter": 1
}, {
"name": "Nichole",
"question": "Question 1",
"answer": "yes",
"answer_counter": 1
}, {
"name": "Carmen",
"question": "Question 1",
"answer": "no",
"answer_counter": 1
}, {
"name": "Hendricks",
"question": "Question 1",
"answer": "yes",
"answer_counter": 1
}, {
"name": "Holden",
"question": "Question 1",
"answer": "yes",
"answer_counter": 1
}, {
"name": "Marlene",
"question": "Question 1",
"answer": "yes",
"answer_counter": 1
}, {
"name": "Deloris",
"question": "Question 1",
"answer": "no",
"answer_counter": 1
}, {
"name": "Susie",
"question": "Question 1",
"answer": "no",
"answer_counter": 1
}];
}