railsui_charts 0.1.1 → 0.1.2
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.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 90aab15c8c1ef133527f757c7e24344da84a62a190825a13decee8979cf79892
|
|
4
|
+
data.tar.gz: db6626712782f3a93d92ea8c149d9fbe27cece328b1cfca4b611269dd06a8c0b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94345b1a73e7cdd1e2760ee58462f6af60396019295cb0a05a5f300120c2d5ed192d64770cb38254abfa959e94ca5ab51ed9353107163e5f2eb75a22e42611a9
|
|
7
|
+
data.tar.gz: e89fad7105008595f9de2070044287e1c193a09ab83dd327492a794106259d24783fc30ed580e19c07a40c8a7ea06ed2fbb7ac5780d620af0eafe7ce643da9d8
|
data/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ public API may change between minor versions.
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [0.1.2]
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- Tooltips on pie, donut and polar area charts rendered as an empty box. A
|
|
14
|
+
circular chart hands the tooltip a flat array of numbers and names the
|
|
15
|
+
hovered slice with `seriesIndex`; reading it as one array per series gave
|
|
16
|
+
every value `undefined`, and rows without a value are dropped. The slice now
|
|
17
|
+
shows its name and its formatted value.
|
|
18
|
+
|
|
9
19
|
## [0.1.1]
|
|
10
20
|
|
|
11
21
|
### Fixed
|
|
@@ -57,6 +67,7 @@ First release.
|
|
|
57
67
|
reachable only by hovering a mark
|
|
58
68
|
- Animation stops when the reader has asked for reduced motion
|
|
59
69
|
|
|
60
|
-
[Unreleased]: https://github.com/getrailsui/railsui_charts/compare/v0.1.
|
|
70
|
+
[Unreleased]: https://github.com/getrailsui/railsui_charts/compare/v0.1.2...HEAD
|
|
71
|
+
[0.1.2]: https://github.com/getrailsui/railsui_charts/compare/v0.1.1...v0.1.2
|
|
61
72
|
[0.1.1]: https://github.com/getrailsui/railsui_charts/compare/v0.1.0...v0.1.1
|
|
62
73
|
[0.1.0]: https://github.com/getrailsui/railsui_charts/releases/tag/v0.1.0
|
|
@@ -128,8 +128,23 @@ export default class extends Controller {
|
|
|
128
128
|
...options,
|
|
129
129
|
tooltip: {
|
|
130
130
|
...(options.tooltip || {}),
|
|
131
|
-
custom: ({ series, dataPointIndex, w }) => {
|
|
131
|
+
custom: ({ series, seriesIndex, dataPointIndex, w }) => {
|
|
132
132
|
const labels = w.globals.categoryLabels?.length ? w.globals.categoryLabels : w.globals.labels
|
|
133
|
+
|
|
134
|
+
// A pie, donut or polar area hands back one number per slice rather
|
|
135
|
+
// than one array per series, and names the hovered slice with
|
|
136
|
+
// seriesIndex — dataPointIndex means nothing there. Read as a
|
|
137
|
+
// cartesian series, every value came out undefined, and since rows
|
|
138
|
+
// without a value are dropped the tooltip rendered as an empty box.
|
|
139
|
+
if (!Array.isArray(series[0])) {
|
|
140
|
+
const slice = seriesIndex ?? dataPointIndex
|
|
141
|
+
// No row label: the slice's name is already the heading, and
|
|
142
|
+
// printing it twice in a two-line tooltip reads as a mistake.
|
|
143
|
+
const row = { label: "", value: series[slice], color: w.globals.colors[slice], format: rowFormats[slice] || null }
|
|
144
|
+
|
|
145
|
+
return this.tooltipMarkup(labels?.[slice], [row], null, format)
|
|
146
|
+
}
|
|
147
|
+
|
|
133
148
|
const point = (index) => series[index]?.[dataPointIndex]
|
|
134
149
|
const comparing = series.length === 2 && comparedDates.length > 0
|
|
135
150
|
|
|
@@ -128,8 +128,23 @@ export default class extends Controller {
|
|
|
128
128
|
...options,
|
|
129
129
|
tooltip: {
|
|
130
130
|
...(options.tooltip || {}),
|
|
131
|
-
custom: ({ series, dataPointIndex, w }) => {
|
|
131
|
+
custom: ({ series, seriesIndex, dataPointIndex, w }) => {
|
|
132
132
|
const labels = w.globals.categoryLabels?.length ? w.globals.categoryLabels : w.globals.labels
|
|
133
|
+
|
|
134
|
+
// A pie, donut or polar area hands back one number per slice rather
|
|
135
|
+
// than one array per series, and names the hovered slice with
|
|
136
|
+
// seriesIndex — dataPointIndex means nothing there. Read as a
|
|
137
|
+
// cartesian series, every value came out undefined, and since rows
|
|
138
|
+
// without a value are dropped the tooltip rendered as an empty box.
|
|
139
|
+
if (!Array.isArray(series[0])) {
|
|
140
|
+
const slice = seriesIndex ?? dataPointIndex
|
|
141
|
+
// No row label: the slice's name is already the heading, and
|
|
142
|
+
// printing it twice in a two-line tooltip reads as a mistake.
|
|
143
|
+
const row = { label: "", value: series[slice], color: w.globals.colors[slice], format: rowFormats[slice] || null }
|
|
144
|
+
|
|
145
|
+
return this.tooltipMarkup(labels?.[slice], [row], null, format)
|
|
146
|
+
}
|
|
147
|
+
|
|
133
148
|
const point = (index) => series[index]?.[dataPointIndex]
|
|
134
149
|
const comparing = series.length === 2 && comparedDates.length > 0
|
|
135
150
|
|