Skip to content

Commit

Permalink
ChartModule.js: Use arrow notation for functions
Browse files Browse the repository at this point in the history
  • Loading branch information
rht authored and tpike3 committed May 16, 2022
1 parent e79f547 commit c82b347
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions mesa/visualization/templates/js/ChartModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ChartModule = function (series, canvas_width, canvas_height) {
// Create the context and the drawing controller:
const context = canvas.getContext("2d");

const convertColorOpacity = function (hex) {
const convertColorOpacity = (hex) => {
if (hex.indexOf("#") != 0) {
return "rgba(0,0,0,0.1)";
}
Expand Down Expand Up @@ -76,19 +76,19 @@ const ChartModule = function (series, canvas_width, canvas_height) {
options: chartOptions,
});

this.render = function (data) {
this.render = (data) => {
chart.data.labels.push(control.tick);
for (let i = 0; i < data.length; i++) {
chart.data.datasets[i].data.push(data[i]);
}
chart.update();
};

this.reset = function () {
this.reset = () => {
while (chart.data.labels.length) {
chart.data.labels.pop();
}
chart.data.datasets.forEach(function (dataset) {
chart.data.datasets.forEach((dataset) => {
while (dataset.data.length) {
dataset.data.pop();
}
Expand Down

0 comments on commit c82b347

Please sign in to comment.