Skip to content

React finance precursor #2525

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

Merged
merged 10 commits into from
Apr 5, 2018
6 changes: 3 additions & 3 deletions src/traces/carpet/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ module.exports = function calc(gd, trace) {
trace.setScale();

// Convert cartesian-space x/y coordinates to screen space pixel coordinates:
t.xp = trace.xp = map2dArray(trace.xp, x, xa.c2p);
t.yp = trace.yp = map2dArray(trace.yp, y, ya.c2p);
t.xp = trace._xp = map2dArray(trace._xp, x, xa.c2p);
t.yp = trace._yp = map2dArray(trace._yp, y, ya.c2p);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are these xp and yp values used anywhere? Here they appear to be reset during the plot step.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha good call. Nothing fails if you 🔪 these lines, which is good because the calc step had better not generate pixel positions, the axis scaling isn't known yet at that point!
Removed in 0221510

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wow, then map_2d_array became totally unused -> b0af416


// This is a rather expensive scan. Nothing guarantees monotonicity,
// so we need to scan through all data to get proper ranges:
Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports = function calc(gd, trace) {

// Tabulate points for the four segments that bound the axes so that we can
// map to pixel coordinates in the plot function and create a clip rect:
t.clipsegments = calcClipPath(trace.xctrl, trace.yctrl, aax, bax);
t.clipsegments = calcClipPath(trace._xctrl, trace._yctrl, aax, bax);

t.x = x;
t.y = y;
Expand Down
4 changes: 2 additions & 2 deletions src/traces/carpet/calc_gridlines.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ module.exports = function calcGridlines(trace, cd, axisLetter, crossAxisLetter)
axis.tickvals = data.slice();
}

var xcp = trace.xctrl;
var ycp = trace.yctrl;
var xcp = trace._xctrl;
var ycp = trace._yctrl;
var nea = xcp[0].length;
var neb = xcp.length;
var na = trace.a.length;
Expand Down
12 changes: 6 additions & 6 deletions src/traces/carpet/set_convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,18 @@ module.exports = function setConvert(trace) {
// an expanded basis of control points. Note in particular that it overwrites the existing
// basis without creating a new array since that would potentially thrash the garbage
// collector.
var result = computeControlPoints(trace.xctrl, trace.yctrl, x, y, aax.smoothing, bax.smoothing);
trace.xctrl = result[0];
trace.yctrl = result[1];
var result = computeControlPoints(trace._xctrl, trace._yctrl, x, y, aax.smoothing, bax.smoothing);
trace._xctrl = result[0];
trace._yctrl = result[1];

// This step is the second step in the process, but it's somewhat simpler. It just unrolls
// some logic since it would be unnecessarily expensive to compute both interpolations
// nearly identically but separately and to include a bunch of linear vs. bicubic logic in
// every single call.
trace.evalxy = createSplineEvaluator([trace.xctrl, trace.yctrl], na, nb, aax.smoothing, bax.smoothing);
trace.evalxy = createSplineEvaluator([trace._xctrl, trace._yctrl], na, nb, aax.smoothing, bax.smoothing);

trace.dxydi = createIDerivativeEvaluator([trace.xctrl, trace.yctrl], aax.smoothing, bax.smoothing);
trace.dxydj = createJDerivativeEvaluator([trace.xctrl, trace.yctrl], aax.smoothing, bax.smoothing);
trace.dxydi = createIDerivativeEvaluator([trace._xctrl, trace._yctrl], aax.smoothing, bax.smoothing);
trace.dxydj = createJDerivativeEvaluator([trace._xctrl, trace._yctrl], aax.smoothing, bax.smoothing);
};

/*
Expand Down
2 changes: 1 addition & 1 deletion src/traces/contour/empty_pathinfo.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ module.exports = function emptyPathinfo(contours, plotinfo, cd0) {
var pathinfo = [];
var end = endPlus(contoursFinal);

var carpet = cd0.trace.carpetTrace;
var carpet = cd0.trace._carpetTrace;

var basePathinfo = carpet ? {
// store axes so we can convert to px
Expand Down
4 changes: 2 additions & 2 deletions src/traces/contourcarpet/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var setContours = require('../contour/set_contours');
// though a few things inside heatmap calc still look for
// contour maps, because the makeBoundArray calls are too entangled
module.exports = function calc(gd, trace) {
var carpet = trace.carpetTrace = lookupCarpet(gd, trace);
var carpet = trace._carpetTrace = lookupCarpet(gd, trace);
if(!carpet || !carpet.visible || carpet.visible === 'legendonly') return;

if(!trace.a || !trace.b) {
Expand Down Expand Up @@ -54,7 +54,7 @@ module.exports = function calc(gd, trace) {
function heatmappishCalc(gd, trace) {
// prepare the raw data
// run makeCalcdata on x and y even for heatmaps, in case of category mappings
var carpet = trace.carpetTrace;
var carpet = trace._carpetTrace;
var aax = carpet.aaxis;
var bax = carpet.baxis;
var a,
Expand Down
2 changes: 1 addition & 1 deletion src/traces/contourcarpet/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ module.exports = function plot(gd, plotinfo, cdcontours) {
function plotOne(gd, plotinfo, cd) {
var trace = cd[0].trace;

var carpet = trace.carpetTrace = lookupCarpet(gd, trace);
var carpet = trace._carpetTrace = lookupCarpet(gd, trace);
var carpetcd = gd.calcdata[carpet.index][0];

if(!carpet.visible || carpet.visible === 'legendonly') return;
Expand Down
2 changes: 1 addition & 1 deletion src/traces/scattercarpet/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ var calcMarkerSize = require('../scatter/calc').calcMarkerSize;
var lookupCarpet = require('../carpet/lookup_carpetid');

module.exports = function calc(gd, trace) {
var carpet = trace.carpetTrace = lookupCarpet(gd, trace);
var carpet = trace._carpetTrace = lookupCarpet(gd, trace);
if(!carpet || !carpet.visible || carpet.visible === 'legendonly') return;
var i;

Expand Down
6 changes: 4 additions & 2 deletions src/traces/table/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

var wrap = require('../../lib/gup').wrap;

module.exports = function calc(gd, trace) {
return wrap(trace);
module.exports = function calc() {
// we don't actually need to include the trace here, since that will be added
// by Plots.doCalcdata, and that's all we actually need later.
return wrap({});
};
Loading