Skip to content

Commit

Permalink
Pie chart now expands better when legend hidden at small sizes.
Browse files Browse the repository at this point in the history
Revert file wrongly committed.
  • Loading branch information
michelezanda committed May 18, 2020
1 parent 75481ed commit ad43b10
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 23 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG_ION.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# plotly.js ION changelog

## [1.33.1-ion37] -- 2020-05-18

### Reverted file committed wrongly.


## [1.33.1-ion36] -- 2020-05-18

### Vertical legend in pie chart sizing caused call stack exception.
Expand Down
17 changes: 6 additions & 11 deletions dist_ion/plotly-ion.js
Original file line number Diff line number Diff line change
Expand Up @@ -25065,7 +25065,7 @@ module.exports = function draw(gd) {
// result in covering the chart
if((opts.orientation === "v" && opts.width > fullLayout.width * 0.45 && !fullLayout._hasPie) ||
(opts.orientation === "v" && opts.width > fullLayout.width * 0.5 && fullLayout._hasPie) ||
(opts.orientation === "h" && opts.height > fullLayout.height * 0.4) ||
(opts.orientation === "h" && opts.height > fullLayout.height * 0.38) ||
( (opts.xanchor !== 'left' && opts.xanchor !== 'right') && opts.orientation === "v" && opts.height > fullLayout.height * 0.4) ) {
fullLayout._infolayer.selectAll('.legend').remove();
fullLayout._topdefs.select('#' + clipId).remove();
Expand Down Expand Up @@ -32811,7 +32811,7 @@ exports.svgAttrs = {
var Plotly = require('./plotly');

// package version injected by `npm run preprocess`
exports.version = '1.33.1-ion36';
exports.version = '1.33.1-ion37';

// inject promise polyfill
require('es6-promise').polyfill();
Expand Down Expand Up @@ -33104,7 +33104,7 @@ exports.valObjectMeta = {
},
colorlist: {


requiredOpts: [],

coerceFunction: function(v, propOut, dflt) {
function isColor(color) {
Expand Down Expand Up @@ -54825,7 +54825,7 @@ module.exports = overrideAll({
showcountries: {
valType: 'boolean',


description: 'Sets whether or not country boundaries are drawn.'
},
countrycolor: {
valType: 'color',
Expand Down Expand Up @@ -57691,7 +57691,7 @@ plots.autoMargin = function(gd, id, o) {
// if the item is too big, just give it enough automargin to
// make sure you can still grab it and bring it back
if(o.l + o.r > fullLayout.width * 0.45) o.l = o.r = 0;
if(o.b + o.t > fullLayout.height * 0.4) o.b = o.t = 0;
if(o.b + o.t > fullLayout.height * 0.38) o.b = o.t = 0;

fullLayout._pushmargin[id] = {
l: {val: o.x, size: o.l + pad},
Expand Down Expand Up @@ -67884,12 +67884,7 @@ function scalePies(cdpie, plotSize) {

cd0.r = Math.min(pieBoxWidth, pieBoxHeight) / (2 + 2 * maxPull);

if (cdpie.length === 1) {
cd0.cx = plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;
} else {
cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;
}

cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;
cd0.cy = plotSize.t + plotSize.h * (2 - trace.domain.y[1] - trace.domain.y[0]) / 2;

if(trace.scalegroup && scaleGroups.indexOf(trace.scalegroup) === -1) {
Expand Down
2 changes: 1 addition & 1 deletion dist_ion/plotly-ion.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotly.js",
"version": "1.33.1-ion36",
"version": "1.33.1-ion37",
"description": "The open source javascript graphing library that powers plotly",
"license": "MIT",
"main": "./lib/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/assets/geo_assets.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ var saneTopojson = require('sane-topojson');


// package version injected by `npm run preprocess`
exports.version = '1.33.1-ion36';exports.topojson = saneTopojson;
exports.version = '1.33.1-ion37';exports.topojson = saneTopojson;
2 changes: 1 addition & 1 deletion src/components/legend/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ module.exports = function draw(gd) {
// result in covering the chart
if((opts.orientation === "v" && opts.width > fullLayout.width * 0.45 && !fullLayout._hasPie) ||
(opts.orientation === "v" && opts.width > fullLayout.width * 0.5 && fullLayout._hasPie) ||
(opts.orientation === "h" && opts.height > fullLayout.height * 0.4) ||
(opts.orientation === "h" && opts.height > fullLayout.height * 0.38) ||
( (opts.xanchor !== 'left' && opts.xanchor !== 'right') && opts.orientation === "v" && opts.height > fullLayout.height * 0.4) ) {
fullLayout._infolayer.selectAll('.legend').remove();
fullLayout._topdefs.select('#' + clipId).remove();
Expand Down
2 changes: 1 addition & 1 deletion src/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
var Plotly = require('./plotly');

// package version injected by `npm run preprocess`
exports.version = '1.33.1-ion36';
exports.version = '1.33.1-ion37';

// inject promise polyfill
require('es6-promise').polyfill();
Expand Down
2 changes: 1 addition & 1 deletion src/plots/plots.js
Original file line number Diff line number Diff line change
Expand Up @@ -1549,7 +1549,7 @@ plots.autoMargin = function(gd, id, o) {
// if the item is too big, just give it enough automargin to
// make sure you can still grab it and bring it back
if(o.l + o.r > fullLayout.width * 0.45) o.l = o.r = 0;
if(o.b + o.t > fullLayout.height * 0.4) o.b = o.t = 0;
if(o.b + o.t > fullLayout.height * 0.38) o.b = o.t = 0;

fullLayout._pushmargin[id] = {
l: {val: o.x, size: o.l + pad},
Expand Down
7 changes: 1 addition & 6 deletions src/traces/pie/plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -592,12 +592,7 @@ function scalePies(cdpie, plotSize) {

cd0.r = Math.min(pieBoxWidth, pieBoxHeight) / (2 + 2 * maxPull);

if (cdpie.length === 1) {
cd0.cx = plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;
} else {
cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;
}

cd0.cx = plotSize.l + plotSize.w * (trace.domain.x[1] + trace.domain.x[0]) / 2;
cd0.cy = plotSize.t + plotSize.h * (2 - trace.domain.y[1] - trace.domain.y[0]) / 2;

if(trace.scalegroup && scaleGroups.indexOf(trace.scalegroup) === -1) {
Expand Down

0 comments on commit ad43b10

Please sign in to comment.