bezel-charts 1.6.0 → 1.8.0
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/README.md +42 -8
- package/dist/bezel-charts.iife.js +21 -18
- package/dist/bezel-charts.js +448 -31
- package/dist/bezel-charts.min.js +21 -18
- package/dist/charts/area.js +4 -4
- package/dist/charts/bars.js +2 -2
- package/dist/charts/boxplot.js +2 -2
- package/dist/charts/combo.js +5 -0
- package/dist/charts/donut.js +2 -2
- package/dist/charts/gauge.js +2 -2
- package/dist/charts/heatmap.js +2 -2
- package/dist/charts/histogram.js +2 -2
- package/dist/charts/line.js +3 -3
- package/dist/charts/progress.js +2 -2
- package/dist/charts/ring.js +2 -2
- package/dist/charts/scatter.js +2 -2
- package/dist/charts/shared-62V33ZP5.js +2 -0
- package/dist/charts/shared-7G7LN4HE.js +2 -0
- package/dist/charts/{shared-56ZZ4O3F.js → shared-TBF2ZMMV.js} +2 -2
- package/dist/charts/shared-ZKK7S7JV.js +2 -0
- package/dist/charts/spark.js +2 -2
- package/package.json +6 -3
- package/src/charts/area.js +15 -7
- package/src/charts/combo.js +160 -0
- package/src/charts/line.js +26 -11
- package/src/core/lines.js +30 -0
- package/src/core/time.js +101 -0
- package/src/core/xy.js +73 -38
- package/src/element.js +1 -1
- package/src/entries/combo.js +10 -0
- package/src/index.js +2 -1
- package/src/render.js +1 -1
- package/dist/charts/shared-CYFOZG36.js +0 -2
- package/dist/charts/shared-YIDF72XF.js +0 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
[](https://github.com/ShazMoghaddam/bezel-charts/actions/workflows/python.yml)
|
|
10
10
|
[](LICENSE)
|
|
11
11
|
|
|
12
|
-
Bezel Charts is a set of free, open-source web components:
|
|
12
|
+
Bezel Charts is a set of free, open-source web components: fourteen chart tiles drawn in pure SVG, so they stay sharp on a phone, a 4K screen or a printed report. Build one in the Studio, paste one line of HTML into any site, or save any chart as a static SVG for a README, Notion page or slide, where JavaScript can't run.
|
|
13
13
|
|
|
14
14
|

|
|
15
15
|
|
|
@@ -20,7 +20,7 @@ Bezel Charts is a set of free, open-source web components: thirteen chart tiles
|
|
|
20
20
|
- **Made for READMEs.** Every chart exports as a clean static SVG, so a GitHub README can show a real chart.
|
|
21
21
|
- **Data science friendly.** Scatter plots with a least-squares trend line and Pearson's r, grouped series, goal lines and notes on key points.
|
|
22
22
|
- **Speaks your language.** Numbers and dates follow any locale, including Persian.
|
|
23
|
-
- **Light.** About
|
|
23
|
+
- **Light.** About 24 kB gzipped for all fourteen charts, or 7 to 12 kB for a page that loads just one. No dependencies and no build step.
|
|
24
24
|
- **Accessible.** Tab to any chart and step through its values with the arrow keys. Screen readers hear each value and get a hidden table of the data. Dashes, shapes and patterns tell series apart without relying on colour, and animation respects reduced-motion settings.
|
|
25
25
|
- **Python too.** `pip install bezel-charts` draws the same charts straight from a pandas DataFrame, for notebooks, reports and READMEs.
|
|
26
26
|
|
|
@@ -49,7 +49,7 @@ A sibling of [Bezel](https://github.com/ShazMoghaddam/bezel), the clock, calenda
|
|
|
49
49
|
<bezel-bars heading="Commits this week" values="4,9,6,3,8,5,3" labels="M,T,W,T,F,S,S" stat="total"></bezel-bars>
|
|
50
50
|
```
|
|
51
51
|
|
|
52
|
-
`@1` always loads the latest 1.x release, so you get fixes without changing anything. To pin an exact version, use `@v1.
|
|
52
|
+
`@1` always loads the latest 1.x release, so you get fixes without changing anything. To pin an exact version, use `@v1.8.0` instead.
|
|
53
53
|
|
|
54
54
|
That's all. Charts fill the width of whatever they sit in and redraw when it changes, so they work in a sidebar, a card grid or a full-width section without extra CSS.
|
|
55
55
|
|
|
@@ -84,9 +84,10 @@ import { toSVG } from 'bezel-charts/line'; // render and toSVG work for every ch
|
|
|
84
84
|
| Page | Gzipped |
|
|
85
85
|
| --- | --- |
|
|
86
86
|
| One sparkline, ring, donut, gauge, progress bar or heatmap | 7.2 to 7.4 kB |
|
|
87
|
-
| One
|
|
88
|
-
|
|
|
89
|
-
|
|
|
87
|
+
| One histogram, box plot, scatter, bar or bars-and-line chart | 9.4 to 10.5 kB |
|
|
88
|
+
| One line or area chart | 12.0 to 12.3 kB |
|
|
89
|
+
| A line and a bar chart | 14.8 kB |
|
|
90
|
+
| Every chart: the full bundle | 23.8 kB |
|
|
90
91
|
|
|
91
92
|
Once a page needs four or five different charts, load the full bundle instead. `<bezel-chart type="…">` works with whichever charts are loaded, and tells you which file to add if its type isn't one of them. The classic `iife.js` script always has every chart, because a classic script can't load the shared file.
|
|
92
93
|
|
|
@@ -163,6 +164,13 @@ One or more lines over time, with an axis, a legend and notes on key moments. Se
|
|
|
163
164
|
| `straight` | boolean, straight lines instead of curves | off |
|
|
164
165
|
| `dash` | a line style per series: `solid`, `dashed`, `dotted`, `dashdot`. On its own, gives each series the next style | off |
|
|
165
166
|
| `markers` | a shape on each point, per series: `circle`, `square`, `triangle`, `diamond`, `none`. On its own, gives each series the next shape | off |
|
|
167
|
+
| `dates` | one date per point, `2026-01-05` or `2026-01-05T14:30`: points sit where they fall in time | evenly spaced |
|
|
168
|
+
| `min`, `max` | fix the value axis; anything beyond is clipped at the edge, and the tooltip keeps the true value | from the data |
|
|
169
|
+
| `log` | boolean, a log scale: each power of ten gets the same height | off |
|
|
170
|
+
|
|
171
|
+
**Dates.** With `dates`, a reading on 1 January, one on 2 January and one on 1 March sit where they fall, instead of evenly spaced. The axis picks its own step for the span and the width: hours (`14:00`), days or weeks (`5 Jan`), months (`Jan 2026`, then `Feb`, `Mar`), or years. Tooltips and the data table show the full date, and `labels`, if you give them, still name the points. Dates are read as written, with no time zone conversion.
|
|
172
|
+
|
|
173
|
+
**Log scale.** `log` suits values that grow fast, like users or prices over years: 100, 1,000, 10k and 100k sit evenly apart. Zero and negative values have no place on a log scale, so the line leaves a gap there, and the tooltip and data table still show them.
|
|
166
174
|
|
|
167
175
|
### `<bezel-area>`
|
|
168
176
|
|
|
@@ -183,6 +191,8 @@ Filled areas over time. Several series overlap as see-through fills, or add `sta
|
|
|
183
191
|
| `straight` | boolean, straight edges instead of curves | off |
|
|
184
192
|
| `dash`, `markers` | styles for each series' top edge, as on line charts | off |
|
|
185
193
|
| `patterns` | a fill per series, as on bars | off |
|
|
194
|
+
| `dates` | one date per point, as on line charts | evenly spaced |
|
|
195
|
+
| `max`, `min` | fix the value axis, as on line charts; `min` only at or below zero, so areas keep their base | from the data |
|
|
186
196
|
|
|
187
197
|
The tooltip lists every series, plus the total when stacked, and each series' share in a percent stack. `show-values` writes each value, or the total above each column of a stack. Negative values stack below zero, as stacked bars do, but stacks read best when every value is positive: bands that swing between positive and negative cross over each other.
|
|
188
198
|
|
|
@@ -219,6 +229,30 @@ Stacked bars put positive parts above zero and negative parts below it. The tool
|
|
|
219
229
|
|
|
220
230
|
Without `angle-labels`, labels that don't fit take turns, so only every few are shown. With it, they lean at 40 degrees and every one shows, shortened after 24 characters. The tooltip always has the full label.
|
|
221
231
|
|
|
232
|
+
### `<bezel-combo>`
|
|
233
|
+
|
|
234
|
+
Bars and lines with different units on one chart, such as sales in pounds as bars and conversion in percent as a line. Bars read against the left axis and lines against the right.
|
|
235
|
+
|
|
236
|
+
```html
|
|
237
|
+
<bezel-combo heading="Sales and conversion" values="182,214,236,268" line="3.1,3.4,3.6,4.2"
|
|
238
|
+
series="Sales" line-series="Conversion" labels="Q1,Q2,Q3,Q4" prefix="£" suffix="k" line-suffix="%"></bezel-combo>
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
| Attribute | Values | Default |
|
|
242
|
+
| --------------- | ------------------------------------------------------------- | ------- |
|
|
243
|
+
| `values` | bar numbers, series separated by `\|` | |
|
|
244
|
+
| `line` | line numbers, lines separated by `\|` | |
|
|
245
|
+
| `series`, `line-series` | names for the bars and the lines | |
|
|
246
|
+
| `labels` | one per column, along the bottom | |
|
|
247
|
+
| `stacked` | with several bar series, pile them up | side by side |
|
|
248
|
+
| `line-prefix`, `line-suffix`, `line-decimals` | number formatting for the right axis and the line values | |
|
|
249
|
+
| `y-label`, `line-label` | titles above the left and right axes | |
|
|
250
|
+
| `line-zero` | boolean, start the right axis at zero | off |
|
|
251
|
+
| `dash`, `markers`, `patterns` | styles for the lines and the bars | off |
|
|
252
|
+
| `height` | chart height in px | `200` |
|
|
253
|
+
|
|
254
|
+
Two scales on one chart are easy to misread, so the right axis always has the same number of steps as the left: every gridline reads on both sides. A rule down each side takes its data's colour, so it's clear which axis belongs to what. The bar axis always includes zero; the line axis fits its data unless you add `line-zero`. The tooltip gives every value in its own units, with the total when stacked.
|
|
255
|
+
|
|
222
256
|
### `<bezel-histogram>`
|
|
223
257
|
|
|
224
258
|
How raw values spread out. Give it the values themselves, such as 500 customers' ages, and it counts how many fall into each range. The ranges get round edges (20, 30, 40, not 19.7, 31.4) and a sensible number for the amount of data.
|
|
@@ -488,7 +522,7 @@ bc.line(df, x="month", y=["sales", "costs"], heading="Sales", prefix="£")
|
|
|
488
522
|
bc.spark(df["signups"], heading="Signups").save("docs/signups.svg")
|
|
489
523
|
```
|
|
490
524
|
|
|
491
|
-
All
|
|
525
|
+
All fourteen charts are available, and the Python output matches the JavaScript byte for byte, checked in CI. `chart.alt` gives ready-made alt text for the saved image. See the [Python README](python/README.md).
|
|
492
526
|
|
|
493
527
|
## Frameworks
|
|
494
528
|
|
|
@@ -533,7 +567,7 @@ docs/ the README image and social preview, with the pages that render t
|
|
|
533
567
|
test/ node:test suites, plus a Playwright browser test
|
|
534
568
|
```
|
|
535
569
|
|
|
536
|
-
Each chart is a pure function that takes its options and a theme and returns an SVG string, which keeps them easy to test and lets the same code run in Node. The full bundle has a
|
|
570
|
+
Each chart is a pure function that takes its options and a theme and returns an SVG string, which keeps them easy to test and lets the same code run in Node. The full bundle has a 26 kB gzip budget and each chart file its own, checked in CI by `npm run size`. See [CONTRIBUTING.md](CONTRIBUTING.md).
|
|
537
571
|
|
|
538
572
|
## Security
|
|
539
573
|
|