Skip to content

Better polar setConvert + a few misc polar touch ups #2895

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 18 commits into from
Aug 15, 2018
Merged
Changes from 1 commit
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
16 changes: 5 additions & 11 deletions src/traces/bar/calc.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,11 @@ var arraysToCalcdata = require('./arrays_to_calcdata');
var calcSelection = require('../scatter/calc_selection');

module.exports = function calc(gd, trace) {
// depending on bar direction, set position and size axes
// and data ranges
// note: this logic for choosing orientation is
// duplicated in graph_obj->setstyles
var xa = Axes.getFromId(gd, trace.xaxis || 'x');
var ya = Axes.getFromId(gd, trace.yaxis || 'y');
var size, pos;

var xa = Axes.getFromId(gd, trace.xaxis || 'x'),
ya = Axes.getFromId(gd, trace.yaxis || 'y'),
orientation = trace.orientation || ((trace.x && !trace.y) ? 'h' : 'v'),
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice catch!

pos, size, i;

if(orientation === 'h') {
if(trace.orientation === 'h') {
size = xa.makeCalcdata(trace, 'x');
pos = ya.makeCalcdata(trace, 'y');
} else {
Expand All @@ -38,7 +32,7 @@ module.exports = function calc(gd, trace) {
var cd = new Array(serieslen);

// set position and size
for(i = 0; i < serieslen; i++) {
for(var i = 0; i < serieslen; i++) {
cd[i] = { p: pos[i], s: size[i] };

if(trace.ids) {
Expand Down