omiran/predictive_maintenance
0
1// function updateCharts(gasData, vibrationData) {2// var ctxGas = document.getElementById('gasChart').getContext('2d');3// var ctxVibration = document.getElementById('vibrationChart').getContext('2d');4 5// var labels = ['CO(GT)', 'PT08.S1(CO)', 'NMHC(GT)', 'C6H6(GT)', 'PT08.S2(NMHC)', 'NOx(GT)', 'PT08.S3(NOx)', 'NO2(GT)', 'PT08.S4(NO2)', 'PT08.S5(O3)', 'T', 'RH', 'AH']; 6 7// // Assuming gasData and vibrationData are arrays of values8// var dataGas = gasData; 9// var dataVibration = vibrationData; 10 11// var gasChart = new Chart(ctxGas, {12// type: 'bar',13// data: {14// labels: labels,15// datasets: [{16// label: 'Gas Concentrations',17// data: dataGas,18// backgroundColor: 'rgba(75, 192, 192, 0.2)',19// borderColor: 'rgba(75, 192, 192, 1)',20// borderWidth: 121// }]22// },23// options: {24// scales: {25// y: {26// beginAtZero: true27 28// }29// }30// }31// });32 33// var vibrationChart = new Chart(ctxVibration, {34// type: 'line',35// data: {36// labels: labels,37// datasets: [{38// label: 'Vibration Data',39// data: dataVibration,40// fill: false,41// borderColor: 'rgba(75, 192, 192, 1)',42// borderWidth: 143// }]44// },45// options: {46// scales: {47// y: {48// beginAtZero: true49// }50// }51// }52// });53// }54 55function updateCharts(gasData, vibrationData, regressionPredictions) {56 var ctxGas = document.getElementById('gasChart').getContext('2d');57 var ctxVibration = document.getElementById('vibrationChart').getContext('2d');58 59 var labelsGas = ['CO(GT)', 'PT08.S1(CO)', 'C6H6(GT)', 'PT08.S2(NMHC)', 'NOx(GT)', 'PT08.S3(NOx)', 'NO2(GT)', 'PT08.S4(NO2)', 'PT08.S5(O3)', 'T', 'RH', 'AH'];60 var labelsVibration = ['V_in', 'Measured_RPM', 'Vibration_1', 'Vibration_2', 'Vibration_3'];61 62 // Assuming gasData and vibrationData are arrays of values63 var dataGas = gasData;64 var dataVibration = vibrationData;65 66 var regressionValues = regressionPredictions.map(function (value) {67 return value[0];68 });69 70 var gasChart = new Chart(ctxGas, {71 type: 'bar',72 data: {73 labels: labelsGas,74 datasets: [{75 label: 'Gas Concentrations',76 data: dataGas,77 backgroundColor: 'rgba(75, 192, 192, 0.2)',78 borderColor: 'rgba(75, 192, 192, 1)',79 borderWidth: 180 }]81 },82 options: {83 scales: {84 y: {85 beginAtZero: true86 }87 }88 }89 });90 91 var vibrationChart = new Chart(ctxVibration, {92 type: 'scatter',93 data: {94 datasets: [{95 label: 'Regression Predictions',96 data: regressionValues,97 pointBackgroundColor: 'blue',98 pointRadius: 599 }]100 },101 options: {102 scales: {103 x: {104 type: 'linear',105 position: 'bottom'106 },107 y: {108 min: -15,109 max: 1110 }111 }112 }113 });114}115 116 117function createScatterPlot(data) {118 var ctx = document.getElementById('scatterPlot').getContext('2d');119 120 var scatterChart = new Chart(ctx, {121 type: 'scatter',122 data: {123 datasets: [{124 label: 'Anomalies',125 data: data.map((value, index) => ({x: index, y: value})), // Map data to x, y format126 pointBackgroundColor: 'red',127 pointRadius: 5128 }]129 },130 options: {131 scales: {132 x: {133 type: 'linear',134 position: 'bottom'135 },136 y: {137 min: -15,138 max: 1139 }140 }141 }142 });143}144 145 146// function ScatterPlot(data, labels) {147// var ctx = document.getElementById('scatterPlot').getContext('2d');148 149// var scatterChart = new Chart(ctx, {150// type: 'scatter',151// data: {152// datasets: [{153// label: 'Anomalies',154// data: data.map((value, index) => ({x: index, y: value})), // Map data to x, y format155// pointBackgroundColor: 'red',156// pointRadius: 5157// }]158// },159// options: {160// scales: {161// x: {162// type: 'linear',163// position: 'bottom'164// },165// y: {166// min: -15,167// max: 1168// }169// },170// plugins: {171// tooltip: {172// callbacks: {173// label: function(context) {174// var label = labels[context.dataIndex]; // Get the label for the current data point175// return label;176// }177// }178// }179// }180// }181// });182// }183 