on 2022 Nov 15 6:58 AM
Hello team,
creating a Example Like " https://stackoverflow.com/questions/69455760/chart-js-data-values-from-textbox-input-only-load-once "
the problem is in controller.js "Uncaught ReferenceError: Chart is not defined"
Here is my controller code
crtGraph: function(oEvent) {
var R = this.getView().byId("IdRed").getValue("");
var B = this.getView().byId("IdBlue").getValue("");
var G = this.getView().byId("IdGreen").getValue("");
if (Chart.getChart("myChart") === undefined) {
var ctx = this.getView().byId("myChart").getContext("2d");
myChart = new Chart(ctx, {
type: "bar",
data: {
labels: ["Red", "Blue", "Green"],
datasets: [{
label: "# of Votes",
data: [R, B, G],
backgroundColor: [
"rgba(255, 99, 132, 0.2)",
"rgba(54, 162, 235, 0.2)",
"rgba(255, 206, 86, 0.2)"
],
borderColor: [
"rgba(255, 99, 132, 1)",
"rgba(54, 162, 235, 1)",
"rgba(255, 206, 86, 1)"
],
borderWidth: 1
}]
},
options: {
scales: {
y: {
beginAtZero: true
}
}
}
});
} else {
myChart.data.datasets[0].data = [R, B, G];
myChart.update();
}
}
User | Count |
---|---|
80 | |
11 | |
10 | |
10 | |
10 | |
8 | |
8 | |
7 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.