From 63f1ff5e6f64b48c9ea424c70b28afa62d72f7b9 Mon Sep 17 00:00:00 2001 From: lovasoa Date: Sun, 10 Mar 2024 07:29:50 +0100 Subject: [PATCH] fix apexcharts bug See https://github.com/sqlpage/SQLPage/issues/733 --- .gitignore | 1 + CHANGELOG.md | 1 + sqlpage/apexcharts.js | 8 ++------ sqlpage/sqlpage.db | Bin 20480 -> 0 bytes 4 files changed, 4 insertions(+), 6 deletions(-) delete mode 100644 sqlpage/sqlpage.db diff --git a/.gitignore b/.gitignore index f7f0d648..a1a6898f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ x.sql xbed.sql **/sqlpage.bin node_modules/ +sqlpage/sqlpage.db diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a23f9db..4ed841b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -27,6 +27,7 @@ - Fix a bug where the table component would not sort columns that contained a space in their name. - Fix a bug where stacked bar charts would not stack the bars correctly in some cases. - Update ApexCharts to [v4.1.0](https://github.com/apexcharts/apexcharts.js/releases/tag/v4.1.0). +- 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. ## 0.31.0 (2024-11-24) diff --git a/sqlpage/apexcharts.js b/sqlpage/apexcharts.js index 058bce8a..fc00065b 100644 --- a/sqlpage/apexcharts.js +++ b/sqlpage/apexcharts.js @@ -120,11 +120,6 @@ sqlpage_chart = (() => { let series = Object.values(series_map); - // tickamount is the number of intervals, not the number of ticks - const tickAmount = - data.xticks || - Math.min(30, Math.max(...series.map((s) => s.data.length - 1))); - let labels; const categories = series.length > 0 && typeof series[0].data[0].x === "string"; @@ -182,7 +177,6 @@ sqlpage_chart = (() => { }, min: data.xmin, max: data.xmax, - tickAmount, title: { text: data.xtitle || undefined, }, @@ -245,6 +239,8 @@ sqlpage_chart = (() => { series, }; if (labels) options.labels = labels; + // tickamount is the number of intervals, not the number of ticks + if (data.xticks) options.xaxis.tickAmount = data.xticks; console.log("Rendering chart", options); const chart = new ApexCharts(chartContainer, options); chart.render(); diff --git a/sqlpage/sqlpage.db b/sqlpage/sqlpage.db deleted file mode 100644 index 3ca97edbdcf4f6ed2e932aa65039de04c9210bc4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 20480 zcmeI%O-tiI7{Kv~w!VR_;Gx&&)&{Du>`B;#t!@s!6to7kcnDcL?T*`~HOYcGiQi_w z#C{sTghwX<#h@MqDgOtO%rleZ$^4SbkkgYRlWG}G<4KsxSGA!WNBs~{O0C+hYPYAz z^U70VkIswsd(Bm~eRi;3yH}Okma2cN|F8YC4FUlK5I_I{1Q0*~0R#|0;ByOP)#b+K zrgPU%!(U^4Q$%I2=XHEf{Lb!?C$_6)#6+nc=~!m5nS^mBe{|NCtLN@m4|S}gOPxrT zWi8{j^Yy1TqbNVKb>+&dGu)lZQeOI^sBEvYQ7u)r9dB25>kq2`A+ER1a--RF?!Fff zm0XW!;YbHVGuBBdStvbdX{a>|)8FEI=e`{G_Pd>4Uk<%~TP~-TFiMkRs4e3#NrTCB zV1`ByR?B7gt_2q1s}0tg_000Iag@CXGSh|K^1