Skip to content

Commit

Permalink
update table
Browse files Browse the repository at this point in the history
  • Loading branch information
mjbench committed Jul 7, 2024
1 parent 7ebe146 commit c18a487
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions static/js/benmark_table.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ var chartFormatter = function (cell, formatterParams, onRendered) {
var content = document.createElement("span");
var values = cell.getValue();

// invert values if needed
// Invert values if needed
if (formatterParams.invert) {
values = values.map(val => val * -1);
}

// add values to chart and style
// Add values to chart and style
content.classList.add(formatterParams.type);
content.innerHTML = values.join(",");

// setup chart options
// Setup chart options
var options = {
width: 50,
// min: 0.0,
Expand All @@ -23,7 +23,7 @@ var chartFormatter = function (cell, formatterParams, onRendered) {
options.fill = formatterParams.fill;
}

// instantiate peity chart after the cell element has been added to the DOM
// Instantiate peity chart after the cell element has been added to the DOM
onRendered(function () {
peity(content, formatterParams.type, options);
});
Expand Down Expand Up @@ -61,8 +61,8 @@ var colorFormatter = function (cell, formatterParams) {
var green = Math.floor(startColor.g + (endColor.g - startColor.g) * normalizedValue);
var blue = Math.floor(startColor.b + (endColor.b - startColor.b) * normalizedValue);

// make sure the value is rounded to 1 decimal place
value = parseFloat(value).toFixed(1)
// Make sure the value is rounded to 1 decimal place
value = parseFloat(value).toFixed(1);

return "<span style='display: block; width: 100%; height: 100%; background-color: rgb(" + red + ", " + green + ", " + blue + ");'>" + value + "</span>";
}
Expand Down Expand Up @@ -99,7 +99,6 @@ var barColorFn = function (value, formatterParams) {
document.addEventListener('DOMContentLoaded', function () {
Promise.all([
fetch('website/data/benchmark.json').then(response => response.json())
// Add other fetch calls if necessary
])
.then(([benchmark_data]) => {

Expand Down Expand Up @@ -143,4 +142,4 @@ document.addEventListener('DOMContentLoaded', function () {
],
});
});
});
});

0 comments on commit c18a487

Please sign in to comment.