Skip to content

Commit 141a312

Browse files
authored
Chart: ArgumentAxisClick is triggered for removed labels (T1317590) (#32074)
1 parent 23e576b commit 141a312

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

packages/devextreme/js/__internal/viz/m_chart.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -853,6 +853,15 @@ const dxChart = AdvancedChart.inherit({
853853
_handleSeriesDataUpdated() {
854854
const viewport = new Range();
855855

856+
this._argumentAxes.forEach((axis) => {
857+
if (Array.isArray(axis._majorTicks)) {
858+
axis._majorTicks.forEach((tick) => tick.removeLabel && tick.removeLabel());
859+
}
860+
if (Array.isArray(axis._minorTicks)) {
861+
axis._minorTicks.forEach((tick) => tick.removeLabel && tick.removeLabel());
862+
}
863+
});
864+
856865
this.series.forEach((s) => {
857866
viewport.addRange(s.getArgumentRange());
858867
});

packages/devextreme/testing/tests/DevExpress.viz.charts/chart.integration.tests.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,36 @@ QUnit.test('Using the single section of axis options for some panes (check custo
862862
assert.deepEqual(visualRangeChanged.getCall(2).args[0].value, { startValue: 18, endValue: 25 });
863863
});
864864

865+
// T1317590
866+
QUnit.test('Argument axis overlays/labels are removed when dataSource update', function(assert) {
867+
const initialData = [
868+
{ arg: 'Monday', val: 1 },
869+
{ arg: 'Friday', val: 2 }
870+
];
871+
const updatedData = [
872+
{ arg: 'Tuesday', val: 3 },
873+
{ arg: 'Thursday', val: 4 }
874+
];
875+
876+
const chart = this.createChart({
877+
dataSource: initialData,
878+
series: { argumentField: 'arg', valueField: 'val' },
879+
argumentAxis: { label: { visible: true } }
880+
});
881+
882+
let label = this.$container.find('.dxc-arg-elements text').filter(function() {
883+
return $(this).text() === 'Friday';
884+
});
885+
assert.ok(label.length, 'Friday label exists');
886+
887+
chart.option('dataSource', updatedData);
888+
889+
label = this.$container.find('.dxc-arg-elements text').filter(function() {
890+
return $(this).text() === 'Friday';
891+
});
892+
assert.notOk(label.length, 'Friday label is not exists');
893+
});
894+
865895
// T681674
866896
QUnit.test('actual value axis visualRange after dataSource updating (argument axis without visual range)', function(assert) {
867897
const chart = this.createChart({

0 commit comments

Comments
 (0)