displaying batch lots as tooltips in scatter chart

This commit is contained in:
frankknoll
2023-11-09 09:22:55 +01:00
parent cfa314b4ae
commit 46e3f4c22d
4 changed files with 35 additions and 16 deletions

View File

@@ -16,14 +16,16 @@ class SymptomVsSymptomChartDataProvider {
dict1: prrByLotX,
dict2: prrByLotY
});
return Object
.keys(prrByLotXCommon)
.map(
lot =>
({
x: prrByLotXCommon[lot],
y: prrByLotYCommon[lot]
}));
const lots = Object.keys(prrByLotXCommon);
return {
labels: lots,
data:
lots.map(
lot => ({
x: prrByLotXCommon[lot],
y: prrByLotYCommon[lot]
}))
};
}
static #getCommonKeys(dict1, dict2) {

View File

@@ -7,6 +7,7 @@ class SymptomVsSymptomChartView {
this.#canvas = canvas;
}
// FK-TODO: refactor
displayChart(symptomX, symptomY) {
if (this.#chart != null) {
this.#chart.destroy();
@@ -21,8 +22,8 @@ class SymptomVsSymptomChartView {
const chartData = SymptomVsSymptomChartDataProvider.getChartData({ prrByLotX, prrByLotY });
const data = {
datasets: [{
label: 'Scatter Dataset',
data: chartData,
labels: chartData.labels,
data: chartData.data,
backgroundColor: 'rgb(0, 0, 255)'
}],
};
@@ -35,6 +36,18 @@ class SymptomVsSymptomChartView {
type: 'linear',
position: 'bottom'
}
},
plugins: {
legend: {
display: false
},
tooltip: {
callbacks: {
label: function (context) {
return 'Batch: ' + context.dataset.labels[context.dataIndex];
}
}
}
}
}
};