Skip to content

Commit

Permalink
Fixed #19616, breadcrumbs dissapeared when data updated in sunburst.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Januchta authored and TorsteinHonsi committed Sep 4, 2023
1 parent 4fea9f0 commit d8d3d2c
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 75 deletions.
150 changes: 79 additions & 71 deletions samples/unit-tests/breadcrumbs/breadcrumbs-in-treemap/demo.js
@@ -1,79 +1,80 @@
QUnit.test('Breadcrumbs button', function (assert) {
const chart = Highcharts.chart('container', {
navigation: {
breadcrumbs: {
buttonSpacing: 20
}
},
series: [{
breadcrumbs: {
showFullPath: false
},
type: 'treemap',
name: 'Store',
layoutAlgorithm: 'squarified',
allowDrillToNode: true,
dataLabels: {
enabled: false
const chartOptions = {
navigation: {
breadcrumbs: {
buttonSpacing: 20
}
},
levelIsConstant: false,
levels: [{
level: 1,
series: [{
breadcrumbs: {
showFullPath: false
},
type: 'treemap',
name: 'Store',
layoutAlgorithm: 'squarified',
allowDrillToNode: true,
dataLabels: {
enabled: true
enabled: false
},
borderWidth: 1
}],
data: [{
id: '1',
name: 'Fruits',
value: 5
}, {
id: '2',
name: 'Vegetables',
value: 6
}, {
id: '3',
name: 'Meat',
value: 3
}, {
id: '1_1',
parent: '1',
name: 'Citrus',
value: 2
}, {
id: '1_2',
parent: '1',
name: 'Tropical',
value: 5
}, {
id: '1_3',
parent: '1',
name: 'Other',
value: 3
}, {
id: '1_1_1',
parent: '1_1',
name: 'Lemon',
value: 3
}, {
id: '1_1_2',
parent: '1_1',
name: 'Orange',
value: 3
}, {
id: '1_1_1_1',
parent: '1_1_1',
name: 'Type A',
value: 3
}, {
id: '1_1_1_1',
parent: '1_1_1',
name: 'Type B',
value: 4
levelIsConstant: false,
levels: [{
level: 1,
dataLabels: {
enabled: true
},
borderWidth: 1
}],
data: [{
id: '1',
name: 'Fruits',
value: 5
}, {
id: '2',
name: 'Vegetables',
value: 6
}, {
id: '3',
name: 'Meat',
value: 3
}, {
id: '1_1',
parent: '1',
name: 'Citrus',
value: 2
}, {
id: '1_2',
parent: '1',
name: 'Tropical',
value: 5
}, {
id: '1_3',
parent: '1',
name: 'Other',
value: 3
}, {
id: '1_1_1',
parent: '1_1',
name: 'Lemon',
value: 3
}, {
id: '1_1_2',
parent: '1_1',
name: 'Orange',
value: 3
}, {
id: '1_1_1_1',
parent: '1_1_1',
name: 'Type A',
value: 3
}, {
id: '1_1_1_1',
parent: '1_1_1',
name: 'Type B',
value: 4
}]
}]
}]
});
},
chart = Highcharts.chart('container', chartOptions);
const series = chart.series[0];
series.setRootNode('1_1_1');
assert.ok(
Expand All @@ -87,6 +88,13 @@ QUnit.test('Breadcrumbs button', function (assert) {
'Options from navigation should take effect'
);

chart.update(chartOptions);

assert.ok(
chart.breadcrumbs.group.element,
'Breadcrumbs should not dissapear when chart.update is called (#19616).'
);

chart.series[0].update({
breadcrumbs: {
showFullPath: true
Expand Down
6 changes: 2 additions & 4 deletions ts/Series/Treemap/TreemapSeries.ts
Expand Up @@ -1405,11 +1405,9 @@ class TreemapSeries extends ScatterSeries {
addEvent(series, 'destroy',
function destroyEvents(e: any): void {
const chart = this.chart;
if (chart.breadcrumbs) {
if (chart.breadcrumbs && !e.keepEventsForUpdate) {
chart.breadcrumbs.destroy();
if (!e.keepEventsForUpdate) {
chart.breadcrumbs = void 0;
}
chart.breadcrumbs = void 0;
}
}
)
Expand Down

0 comments on commit d8d3d2c

Please sign in to comment.