Skip to content

Commit a806ca2

Browse files
committed
plotly#189 test case with null value for a category we just want for an axis tail tick
1 parent cbc98fd commit a806ca2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test/jasmine/tests/calcdata_test.js

+19
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,25 @@ describe('calculated data and points', function() {
236236
expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 4, y: 14}));
237237
});
238238

239+
it('should output categories in explicitly supplied order even if some missing categories were at the beginning or end of categorylist', function() {
240+
241+
// The auto-range feature currently eliminates unutilized category ticks on the left/right edge
242+
// BUT keeps it if a data point with null is added; test is almost identical to the one above
243+
// except that it explicitly adds an axis tick for y
244+
245+
Plotly.plot(gd, [{x: ['c','a','e','b','d', 'y'], y: [15,11,12,13,14, null]}], { xaxis: {
246+
type: 'category',
247+
categorymode: 'array',
248+
categorylist: ['y','b','x','a','d','z','e','c', 'q', 'k']
249+
}});
250+
251+
expect(gd.calcdata[0][0]).toEqual(jasmine.objectContaining({x: 7, y: 15}));
252+
expect(gd.calcdata[0][1]).toEqual(jasmine.objectContaining({x: 3, y: 11}));
253+
expect(gd.calcdata[0][2]).toEqual(jasmine.objectContaining({x: 6, y: 12}));
254+
expect(gd.calcdata[0][3]).toEqual(jasmine.objectContaining({x: 1, y: 13}));
255+
expect(gd.calcdata[0][4]).toEqual(jasmine.objectContaining({x: 4, y: 14}));
256+
});
257+
239258
it('should output categories in explicitly supplied order even if not all categories are present, and should interact with a null value orthogonally', function() {
240259

241260
Plotly.plot(gd, [{x: ['c','a','e','b','d'], y: [15,null,12,13,14]}], { xaxis: {

0 commit comments

Comments
 (0)