Skip to content

Commit 7cb3295

Browse files
committed
add px-average test scattergl marker.color
- this locks down commit: gl-vis/regl-scatter2d@6138fd7
1 parent 9532210 commit 7cb3295

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

test/jasmine/tests/gl2d_plot_interact_test.js

+43
Original file line numberDiff line numberDiff line change
@@ -789,4 +789,47 @@ describe('@gl Test gl2d plots', function() {
789789
.catch(fail)
790790
.then(done);
791791
});
792+
793+
it('should be able to draw more than 4096 colors', function(done) {
794+
var gd = createGraphDiv();
795+
var x = [];
796+
var color = [];
797+
var N = 1e5;
798+
var w = 500;
799+
var h = 500;
800+
801+
for(var i = 0; i < N; i++) {
802+
x.push(i);
803+
color.push(Math.random());
804+
}
805+
806+
Plotly.newPlot(gd, [{
807+
type: 'scattergl',
808+
mode: 'markers',
809+
x: x,
810+
y: color,
811+
marker: {
812+
color: color,
813+
colorscale: [
814+
[0, 'rgb(255, 0, 0)'],
815+
[0.5, 'rgb(0, 255, 0)'],
816+
[1.0, 'rgb(0, 0, 255)']
817+
]
818+
}
819+
}], {
820+
width: w,
821+
height: h,
822+
margin: {l: 0, t: 0, b: 0, r: 0}
823+
})
824+
.then(function() {
825+
var total = readPixel(gd.querySelector('.gl-canvas-context'), 0, 0, w, h)
826+
.reduce(function(acc, v) { return acc + v; }, 0);
827+
828+
// the total value was 3762487 before PR
829+
// https://github.com/plotly/plotly.js/pull/2377
830+
expect(total).toBeGreaterThan(4e6);
831+
})
832+
.catch(fail)
833+
.then(done);
834+
});
792835
});

0 commit comments

Comments
 (0)