-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
/
Copy pathcalc.js
35 lines (29 loc) · 906 Bytes
/
calc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
* Copyright 2012-2019, Plotly, Inc.
* All rights reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
'use strict';
// var Registry = require('../../registry');
// var Lib = require('../../lib');
var Axes = require('../../plots/cartesian/axes');
module.exports = function calc(gd, trace) {
var xa = Axes.getFromId(gd, trace.xaxis || 'x');
var ya = Axes.getFromId(gd, trace.yaxis || 'y');
var x0 = trace.x0 - trace.dx / 2;
var y0 = trace.y0 - trace.dy / 2;
var h = trace.z.length;
var w = trace.z[0].length;
trace._extremes[xa._id] = Axes.findExtremes(xa, [x0, x0 + w * trace.dx]);
trace._extremes[ya._id] = Axes.findExtremes(ya, [y0, y0 + h * trace.dy]);
var cd0 = {
x0: x0,
y0: y0,
z: trace.z,
w: w,
h: h
};
return [cd0];
};