Skip to content

Commit

Permalink
Fixed #4119, autogenerated series names were incorrect when index was…
Browse files Browse the repository at this point in the history
… used.
  • Loading branch information
Kacper Madej committed Dec 16, 2018
1 parent 2608aa2 commit 5ee60fe
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion js/parts/Series.js
Original file line number Diff line number Diff line change
Expand Up @@ -2923,7 +2923,7 @@ null
* The series name.
*/
getName: function () {
return this.name || 'Series ' + (this.index + 1);
return pick(this.options.name, 'Series ' + (this.index + 1)); // #4119
},

/**
Expand Down
3 changes: 2 additions & 1 deletion samples/unit-tests/drilldown/across-types/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ QUnit.test('Drilldown across types', function (assert) {
drilldown: {
series: [{
id: 'animals',
name: 'Animals series',
data: [
['Cats', 4],
['Dogs', 2],
Expand Down Expand Up @@ -87,7 +88,7 @@ QUnit.test('Drilldown across types', function (assert) {

assert.equal(
chart.series[0].name,
'Series 2',
'Animals series',
'Second level name'
);

Expand Down
9 changes: 5 additions & 4 deletions samples/unit-tests/drilldown/multi-series/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ QUnit.test('Drill down on points and categories', function (assert) {
drilldown: {
series: [{
id: 'republican-2010',
name: 'republican-2010 series',
data: [
['East', 4],
['West', 2],
Expand Down Expand Up @@ -129,8 +130,8 @@ QUnit.test('Drill down on points and categories', function (assert) {
);
assert.equal(
chart.series[0].name,
'Series 3',
'First series name should be `Series 3`'
'republican-2010 series',
'First series name should be `republican-2010 series`'
);

// ... and, we're back
Expand All @@ -150,8 +151,8 @@ QUnit.test('Drill down on points and categories', function (assert) {
);
assert.equal(
chart.series[0].name,
'Series 3',
'Name of first series should be `Series 3`'
'republican-2010 series',
'Name of first series should be `republican-2010 series`'
);

});
12 changes: 6 additions & 6 deletions samples/unit-tests/series/index/demo.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@


QUnit.test('Series index and updating (#5960)', function (assert) {
QUnit.test('Series index and updating', function (assert) {

var chart;

Expand All @@ -27,7 +27,7 @@ QUnit.test('Series index and updating (#5960)', function (assert) {
assert.strictEqual(
getNames(),
'Series 1, Series 2, Series 3, Series 4, Series 5',
'Initial order'
'Initial order (#5960)'
);

chart.series[1].remove();
Expand All @@ -37,8 +37,8 @@ QUnit.test('Series index and updating (#5960)', function (assert) {

assert.strictEqual(
getNames(),
'Series 1, Series 5',
'Order after remove'
'Series 1, Series 2',
'Order after remove (#4119)'
);

chart.addSeries({
Expand All @@ -48,8 +48,8 @@ QUnit.test('Series index and updating (#5960)', function (assert) {

assert.strictEqual(
getNames(),
'Series 1, Series 5, New Series',
'Order after adding'
'Series 1, Series 2, New Series',
'Order after adding (#5960 & #4119)'
);
});

Expand Down

0 comments on commit 5ee60fe

Please sign in to comment.