Skip to content

Commit

Permalink
replace 'usepolygons' -> gridshape: 'linear'
Browse files Browse the repository at this point in the history
  • Loading branch information
etpinard committed Jun 19, 2018
1 parent a0a62af commit a26b56f
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
10 changes: 6 additions & 4 deletions src/plots/polar/layout_attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,13 +267,15 @@ module.exports = {
radialaxis: radialAxisAttrs,
angularaxis: angularAxisAttrs,

usepolygons: {
valType: 'boolean',
gridshape: {
valType: 'enumerated',
values: ['circular', 'linear'],
dflt: 'circular',
role: 'style',
editType: 'plot',
dflt: false,
description: [
'...',
'Determines if the radial axis grid lines and angular axis line are drawn',
'as *circular* sectors or as *linear* (polygon) sectors.',
'Has an effect only when the angular axis has `type` *category*.',
'Note that `radialaxis.angle` is snapped to the angle of the closest',
'vertex (so that radial axis scale is the same as the data scale).'
Expand Down
2 changes: 1 addition & 1 deletion src/plots/polar/layout_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ function handleDefaults(contIn, contOut, coerce, opts) {
}

if(contOut.angularaxis.type === 'category') {
coerce('usepolygons');
coerce('gridshape');
}
}

Expand Down
8 changes: 5 additions & 3 deletions src/plots/polar/polar.js
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,9 @@ proto.updateAngularAxis = function(fullLayout, polarLayout) {

// angle of polygon vertices in radians (null means circles)
// TODO what to do when ax.period > ax._categories ??
_this.vangles = polarLayout.usepolygons ? ax._vals.map(c2rad) : null;
_this.vangles = polarLayout.gridshape === 'linear' ?
ax._vals.map(c2rad) :
null;

updateElement(layers['angular-line'].select('path'), angularLayout.showline, {
d: pathSectorClosed(radius, sector, _this.vangles),
Expand Down Expand Up @@ -1303,8 +1305,8 @@ function pathSector(r, sector, vangles) {
return d;
}

function pathSectorClosed(r, sector, nside) {
return pathSector(r, sector, nside) +
function pathSectorClosed(r, sector, vangles) {
return pathSector(r, sector, vangles) +
(isFullCircle(sector) ? '' : 'L0,0Z');
}

Expand Down
8 changes: 4 additions & 4 deletions test/image/mocks/polar_polygon-grids.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
],
"layout": {
"polar": {
"usepolygons": true,
"gridshape": "linear",
"domain": {
"x": [0, 0.46],
"y": [0.56, 1]
Expand All @@ -57,7 +57,7 @@
}
},
"polar2": {
"usepolygons": true,
"gridshape": "linear",
"domain": {
"x": [0, 0.46],
"y": [0, 0.44]
Expand All @@ -67,7 +67,7 @@
}
},
"polar3": {
"usepolygons": true,
"gridshape": "linear",
"domain": {
"x": [0.54, 1],
"y": [0.56, 1]
Expand All @@ -83,7 +83,7 @@
}
},
"polar4": {
"usepolygons": true,
"gridshape": "linear",
"bgcolor": "#d3d3d3",
"domain": {
"x": [0.54, 1],
Expand Down

0 comments on commit a26b56f

Please sign in to comment.