Skip to content

Commit

Permalink
Fixed #19725, drilling cartesian and non-cartesian series didn't work.
Browse files Browse the repository at this point in the history
  • Loading branch information
hubertkozik committed Sep 13, 2023
1 parent 9baeb12 commit 2fbd8f6
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 16 deletions.
1 change: 1 addition & 0 deletions samples/unit-tests/drilldown/across-types/demo.html
@@ -1,6 +1,7 @@
<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/drilldown.js"></script>
<script src="https://code.highcharts.com/modules/treemap.js"></script>
<script src="https://code.highcharts.com/modules/wordcloud.js"></script>

<div id="qunit"></div>
<div id="qunit-fixture"></div>
Expand Down
43 changes: 43 additions & 0 deletions samples/unit-tests/drilldown/across-types/demo.js
Expand Up @@ -285,4 +285,47 @@ QUnit.test('Drilldown across types', function (assert) {
1,
'After drilldown treemap axes options should be reset (#12326).'
);

chart.drillUp();
chart.update({
series: [{
type: 'column',
data: [{
name: 'A',
y: 50,
drilldown: 'A'
}]
}],
drilldown: {
series: [{
name: 'A',
id: 'A',
type: 'wordcloud',
data: [{
name: 'Test',
weight: 1
}]
}]
}
});
chart.series[0].points[0].doDrilldown();

chart.axes.forEach(axis => {
assert.strictEqual(
axis.axisLine,
void 0,
`After drilldown from cartesian series to non-cartesian ${axis.coll}
shouldn't be visible. (#19725).`
);
});

chart.drillUp();
chart.axes.forEach(axis => {
assert.notEqual(
axis.axisLine,
void 0,
`After drill up from non-cartesian series to cartesian ${axis.coll}
should be visible. (#19725).`
);
});
});
12 changes: 11 additions & 1 deletion ts/Extensions/Drilldown.ts
Expand Up @@ -959,6 +959,8 @@ Chart.prototype.applyDrilldown = function (): void {
// #3352, async loading
levelToRemove =
drilldownLevels[drilldownLevels.length - 1].levelNumber;
chart.hasCartesianSeries = drilldownLevels.some((level): boolean =>
level.lowerSeries.isCartesian); // #19725
(this.drilldownLevels as any).forEach(function (
level: Highcharts.DrilldownLevelObject
): void {
Expand Down Expand Up @@ -987,7 +989,7 @@ Chart.prototype.applyDrilldown = function (): void {
series.remove(false);
}
} else {
// deal with asonchrynous removing of map series after
// Deal with asonchrynous removing of map series after
// zooming into
if (
series.options &&
Expand Down Expand Up @@ -1051,6 +1053,14 @@ Chart.prototype.applyDrilldown = function (): void {

fireEvent(this, 'afterDrilldown');

// Axes shouldn't be visible after drilling into non-cartesian (#19725)
if (!chart.hasCartesianSeries) {
chart.axes.forEach((axis): void => {
axis.destroy(true);
axis.init(this, merge(axis.userOptions, axis.options));
});
}

this.redraw();
fireEvent(this, 'afterApplyDrilldown');
}
Expand Down
16 changes: 1 addition & 15 deletions ts/Series/Wordcloud/WordcloudSeries.ts
Expand Up @@ -225,21 +225,6 @@ class WordcloudSeries extends ColumnSeries {
* Functions
*
*/
public bindAxes(): void {
const wordcloudAxis = {
endOnTick: false,
gridLineWidth: 0,
lineWidth: 0,
maxPadding: 0,
startOnTick: false,
title: void 0,
tickPositions: []
};

Series.prototype.bindAxes.call(this);
extend(this.yAxis.options, wordcloudAxis);
extend(this.xAxis.options, wordcloudAxis);
}

public pointAttribs(
point: WordcloudPoint,
Expand Down Expand Up @@ -533,6 +518,7 @@ extend(WordcloudSeries.prototype, {
animate: noop,
animateDrilldown: noop,
animateDrillupFrom: noop,
isCartesian: false,
pointClass: WordcloudPoint,
setClip: noop,

Expand Down

0 comments on commit 2fbd8f6

Please sign in to comment.