Skip to content

Commit 63f1ff5

Browse files
committed
fix apexcharts bug
See #733
1 parent 062d5e9 commit 63f1ff5

File tree

4 files changed

+4
-6
lines changed

4 files changed

+4
-6
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ x.sql
99
xbed.sql
1010
**/sqlpage.bin
1111
node_modules/
12+
sqlpage/sqlpage.db

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
- Fix a bug where the table component would not sort columns that contained a space in their name.
2828
- Fix a bug where stacked bar charts would not stack the bars correctly in some cases.
2929
- Update ApexCharts to [v4.1.0](https://github.com/apexcharts/apexcharts.js/releases/tag/v4.1.0).
30+
- Temporarily disable automatic tick amount calculation in the chart component. This was causing issues with mislabeled x-axis data, because of a bug in ApexCharts.
3031

3132
## 0.31.0 (2024-11-24)
3233

sqlpage/apexcharts.js

+2-6
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,6 @@ sqlpage_chart = (() => {
120120

121121
let series = Object.values(series_map);
122122

123-
// tickamount is the number of intervals, not the number of ticks
124-
const tickAmount =
125-
data.xticks ||
126-
Math.min(30, Math.max(...series.map((s) => s.data.length - 1)));
127-
128123
let labels;
129124
const categories =
130125
series.length > 0 && typeof series[0].data[0].x === "string";
@@ -182,7 +177,6 @@ sqlpage_chart = (() => {
182177
},
183178
min: data.xmin,
184179
max: data.xmax,
185-
tickAmount,
186180
title: {
187181
text: data.xtitle || undefined,
188182
},
@@ -245,6 +239,8 @@ sqlpage_chart = (() => {
245239
series,
246240
};
247241
if (labels) options.labels = labels;
242+
// tickamount is the number of intervals, not the number of ticks
243+
if (data.xticks) options.xaxis.tickAmount = data.xticks;
248244
console.log("Rendering chart", options);
249245
const chart = new ApexCharts(chartContainer, options);
250246
chart.render();

sqlpage/sqlpage.db

-20 KB
Binary file not shown.

0 commit comments

Comments
 (0)