diff --git a/src/plots/polar/layout_attributes.js b/src/plots/polar/layout_attributes.js index 18b0129a0c7..16adc779d5a 100644 --- a/src/plots/polar/layout_attributes.js +++ b/src/plots/polar/layout_attributes.js @@ -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).' diff --git a/src/plots/polar/layout_defaults.js b/src/plots/polar/layout_defaults.js index ddfff41ac7e..19bf636326a 100644 --- a/src/plots/polar/layout_defaults.js +++ b/src/plots/polar/layout_defaults.js @@ -179,7 +179,7 @@ function handleDefaults(contIn, contOut, coerce, opts) { } if(contOut.angularaxis.type === 'category') { - coerce('usepolygons'); + coerce('gridshape'); } } diff --git a/src/plots/polar/polar.js b/src/plots/polar/polar.js index ebb32681efd..57330f91435 100644 --- a/src/plots/polar/polar.js +++ b/src/plots/polar/polar.js @@ -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), @@ -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'); } diff --git a/test/image/mocks/polar_polygon-grids.json b/test/image/mocks/polar_polygon-grids.json index e260257176a..749794c17d7 100644 --- a/test/image/mocks/polar_polygon-grids.json +++ b/test/image/mocks/polar_polygon-grids.json @@ -42,7 +42,7 @@ ], "layout": { "polar": { - "usepolygons": true, + "gridshape": "linear", "domain": { "x": [0, 0.46], "y": [0.56, 1] @@ -57,7 +57,7 @@ } }, "polar2": { - "usepolygons": true, + "gridshape": "linear", "domain": { "x": [0, 0.46], "y": [0, 0.44] @@ -67,7 +67,7 @@ } }, "polar3": { - "usepolygons": true, + "gridshape": "linear", "domain": { "x": [0.54, 1], "y": [0.56, 1] @@ -83,7 +83,7 @@ } }, "polar4": { - "usepolygons": true, + "gridshape": "linear", "bgcolor": "#d3d3d3", "domain": { "x": [0.54, 1],