I have not found any help in the webdatarocks documentation if we can add progress bars inside the td. Is there any way we can do that to a table like so:
var pivot = new WebDataRocks({
container: "#wdr-component",
toolbar: true,
width: "100%",
height: 600,
report: {
"dataSource": {
"dataSourceType": "csv",
"filename": "https://cdn.webdatarocks.com/data/data.csv"
},
options: {
grid: {
type: 'classic',
}
},
"slice": {
"reportFilters": [{
"uniqueName": "Color"
}, {
"uniqueName": "Destination"
}],
"rows": [{
"uniqueName": "Category",
"filter": {
"members": ["Category.Clothing", "Category.Cars"],
"negation": true
}
}, {
"uniqueName": "Business Type"
}],
"columns": [{
"uniqueName": "Measures"
}, {
"uniqueName": "Country",
"filter": {
"members": ["Country.United Kingdom", "Country.Germany"],
"negation": true
}
}],
"measures": [{
"uniqueName": "Price",
"aggregation": "sum",
"format": "currency"
}, {
"uniqueName": "Discount",
"aggregation": "sum",
"active": false,
"format": "currency"
}],
"formats": [{
"name": "",
"maxDecimalPlaces": 2
}, {
"name": "currency",
"thousandsSeparator": " ",
"decimalSeparator": ".",
"currencySymbol": "$",
"currencySymbolAlign": "left",
"nullValue": "",
"textAlign": "right",
"isPercent": false
}],
"expands": {
"rows": [{
"tuple": ["Category.Accessories"]
}, {
"tuple": ["Category.Bikes"]
}]
}
}
}
}
);
function setCustomizeFunction() {
pivot.customizeCell(customizeCellFunction);
}
/* Insert icons to the cells */
function customizeCellFunction(cell, data) {
if (data.type == "value" && !data.isDrillThrough && data.isGrandTotalColumn) {
if (data.value < 50000) {
cell.text = "<img src='https://www.webdatarocks.com/wd_uploads/2019/02/icons8-decline-64-1.png' class='centered'>";
} else if (data.value >= 50000) {
cell.text = "<img src='https://www.webdatarocks.com/wd_uploads/2019/02/icons8-account-64.png' class='centered'>";
}
}
}
<link href="https://cdn.webdatarocks.com/latest/webdatarocks.min.css" rel="stylesheet"/>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://cdn.webdatarocks.com/latest/webdatarocks.toolbar.min.js"></script>
<script src="https://cdn.webdatarocks.com/latest/webdatarocks.js"></script>
<div id="wdr-component"></div>
For example, I want to be able to add:
inside the cell for Australia and also add progress bars in each of the cells. Is there a way for me to do that using WebDataRocks.