@tabler/charts-bootstrap 0.3.0 → 0.4.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
CHANGED
|
@@ -36,7 +36,7 @@ What the mapping gives you:
|
|
|
36
36
|
- **First series:** it takes `primary`. Series 2–8 keep the chart palette, which is checked for colorblind separation next to a blue primary; Bootstrap's own orange, yellow and pink are not.
|
|
37
37
|
- **Dark mode:** `data-bs-theme="dark"` switches the charts along with the rest of the page, on `<html>` or on any element.
|
|
38
38
|
|
|
39
|
-
The chart stylesheet itself already reads Tabler's `--tblr-*` variables (
|
|
39
|
+
The chart stylesheet itself already reads Tabler's `--tblr-*` variables (the chart palette `--tblr-chart-1` … `--tblr-chart-5` and named colors for the series, card surface, borders, radius, shadow, font) with its own colors as fallbacks, so on a Tabler page charts follow the theme without this package. The Tabler preset, `tabler.css`, adds the theme-option scopes: the mapping is declared again on every element with `data-bs-theme-primary`, `-base`, `-font` or `-radius`, so a subtree with its own primary color or radius gets it. It leaves series 2–8 to the chart stylesheet (the rest of Tabler's chart palette, then named colors).
|
|
40
40
|
|
|
41
41
|
### SCSS
|
|
42
42
|
|
|
@@ -82,6 +82,7 @@ await init() // every [data-tc-chart] on the page
|
|
|
82
82
|
- Values are parsed: `true` and `false`, numbers, and JSON objects or arrays.
|
|
83
83
|
- `data-tc-legend="bottom"` moves the legend (also `left`, `right`, `auto`).
|
|
84
84
|
- `data-tc-download="true"` adds a download menu (PNG and SVG); `data-tc-download="svg png"` picks the formats.
|
|
85
|
+
- `data-tc-zoom="true"` lets the reader zoom line, area, bar and candlestick charts, and `data-tc-view='{"start":90,"end":119}'` sets the range shown. `data-tc-brush="true"` makes a chart the brush of the charts with the same `data-tc-sync`, with its range in `data-tc-selection`. With the CDN script it works as is; with `init()` from npm, add `import '@tabler/charts/zoom'`.
|
|
85
86
|
- `data-tc-options` takes a JSON object for the rest.
|
|
86
87
|
- **Loading:** while `data-tc-src` loads, the element has `aria-busy="true"`. A failed load or broken markup is reported without stopping the other charts.
|
|
87
88
|
|
|
@@ -96,13 +97,13 @@ Chart events bubble out of the element as DOM events (`tc-hover`, `tc-click`, `t
|
|
|
96
97
|
|
|
97
98
|
## CDN
|
|
98
99
|
|
|
99
|
-
One classic script with the library, the chart stylesheet with the
|
|
100
|
+
One classic script with the library, the chart stylesheet with the theme mapping, and the data API. The mapping reads Bootstrap's `--bs-*` variables and falls back to Tabler's `--tblr-*`, so the same script follows the theme, in both color modes, on a Bootstrap page and on a Tabler page:
|
|
100
101
|
|
|
101
102
|
```html
|
|
102
103
|
<script src="https://cdn.jsdelivr.net/npm/@tabler/charts-bootstrap/dist/tabler-charts-bootstrap.min.js"></script>
|
|
103
104
|
```
|
|
104
105
|
|
|
105
|
-
It injects the styles and initializes every `[data-tc-chart]` on load; everything is also on the `TablerCharts` global. On the script tag:
|
|
106
|
+
It injects the styles and initializes every `[data-tc-chart]` on load; everything is also on the `TablerCharts` global. The charts are created once the global exists, so a `tc-render` listener can call `TablerCharts.getChart(event.target)`. On the script tag:
|
|
106
107
|
- `data-observe` also handles charts added later;
|
|
107
108
|
- `data-no-styles` skips the styles, so you can load them yourself;
|
|
108
109
|
- `nonce` (under a strict CSP) is passed on to the injected styles.
|