Skip to content

Commit 5c38eb1

Browse files
committed
chart component: fix zero values in stacked bar charts
fixes #924
1 parent 61677ab commit 5c38eb1

File tree

5 files changed

+15
-7
lines changed

5 files changed

+15
-7
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# CHANGELOG.md
22

3+
## v0.35.2
4+
- Fix a bug with zero values being displayed with a non-zero height in stacked bar charts.
5+
36
## v0.35.1
47
- improve color palette for charts
58
- Fix some color names not working in the datagrid component

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sqlpage"
3-
version = "0.35.1"
3+
version = "0.35.2"
44
edition = "2021"
55
description = "Build data user interfaces entirely in SQL. A web server that takes .sql files and formats the query result using pre-made configurable professional-looking components."
66
keywords = ["web", "sql", "framework"]

examples/official-site/sqlpage/migrations/01_documentation.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ INSERT INTO example(component, description, properties) VALUES
678678
"component": "chart",
679679
"title": "Quarterly Revenue",
680680
"type": "area",
681-
"color": "indigo",
681+
"color": "blue-lt",
682682
"marker": 5,
683683
"time": true
684684
},

sqlpage/apexcharts.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ sqlpage_chart = (() => {
1212
}
1313

1414
const tblrColors = [
15-
["blue", "#0066FF", "#3399FF"],
16-
["red", "#FF0000", "#FF6666"],
15+
["blue", "#1c31dc", "#3399FF"],
16+
["red", "#d11414", "#FF6666"],
1717
["green", "#00CC00", "#66FF66"],
1818
["pink", "#FF1493", "#FF69B4"],
1919
["purple", "#ae3ec9", "#c264d9"],
@@ -119,9 +119,10 @@ sqlpage_chart = (() => {
119119
} else if (categories && data.type === "bar")
120120
series = align_categories(series);
121121

122+
const chart_type = data.type || "line";
122123
const options = {
123124
chart: {
124-
type: data.type || "line",
125+
type: chart_type,
125126
fontFamily: "inherit",
126127
parentHeightOffset: 0,
127128
height: chartContainer.style.height,
@@ -157,7 +158,11 @@ sqlpage_chart = (() => {
157158
type: data.type === "area" ? "gradient" : "solid",
158159
},
159160
stroke: {
160-
width: data.type === "area" ? 3 : 1,
161+
width:
162+
{
163+
area: 3,
164+
line: 2,
165+
}[chart_type] || 0,
161166
lineCap: "round",
162167
curve: "smooth",
163168
},

0 commit comments

Comments
 (0)