Skip to content

Commit 0c41776

Browse files
committed
categorical cartesian: convert numbers to strings for _categories
1 parent f180c79 commit 0c41776

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/plots/cartesian/set_convert.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ module.exports = function setConvert(ax, fullLayout) {
133133
if(ax._categoriesMap[v] !== undefined) {
134134
return ax._categoriesMap[v];
135135
} else {
136-
ax._categories.push(v);
136+
ax._categories.push(typeof v === 'number' ? String(v) : v);
137137

138138
var curLength = ax._categories.length - 1;
139139
ax._categoriesMap[v] = curLength;

test/jasmine/tests/axes_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3096,7 +3096,7 @@ describe('Test axes', function() {
30963096
x: new Float32Array([3, 1, 2]),
30973097
}, 'x', 'category');
30983098
expect(out).toEqual([0, 1, 2]);
3099-
expect(ax._categories).toEqual([3, 1, 2]);
3099+
expect(ax._categories).toEqual(['3', '1', '2']);
31003100
});
31013101

31023102
it('- on a date axis', function() {

test/jasmine/tests/calcdata_test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ describe('calculated data and points', function() {
862862
xaxis: {type: 'category'}
863863
});
864864

865-
expect(gd._fullLayout.xaxis._categories).toEqual(['a', 'b', 1]);
865+
expect(gd._fullLayout.xaxis._categories).toEqual(['a', 'b', '1']);
866866
expect(gd._fullLayout.xaxis._categoriesMap).toEqual({
867867
'1': 2,
868868
'a': 0,

0 commit comments

Comments
 (0)