@opendata-ai/openchart-engine 2.10.0 → 2.12.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/dist/index.js +182 -48
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/src/__tests__/axes.test.ts +179 -2
- package/src/annotations/__tests__/compute.test.ts +173 -4
- package/src/annotations/compute.ts +158 -41
- package/src/charts/column/__tests__/labels.test.ts +104 -0
- package/src/charts/dot/__tests__/labels.test.ts +98 -0
- package/src/charts/pie/__tests__/labels.test.ts +132 -0
- package/src/compile.ts +58 -10
- package/src/layout/axes.ts +114 -15
- package/src/legend/compute.ts +5 -4
- package/src/tooltips/compute.ts +5 -0
package/src/tooltips/compute.ts
CHANGED
|
@@ -83,6 +83,11 @@ function buildFields(row: DataRow, encoding: Encoding, color?: string): TooltipF
|
|
|
83
83
|
|
|
84
84
|
/** Determine the title for a tooltip based on encoding. */
|
|
85
85
|
function getTooltipTitle(row: DataRow, encoding: Encoding): string | undefined {
|
|
86
|
+
// Detail channel provides an explicit label (e.g. district name in scatter)
|
|
87
|
+
if (encoding.detail) {
|
|
88
|
+
return String(row[encoding.detail.field] ?? '');
|
|
89
|
+
}
|
|
90
|
+
|
|
86
91
|
// For charts with a temporal x-axis, use the date as the title
|
|
87
92
|
if (encoding.x?.type === 'temporal') {
|
|
88
93
|
return formatValue(row[encoding.x.field], 'temporal');
|