Skip to content

Commit

Permalink
updated base.chart.js and line.chart.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Gengar-i committed Nov 14, 2023
1 parent 82f9505 commit 67b922d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
11 changes: 8 additions & 3 deletions src/bundle/Resources/public/js/scripts/core/base.chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@
},
},
};
const defaultPlugins = {};

class BaseChart {
constructor(data, options = {}) {
constructor(data, options = {}, plugins = []) {
this.setData(data);
this.setOptions(options);
this.setPlugins(plugins);
this.lang = document.documentElement.lang.replace('_', '-'); // TODO: Get this config from settings
}

Expand All @@ -48,6 +50,10 @@
};
}

setPlugins(plugins) {
this.plugins = [...defaultPlugins, ...plugins];
}

getType() {}

getLayoutOptions() {}
Expand Down Expand Up @@ -76,15 +82,14 @@
}

render() {
// console.log(window);
// console.log(this.labels, this.datasets);
this.chart = new Chart(this.canvas, {
type: this.getType(),
data: {
labels: this.labels,
datasets: this.datasets,
},
options: this.options,
plugins: this.plugins,
});

this.updateChartMessageDisplay();
Expand Down
3 changes: 0 additions & 3 deletions src/bundle/Resources/public/js/scripts/core/line.chart.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
point: {
radius: 2,
},
line: {
tension: 0,
},
},
scales: {
x: {
Expand Down

0 comments on commit 67b922d

Please sign in to comment.