Skip to content

Commit

Permalink
tag 1.25.0-d37
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Burato committed Apr 13, 2017
1 parent 79870a4 commit e6d5a74
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 33 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ https://github.com/plotly/plotly.js/compare/vX.Y.Z...master
where X.Y.Z is the semver of most recent plotly.js release.


## [1.25.0-d37] -- 2017-04-13

### Added
- Legend labels now have a basic ellipsis (> 20 chars).
- Legend is automatically hidden when it overlaps drawing


## [1.25.0-d36] -- 2017-03-23

### Added
Expand Down
35 changes: 28 additions & 7 deletions dist/plotly-ion.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* plotly.js (ion) v1.25.0-d36
* plotly.js (ion) v1.25.0-d37
* Copyright 2012-2017, Plotly, Inc.
* All rights reserved.
* Licensed under the MIT license
Expand Down Expand Up @@ -14371,7 +14371,7 @@ function drawOne(gd, index) {
});

if (options.classes) {
anngroup.classed(options.classes, true);
annGroup.classed(options.classes, true);
}

// another group for text+background so that they can rotate together
Expand Down Expand Up @@ -19813,6 +19813,17 @@ module.exports = function draw(gd) {

computeLegendDimensions(gd, groups, traces);

// aburato: HIDE the legend if it's too big and would
// result in covering the chart

if((opts.orientation === "v" && opts.width > fullLayout.width * 0.45) || (opts.orientation === "h" && opts.height > fullLayout.height * 0.45)) {
fullLayout._infolayer.selectAll('.legend').remove();
fullLayout._topdefs.select('#' + clipId).remove();

//Plots.autoMargin(gd, 'legend');
return;
}

if(opts.height > lyMax) {
// If the legend doesn't fit in the plot area,
// do not expand the vertical margins.
Expand Down Expand Up @@ -20038,9 +20049,19 @@ function drawTexts(g, gd) {
traceIndex = trace.index,
name = isPie ? legendItem.label : trace.name;

var maxCharLength = 20;
var drawnText = name;
if (name.length > maxCharLength) {
var firstLen = Math.floor(maxCharLength / 2);
var lastLen = maxCharLength - firstLen - 1;
drawnText = drawnText.substr(0, firstLen) + '…' + drawnText.substr(-lastLen);
}

var text = g.selectAll('text.legendtext')
.data([0]);
text.enter().append('text').classed('legendtext', true);
var thisG = text.enter();
thisG.append("title").text(name);
thisG.append('text').classed('legendtext', true);
text.attr({
x: 40,
y: 0,
Expand All @@ -20049,7 +20070,7 @@ function drawTexts(g, gd) {
.style('text-anchor', 'start')
.classed('user-select-none', true)
.call(Drawing.font, fullLayout.legend.font)
.text(name);
.text(drawnText);

function textLayout(s) {
svgTextUtils.convertToTspans(s, function() {
Expand Down Expand Up @@ -27133,7 +27154,7 @@ exports.svgAttrs = {
var Plotly = require('./plotly');

// package version injected by `npm run preprocess`
exports.version = '1.25.0-d36';
exports.version = '1.25.0-d37';

// inject promise polyfill
require('es6-promise').polyfill();
Expand Down Expand Up @@ -48657,8 +48678,8 @@ 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.5) o.l = o.r = 0;
if(o.b + o.t > fullLayout.height * 0.5) o.b = o.t = 0;
if(o.l + o.r > fullLayout.width * 0.45) o.l = o.r = 0;
if(o.b + o.t > fullLayout.height * 0.45) o.b = o.t = 0;

fullLayout._pushmargin[id] = {
l: {val: o.x, size: o.l + pad},
Expand Down
46 changes: 23 additions & 23 deletions dist/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.25.0-d36",
"version": "1.25.0-d37",
"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,6 +12,6 @@ var saneTopojson = require('sane-topojson');


// package version injected by `npm run preprocess`
exports.version = '1.25.0-d36';
exports.version = '1.25.0-d37';

exports.topojson = saneTopojson;
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.25.0-d36';
exports.version = '1.25.0-d37';

// inject promise polyfill
require('es6-promise').polyfill();
Expand Down

0 comments on commit e6d5a74

Please sign in to comment.