Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions dev/examples/gaia.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default async function(el) {
from(table, { filterBy: brush }),
{ x: 'u', y: 'v', fill: 'density', bandwidth, binType, binWidth }
),
intervalXY({ as: brush, pixelSize }),
intervalXY({ as: brush, pixelSize, activateOn: 'mousedown' }),
domainXY(Fixed),
scaleColor('sqrt'), schemeColor('viridis'),
width(700), height(400), marginLeft(25), marginTop(20), marginRight(1)
Expand All @@ -57,7 +57,7 @@ export default async function(el) {
{ x: bin('phot_g_mean_mag'), y: count(), fill: 'steelblue', inset: 0.5 }
),
scaleY(histScale), gridY(true),
intervalX({ as: brush }), domainX(Fixed),
intervalX({ as: brush, activateOn: 'mousedown' }), domainX(Fixed),
width(350), height(200), marginLeft(65)
),
plot(
Expand All @@ -66,7 +66,7 @@ export default async function(el) {
{ x: bin('parallax'), y: count(), fill: 'steelblue', inset: 0.5 }
),
scaleY(histScale), gridY(true),
intervalX({ as: brush }), domainX(Fixed),
intervalX({ as: brush, activateOn: 'mousedown' }), domainX(Fixed),
width(350), height(200), marginLeft(65)
)
)
Expand All @@ -78,7 +78,7 @@ export default async function(el) {
{ x: 'bp_rp', y: 'phot_g_mean_mag', fill: 'density', bandwidth, binType, binWidth }
),
scaleColor('sqrt'), schemeColor('viridis'), reverseY(true),
intervalXY({ as: brush, pixelSize }), domainXY(Fixed),
intervalXY({ as: brush, pixelSize, activateOn: 'mousedown' }), domainXY(Fixed),
width(400), height(600), marginLeft(25), marginTop(20), marginRight(1)
)
)
Expand Down
4 changes: 4 additions & 0 deletions dev/specs/gaia.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ hconcat:
- select: intervalXY
pixelSize: 2
as: $brush
activateOn: mousedown
domainXY: Fixed
scaleColor: $scaleType
schemeColor: viridis
Expand All @@ -54,6 +55,7 @@ hconcat:
inset: 0.5
- select: intervalX
as: $brush
activateOn: mousedown
domainX: Fixed
scaleY: $scaleType
gridY: true
Expand All @@ -69,6 +71,7 @@ hconcat:
inset: 0.5
- select: intervalX
as: $brush
activateOn: mousedown
domainX: Fixed
scaleY: $scaleType
gridY: true
Expand All @@ -88,6 +91,7 @@ hconcat:
- select: intervalXY
pixelSize: 2
as: $brush
activateOn: mousedown
domainXY: Fixed
scaleColor: $scaleType
schemeColor: viridis
Expand Down
6 changes: 4 additions & 2 deletions packages/vgplot/src/interactors/Interval1D.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ export class Interval1D {
field,
pixelSize = 1,
peers = true,
brush: style
brush: style,
activateOn = 'mouseenter'
}) {
this.mark = mark;
this.channel = channel;
Expand All @@ -24,6 +25,7 @@ export class Interval1D {
this.style = style && sanitizeStyles(style);
this.brush = channel === 'y' ? brushY() : brushX();
this.brush.on('brush end', ({ selection }) => this.publish(selection));
this.activateOn = activateOn;
}

activate() {
Expand Down Expand Up @@ -79,6 +81,6 @@ export class Interval1D {
}
}

svg.addEventListener('mouseenter', () => this.activate());
svg.addEventListener(this.activateOn, () => this.activate());
}
}
6 changes: 4 additions & 2 deletions packages/vgplot/src/interactors/Interval2D.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ export class Interval2D {
yfield,
pixelSize = 1,
peers = true,
brush: style
brush: style,
activateOn = 'mouseenter'
}) {
this.mark = mark;
this.pixelSize = pixelSize || 1;
Expand All @@ -25,6 +26,7 @@ export class Interval2D {
this.style = style && sanitizeStyles(style);
this.brush = brush();
this.brush.on('brush end', ({ selection }) => this.publish(selection));
this.activateOn = activateOn;
}

activate() {
Expand Down Expand Up @@ -90,6 +92,6 @@ export class Interval2D {
this.g.call(brush.move, [[x1, y1], [x2, y2]]);
}

svg.addEventListener('mouseenter', () => this.activate());
svg.addEventListener(this.activateOn, () => this.activate());
}
}