Skip to content

Commit e3d2b37

Browse files
committed
Activate coalescing in layouts for assoc scatter
1 parent 01ecbcd commit e3d2b37

File tree

3 files changed

+22
-4
lines changed

3 files changed

+22
-4
lines changed

esm/components/data_layer/scatter.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ const default_layout = {
1313
tooltip_positioning: 'horizontal',
1414
color: '#888888',
1515
coalesce: {
16-
// Should we try to combine adjacent insignificant ("some region of interest") points
16+
// Options to control whether and how to combine adjacent insignificant ("within region of interest") points
1717
// to improve rendering performance?
18-
active: true,
18+
active: false,
1919
max_points: 800, // Many plots are 800-2400 px wide, so, more than 1 datum per pixel of average region width
20-
// These are expressed in terms of data value and will be converted to pixels internally.
20+
// Define the "region of interest", like "bottom half of plot"; any points outside this region are taken as is
21+
// Values are expressed in terms of data value and will be converted to pixels internally.
2122
x_min: '-Infinity',
2223
x_max: 'Infinity',
2324
y_min: 0,

esm/layouts/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ const association_pvalues_layer = {
117117
namespace: { 'assoc': 'assoc', 'ld': 'ld' },
118118
id: 'associationpvalues',
119119
type: 'scatter',
120+
coalesce: {
121+
active: true,
122+
},
120123
point_shape: {
121124
scale_function: 'if',
122125
field: '{{namespace[ld]}}isrefvar',

test/unit/helpers/test_render.js

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ describe('Coordinate coalescing', function () {
4040
});
4141
describe('coalesce_scatter_points', function () {
4242
it('handles wide spans for any y within bounds', function () {
43-
var actual = coalesce_scatter_points(
43+
const actual = coalesce_scatter_points(
4444
this.sample_data,
4545
-Infinity, Infinity, 3,
4646
0, 1, Infinity
@@ -116,5 +116,19 @@ describe('Coordinate coalescing', function () {
116116
assert.equal(actual.length, expected.length, 'Found correct number of items');
117117
assert.deepStrictEqual(actual, expected, 'Specified items are present');
118118
});
119+
120+
it('always adds points that are explicitly marked significant', function () {
121+
const sample_data = _addSymbols([
122+
{ x: 0, y: 0.5, lz_highlight_match: true },
123+
{ x: 1, y: 0.9, lz_highlight_match: true },
124+
{ x: 2, y: 0.999, lz_highlight_match: true },
125+
]);
126+
const actual = coalesce_scatter_points(
127+
sample_data,
128+
-Infinity, Infinity, 3,
129+
0, 1, Infinity
130+
);
131+
assert.deepStrictEqual(actual, sample_data, 'Significant points do not coalesce');
132+
});
119133
});
120134
});

0 commit comments

Comments
 (0)