@opendata-ai/openchart-vanilla 6.16.0 → 6.18.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opendata-ai/openchart-vanilla",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.18.0",
|
|
4
4
|
"description": "Vanilla JS renderer for openchart: SVG charts, HTML tables, force-directed graphs",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Riley Hilliard",
|
|
@@ -50,8 +50,8 @@
|
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@floating-ui/dom": "^1.7.6",
|
|
53
|
-
"@opendata-ai/openchart-core": "6.
|
|
54
|
-
"@opendata-ai/openchart-engine": "6.
|
|
53
|
+
"@opendata-ai/openchart-core": "6.18.0",
|
|
54
|
+
"@opendata-ai/openchart-engine": "6.18.0",
|
|
55
55
|
"d3-force": "^3.0.0",
|
|
56
56
|
"d3-quadtree": "^3.0.1"
|
|
57
57
|
},
|
|
@@ -114,7 +114,13 @@ describe('chart event handlers', () => {
|
|
|
114
114
|
describe('onLegendToggle', () => {
|
|
115
115
|
it('fires when a legend entry is clicked', () => {
|
|
116
116
|
const onLegendToggle = vi.fn();
|
|
117
|
-
const chart = createChart(
|
|
117
|
+
const chart = createChart(
|
|
118
|
+
container,
|
|
119
|
+
{ ...lineSpec, legend: { show: true } },
|
|
120
|
+
{
|
|
121
|
+
onLegendToggle,
|
|
122
|
+
},
|
|
123
|
+
);
|
|
118
124
|
|
|
119
125
|
const legendEntry = container.querySelector('[data-legend-index]');
|
|
120
126
|
expect(legendEntry).not.toBeNull();
|
|
@@ -565,8 +565,11 @@ describe('gridline rendering', () => {
|
|
|
565
565
|
// ---------------------------------------------------------------------------
|
|
566
566
|
|
|
567
567
|
describe('legend rendering', () => {
|
|
568
|
+
/** Legend is auto-suppressed for line charts with endpoint labels; force it on for these tests. */
|
|
569
|
+
const lineSpecWithLegend = { ...lineSpec, legend: { show: true } };
|
|
570
|
+
|
|
568
571
|
it('multi-series chart renders legend entries', () => {
|
|
569
|
-
const { svg } = renderSpec(
|
|
572
|
+
const { svg } = renderSpec(lineSpecWithLegend);
|
|
570
573
|
const legend = svg.querySelector('.oc-legend');
|
|
571
574
|
expect(legend).not.toBeNull();
|
|
572
575
|
const entries = legend!.querySelectorAll('.oc-legend-entry');
|
|
@@ -575,7 +578,7 @@ describe('legend rendering', () => {
|
|
|
575
578
|
});
|
|
576
579
|
|
|
577
580
|
it('legend entries have labels with series names', () => {
|
|
578
|
-
const { svg } = renderSpec(
|
|
581
|
+
const { svg } = renderSpec(lineSpecWithLegend);
|
|
579
582
|
const entries = svg.querySelectorAll('.oc-legend-entry');
|
|
580
583
|
const labels: string[] = [];
|
|
581
584
|
for (const entry of entries) {
|
|
@@ -587,7 +590,7 @@ describe('legend rendering', () => {
|
|
|
587
590
|
});
|
|
588
591
|
|
|
589
592
|
it('legend entries have data-legend-label attribute', () => {
|
|
590
|
-
const { svg } = renderSpec(
|
|
593
|
+
const { svg } = renderSpec(lineSpecWithLegend);
|
|
591
594
|
const entries = svg.querySelectorAll('.oc-legend-entry');
|
|
592
595
|
for (const entry of entries) {
|
|
593
596
|
expect(entry.getAttribute('data-legend-label')).not.toBeNull();
|
|
@@ -595,7 +598,7 @@ describe('legend rendering', () => {
|
|
|
595
598
|
});
|
|
596
599
|
|
|
597
600
|
it('legend has ARIA attributes for accessibility', () => {
|
|
598
|
-
const { svg } = renderSpec(
|
|
601
|
+
const { svg } = renderSpec(lineSpecWithLegend);
|
|
599
602
|
const legend = svg.querySelector('.oc-legend');
|
|
600
603
|
expect(legend!.getAttribute('role')).toBe('list');
|
|
601
604
|
expect(legend!.getAttribute('aria-label')).toBe('Chart legend');
|