Skip to content

Commit

Permalink
improve polar setConvert
Browse files Browse the repository at this point in the history
- introduce 'g'eomtric coordinate system, that handles
  angular rotation / directrion and radial range shifts
- add 't'icks coord system for angular axes tick vals
- add setGeometry (which sets the c2g converters)
- make 'c' linear theta coordinates be in radians,
  eliminating trace.thetaunit deps after 'calc'
  • Loading branch information
etpinard committed Aug 9, 2018
1 parent 80717d5 commit 3d8eef2
Show file tree
Hide file tree
Showing 10 changed files with 276 additions and 217 deletions.
5 changes: 5 additions & 0 deletions src/lib/angles.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ exports.wrap180 = function(deg) {
if(Math.abs(deg) > 180) deg -= Math.round(deg / 360) * 360;
return deg;
};

exports.isFullCircle = function(sector) {
var arc = Math.abs(sector[1] - sector[0]);
return arc === 360;
};
1 change: 1 addition & 0 deletions src/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ lib.deg2rad = anglesModule.deg2rad;
lib.rad2deg = anglesModule.rad2deg;
lib.wrap360 = anglesModule.wrap360;
lib.wrap180 = anglesModule.wrap180;
lib.isFullCircle = anglesModule.isFullCircle;

var geom2dModule = require('./geometry2d');
lib.segmentsIntersect = geom2dModule.segmentsIntersect;
Expand Down
61 changes: 0 additions & 61 deletions src/plots/polar/helpers.js

This file was deleted.

7 changes: 2 additions & 5 deletions src/plots/polar/layout_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@ var handleTickLabelDefaults = require('../cartesian/tick_label_defaults');
var handleCategoryOrderDefaults = require('../cartesian/category_order_defaults');
var handleLineGridDefaults = require('../cartesian/line_grid_defaults');
var autoType = require('../cartesian/axis_autotype');
var setConvert = require('../cartesian/set_convert');

var setConvertAngular = require('./helpers').setConvertAngular;
var layoutAttributes = require('./layout_attributes');
var setConvert = require('./set_convert');
var constants = require('./constants');
var axisNames = constants.axisNames;

Expand Down Expand Up @@ -66,7 +65,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
});

var visible = coerceAxis('visible');
setConvert(axOut, layoutOut);
setConvert(axOut, contOut, layoutOut);

var dfltColor;
var dfltFontColor;
Expand Down Expand Up @@ -140,8 +139,6 @@ function handleDefaults(contIn, contOut, coerce, opts) {

var direction = coerceAxis('direction');
coerceAxis('rotation', {counterclockwise: 0, clockwise: 90}[direction]);

setConvertAngular(axOut);
break;
}

Expand Down
Loading

0 comments on commit 3d8eef2

Please sign in to comment.