8000 Implement scatter `cliponaxis: false` by etpinard · Pull Request #1824 · plotly/plotly.js · GitHub
[go: up one dir, main page]

Skip to content

Implement scatter cliponaxis: false #1824

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 10 commits into from
Prev Previous commit
Next Next commit
implement cliponaxis: false for scatterternary
- mock plotinfo.plotnoclip before calling scatter/plot.js
- override isPtWithinRange methods for ternary
  • Loading branch information
etpinard committed Jun 27, 2017
commit 15534fbe3ecc3c74d9569d4548ecbb389df10825
11 changes: 11 additions & 0 deletions src/plots/ternary/ternary.js
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,16 @@ proto.adjustLayout = function(ternaryLayout, graphSize) {
};
setConvert(_this.xaxis, _this.graphDiv._fullLayout);
_this.xaxis.setScale();
_this.xaxis.isPtWithinRange = function(d) {
return (
d.a >= _this.aaxis.range[0] &&
d.a <= _this.aaxis.range[1] &&
d.b >= _this.baxis.range[1] &&
d.b <= _this.baxis.range[0] &&
d.c >= _this.caxis.range[1] &&
d.c <= _this.caxis.range[0]
);
};

_this.yaxis = {
type: 'linear',
Expand All @@ -194,6 +204,7 @@ proto.adjustLayout = function(ternaryLayout, graphSize) {
};
setConvert(_this.yaxis, _this.graphDiv._fullLayout);
_this.yaxis.setScale();
_this.yaxis.isPtWithinRange = function() { return true; };

// set up the modified axes for tick drawing
var yDomain0 = _this.yaxis.domain[0];
Expand Down
7 changes: 4 additions & 3 deletions src/traces/scatterternary/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ var scatterPlot = require('../scatter/plot');
module.exports = function plot(ternary, moduleCalcData) {
var plotContainer = ternary.plotContainer;

// remove all nodes inside the scatter layer
plotContainer.select('.scatterlayer').selectAll('*').remove();
// remove all nodes inside the scatter layers
plotContainer.selectAll('.scatterlayer').selectAll('*').remove();

// mimic cartesian plotinfo
var plotinfo = {
xaxis: ternary.xaxis,
yaxis: ternary.yaxis,
plot: plotContainer
plot: plotContainer.select('.frontplot'),
plotnoclip: plotContainer.select('.frontplotnoclip')
};

// add ref to ternary subplot object in fullData traces
Expand Down
0