Skip to content

Commit

Permalink
PolarChart: Properly update property stackName when updating option i…
Browse files Browse the repository at this point in the history
…n polarChart[stackbar] (T1215023) (DevExpress#26925)
  • Loading branch information
nikkithelegendarypokemonster authored Mar 15, 2024
1 parent 03bb1c0 commit 42b69cd
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/devextreme/js/viz/series/stacked_series.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,10 @@ chart['fullstackedsplinearea'] = _extend({}, areaSeries['splinearea'], baseStack
_appendInGroup: chart['stackedarea']._appendInGroup
});

polar['stackedbar'] = _extend({}, _polar.bar, baseStackedSeries, {});
polar['stackedbar'] = _extend({}, _polar.bar, baseStackedSeries, { _updateOptions: function(options) {
baseStackedSeries._updateOptions.call(this, options);
this._stackName = this._stackName + '_stack_' + (options.stack || 'default');
} });

export {
chart,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,57 @@ const environment = {
return this.createPolarChart($.extend({}, { dataSource: [], series: {}, argumentAxis: { startAngle: 0 } }, options));
}
};
QUnit.module('create Polar Chart with default configurations');

QUnit.test('test if polarChart correctly labels axis and stack with default if not setted', function(assert) {
const chart = new dxPolarChart('#chartContainer', {
series: [{ type: 'stackedbar' }]
});

const series = chart.getAllSeries();

assert.strictEqual(series.length, 1, 'count of series');

assert.strictEqual(series[0].getStackName(), 'axis_default_stack_default');
});

QUnit.test('test if polarChart correctly labels axisName without stackName', function(assert) {
const chart = new dxPolarChart('#chartContainer', {
series: [{ axis: 'axisName', type: 'stackedbar' }]
});

const series = chart.getAllSeries();

assert.strictEqual(series.length, 1, 'count of series');

assert.strictEqual(series[0].getStackName(), 'axis_axisName_stack_default');
});

QUnit.test('test if polarChart correctly labels axisName with stackName', function(assert) {
const chart = new dxPolarChart('#chartContainer', {
series: [{ axis: 'axisName', type: 'stackedbar', stack: 'stackName' }]
});

const series = chart.getAllSeries();

assert.strictEqual(series.length, 1, 'count of series');

assert.strictEqual(series[0].getStackName(), 'axis_axisName_stack_stackName');
});

QUnit.test('Series of PolarChart should have correct stackName when stackName is set(T1215023)', function(assert) {
const chart = new dxPolarChart('#chartContainer', {
series: [{ type: 'stackedbar', stack: 'first' },
{ type: 'stackedbar', stack: 'second' }]
});

const series = chart.getAllSeries();

assert.strictEqual(series.length, 2, 'count of series');

assert.strictEqual(series[0].getStackName(), 'axis_default_stack_first');
assert.strictEqual(series[1].getStackName(), 'axis_default_stack_second');
});
QUnit.module('create Polar chart', environment);

QUnit.test('create empty polar chart', function(assert) {
Expand Down

0 comments on commit 42b69cd

Please sign in to comment.