cr-ui-lib 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +33 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -953,7 +953,6 @@ var MultiLineGraph = ({
|
|
|
953
953
|
},
|
|
954
954
|
ticks: {
|
|
955
955
|
display: true
|
|
956
|
-
// 👈 Add this to hide the number labels
|
|
957
956
|
}
|
|
958
957
|
}
|
|
959
958
|
},
|
|
@@ -1057,7 +1056,6 @@ var MultiLineGraph = ({
|
|
|
1057
1056
|
},
|
|
1058
1057
|
interaction: {
|
|
1059
1058
|
intersect: false,
|
|
1060
|
-
// 👇 CHANGE THIS LINE
|
|
1061
1059
|
mode: "nearest"
|
|
1062
1060
|
},
|
|
1063
1061
|
elements: {
|
|
@@ -1077,7 +1075,7 @@ var MultiLineGraph = ({
|
|
|
1077
1075
|
const verticalHoverLine = React.useMemo(
|
|
1078
1076
|
() => ({
|
|
1079
1077
|
id: "verticalLine",
|
|
1080
|
-
|
|
1078
|
+
beforeDatasetsDraw: (chart) => {
|
|
1081
1079
|
var _a;
|
|
1082
1080
|
const tooltip = chart.tooltip;
|
|
1083
1081
|
if ((_a = tooltip == null ? void 0 : tooltip._active) == null ? void 0 : _a.length) {
|
|
@@ -1114,7 +1112,6 @@ var MultiLineGraph = ({
|
|
|
1114
1112
|
pointBackgroundColor: "#ffffff",
|
|
1115
1113
|
pointBorderColor: dataset.pointLabelColor || colors.point,
|
|
1116
1114
|
tension: 0.5,
|
|
1117
|
-
// 👇 ADD THESE TWO LINES to make the line thicker on hover
|
|
1118
1115
|
borderWidth: 2,
|
|
1119
1116
|
hoverBorderWidth: 3.5
|
|
1120
1117
|
};
|
|
@@ -1122,28 +1119,28 @@ var MultiLineGraph = ({
|
|
|
1122
1119
|
}),
|
|
1123
1120
|
[datasets, xAxisLabels]
|
|
1124
1121
|
);
|
|
1125
|
-
const
|
|
1122
|
+
const alternativeDashedGridPlugin = React.useMemo(
|
|
1126
1123
|
() => ({
|
|
1127
|
-
id: "
|
|
1124
|
+
id: "dashedGrid",
|
|
1128
1125
|
afterDatasetsDraw: (chart) => {
|
|
1129
|
-
const ctx = chart
|
|
1130
|
-
|
|
1131
|
-
const xAxis = chart.scales.x;
|
|
1132
|
-
if (!yAxis || !xAxis) return;
|
|
1126
|
+
const { ctx, scales: { x, y } } = chart;
|
|
1127
|
+
if (!ctx || !x || !y) return;
|
|
1133
1128
|
ctx.save();
|
|
1134
|
-
ctx.
|
|
1135
|
-
ctx.setLineDash([4, 4]);
|
|
1129
|
+
ctx.globalCompositeOperation = "destination-over";
|
|
1136
1130
|
ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
|
|
1137
1131
|
ctx.lineWidth = 1;
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1132
|
+
ctx.setLineDash([4, 4]);
|
|
1133
|
+
const yTicks = y.ticks || [];
|
|
1134
|
+
yTicks.forEach((tick, index) => {
|
|
1135
|
+
if (index === 0) return;
|
|
1136
|
+
const yPos = y.getPixelForValue(tick.value);
|
|
1137
|
+
if (typeof yPos === "number" && !isNaN(yPos)) {
|
|
1138
|
+
ctx.beginPath();
|
|
1139
|
+
ctx.moveTo(x.left, yPos);
|
|
1140
|
+
ctx.lineTo(x.right, yPos);
|
|
1141
|
+
ctx.stroke();
|
|
1141
1142
|
}
|
|
1142
|
-
const yPosition = yAxis.getPixelForValue(tick.value);
|
|
1143
|
-
ctx.moveTo(xAxis.left, yPosition);
|
|
1144
|
-
ctx.lineTo(xAxis.right, yPosition);
|
|
1145
1143
|
});
|
|
1146
|
-
ctx.stroke();
|
|
1147
1144
|
ctx.restore();
|
|
1148
1145
|
}
|
|
1149
1146
|
}),
|
|
@@ -1155,7 +1152,7 @@ var MultiLineGraph = ({
|
|
|
1155
1152
|
ref: chartRef,
|
|
1156
1153
|
options,
|
|
1157
1154
|
data: lineData,
|
|
1158
|
-
plugins: [verticalHoverLine,
|
|
1155
|
+
plugins: [verticalHoverLine, alternativeDashedGridPlugin]
|
|
1159
1156
|
},
|
|
1160
1157
|
chartKey
|
|
1161
1158
|
) });
|
|
@@ -1412,28 +1409,28 @@ var SingleLineGraph = ({
|
|
|
1412
1409
|
}),
|
|
1413
1410
|
[months, values]
|
|
1414
1411
|
);
|
|
1415
|
-
const
|
|
1412
|
+
const alternativeDashedGridPlugin = React.useMemo(
|
|
1416
1413
|
() => ({
|
|
1417
|
-
id: "
|
|
1414
|
+
id: "dashedGrid",
|
|
1418
1415
|
afterDatasetsDraw: (chart) => {
|
|
1419
|
-
const ctx = chart
|
|
1420
|
-
|
|
1421
|
-
const xAxis = chart.scales.x;
|
|
1422
|
-
if (!yAxis || !xAxis) return;
|
|
1416
|
+
const { ctx, scales: { x, y } } = chart;
|
|
1417
|
+
if (!ctx || !x || !y) return;
|
|
1423
1418
|
ctx.save();
|
|
1424
|
-
ctx.
|
|
1425
|
-
ctx.setLineDash([4, 4]);
|
|
1419
|
+
ctx.globalCompositeOperation = "destination-over";
|
|
1426
1420
|
ctx.strokeStyle = "rgba(0, 0, 0, 0.1)";
|
|
1427
1421
|
ctx.lineWidth = 1;
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1422
|
+
ctx.setLineDash([4, 4]);
|
|
1423
|
+
const yTicks = y.ticks || [];
|
|
1424
|
+
yTicks.forEach((tick, index) => {
|
|
1425
|
+
if (index === 0) return;
|
|
1426
|
+
const yPos = y.getPixelForValue(tick.value);
|
|
1427
|
+
if (typeof yPos === "number" && !isNaN(yPos)) {
|
|
1428
|
+
ctx.beginPath();
|
|
1429
|
+
ctx.moveTo(x.left, yPos);
|
|
1430
|
+
ctx.lineTo(x.right, yPos);
|
|
1431
|
+
ctx.stroke();
|
|
1431
1432
|
}
|
|
1432
|
-
const yPosition = yAxis.getPixelForValue(tick.value);
|
|
1433
|
-
ctx.moveTo(xAxis.left, yPosition);
|
|
1434
|
-
ctx.lineTo(xAxis.right, yPosition);
|
|
1435
1433
|
});
|
|
1436
|
-
ctx.stroke();
|
|
1437
1434
|
ctx.restore();
|
|
1438
1435
|
}
|
|
1439
1436
|
}),
|
|
@@ -1445,7 +1442,7 @@ var SingleLineGraph = ({
|
|
|
1445
1442
|
ref: chartRef,
|
|
1446
1443
|
options,
|
|
1447
1444
|
data: lineData,
|
|
1448
|
-
plugins: [verticalHoverLine,
|
|
1445
|
+
plugins: [verticalHoverLine, alternativeDashedGridPlugin]
|
|
1449
1446
|
},
|
|
1450
1447
|
chartKey
|
|
1451
1448
|
) });
|