plotly.js
Version:
The open source javascript graphing library that powers plotly
42 lines (34 loc) • 1.19 kB
JavaScript
/**
* Copyright 2012-2020, 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.
*/
;
var setPositionOffset = require('../box/cross_trace_calc').setPositionOffset;
var orientations = ['v', 'h'];
module.exports = function crossTraceCalc(gd, plotinfo) {
var calcdata = gd.calcdata;
var xa = plotinfo.xaxis;
var ya = plotinfo.yaxis;
for(var i = 0; i < orientations.length; i++) {
var orientation = orientations[i];
var posAxis = orientation === 'h' ? ya : xa;
var violinList = [];
for(var j = 0; j < calcdata.length; j++) {
var cd = calcdata[j];
var t = cd[0].t;
var trace = cd[0].trace;
if(trace.visible === true && trace.type === 'violin' &&
!t.empty &&
trace.orientation === orientation &&
trace.xaxis === xa._id &&
trace.yaxis === ya._id
) {
violinList.push(j);
}
}
setPositionOffset('violin', gd, violinList, posAxis);
}
};