Skip to content

Commit

Permalink
- Aligned to 1.20.1
Browse files Browse the repository at this point in the history
- Fixed: overrideColorDefaults should not assume that Plotly.Color is exported.
  • Loading branch information
Alessandro Burato committed Nov 17, 2016
2 parents 953509a + 564f661 commit f68c77d
Show file tree
Hide file tree
Showing 155 changed files with 4,183 additions and 2,365 deletions.
49 changes: 49 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,55 @@ 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.20.1-d25] -- 2016-11-17

### Fixed
- overrideColorDefaults relied on Plotly.Color which is no longer exported.


## [1.20.1] -- 2016-11-16

### Fixed
- Fix annotation positioning on categorical axes [#1155]


## [1.20.0] -- 2016-11-15

### Added
- Allow date string inputs for axis ranges, `tick0`, `dtick`, annotation / image
positions, histogram bins [#1078, #1150]
- Add special `dtick` values for log axes [#1078]
- Add `visible` attribute to annotations, shapes and images items [#1110]
- Expose events on slider start/change/end [#1126]
- Expose event on updatemenu button click [#1128]
- Allow custom transform module to have supply layout default handler [#1122]

### Changed
- Increase `scattergl` precision [#1114]
- Use `topojson-client` to convert topojson to geojson [#1147]

### Fixed
- Fix hover labels for multi-trace `scattergl` graphs (bug introduced in
`1.18.0`) [#1148]
- Fix date format on hover on full hour [#1078]
- Fix bar labels for non-zero `base` values [#1142]
- Scatter colorscale now yield correct colors when cmin and cmax ashow re equal
[#1112]
- Fix `filter` transform for categorical `target` arrays with range operations
[#1120]
- Make sure frames with `null` values clear array containers [#1118]
- Fix animations involving trace `opacity` [#1146]
- Fix fallback for non-animatable trace modules (bug introduced in `1.18.1`)
[#1141]
- Fix race condition in animation resolution when coupled with `relayout`
[#1108]
- Enforce casting requested frame names to strings [#1124]
- `Plotly.animte` no longer breaks when passing `null` frames [#1121]
- `Plotly.PlotSchema.get` now correctly list rangeslider and rangeselector under
`xaxis` only [#1144]
- `Plotly.relayout` correctly updates arbitrary layout attributes [#1133]



## [1.19.2-d24] -- 2016-11-15

Expand Down
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ dependencies:
- npm run cibuild
- npm run pretest
- eval $(node tasks/docker.js setup)
- npm prune && npm ls

test:
override:
Expand Down
46 changes: 23 additions & 23 deletions dist/plotly-cartesian.min.js

Large diffs are not rendered by default.

26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "plotly.js",
"version": "1.19.2-d24",
"version": "1.20.1-d25",
"description": "The open source javascript graphing library that powers plotly",
"license": "MIT",
"main": "./lib/index.js",
Expand All @@ -26,6 +26,7 @@
"header": "node tasks/header.js",
"stats": "node tasks/stats.js",
"build": "npm run preprocess && npm run bundle && npm run header && npm run stats",
"ionbuild": "npm run preprocess && npm run bundle && npm run header",
"cibuild": "npm run preprocess && node tasks/cibundle.js",
"watch": "node tasks/watch.js",
"lint": "eslint --version && eslint . || true",
Expand Down Expand Up @@ -59,18 +60,18 @@
"es6-promise": "^3.0.2",
"fast-isnumeric": "^1.1.1",
"gl-contour2d": "^1.1.2",
"gl-error2d": "^1.2.0",
"gl-error2d": "^1.2.1",
"gl-error3d": "^1.0.0",
"gl-heatmap2d": "^1.0.2",
"gl-line2d": "^1.4.0",
"gl-line2d": "^1.4.1",
"gl-line3d": "^1.1.0",
"gl-mat4": "^1.1.2",
"gl-mesh3d": "^1.2.0",
"gl-plot2d": "^1.2.0",
"gl-plot3d": "^1.5.1",
"gl-pointcloud2d": "^1.0.0",
"gl-scatter2d": "^1.2.0",
"gl-scatter2d-fancy": "^1.2.0",
"gl-scatter2d": "^1.2.2",
"gl-scatter2d-fancy": "^1.2.1",
"gl-scatter3d": "^1.0.4",
"gl-select-box": "^1.0.1",
"gl-shader": "4.2.0",
Expand All @@ -88,21 +89,20 @@
"sane-topojson": "^2.0.0",
"superscript-text": "^1.0.0",
"tinycolor2": "^1.3.0",
"topojson": "^1.6.20",
"topojson-client": "^2.1.0",
"webgl-context": "^2.2.0"
},
"devDependencies": {
"brfs": "^1.4.3",
"browserify": "^13.0.0",
"browserify-transform-tools": "^1.5.1",
"browserify": "^13.1.1",
"browserify-transform-tools": "^1.7.0",
"deep-equal": "^1.0.1",
"ecstatic": "^2.1.0",
"eslint": "^3.5.0",
"eslint": "^3.10.1",
"falafel": "^2.0.0",
"fs-extra": "^0.30.0",
"fs-extra": "^1.0.0",
"fuse.js": "^2.2.0",
"glob": "^7.0.0",
"graceful-fs": "^4.1.10",
"gzip-size": "^3.0.0",
"image-size": "^0.5.0",
"jasmine-core": "^2.4.1",
Expand All @@ -113,14 +113,14 @@
"karma-firefox-launcher": "^1.0.0",
"karma-jasmine": "^1.0.2",
"madge": "^1.4.3",
"node-sass": "^3.4.1",
"node-sass": "^3.12.5",
"npm-link-check": "^1.1.0",
"open": "0.0.5",
"prepend-file": "^1.3.0",
"prettysize": "0.0.3",
"requirejs": "^2.3.1",
"through2": "^2.0.0",
"uglify-js": "^2.6.1",
"uglify-js": "^2.7.4",
"watchify": "^3.7.0",
"xml2js": "^0.4.16"
}
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.19.2-d24';
exports.version = '1.20.1-d25';

exports.topojson = saneTopojson;
86 changes: 39 additions & 47 deletions src/components/annotations/annotation_defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,18 @@ var Axes = require('../../plots/cartesian/axes');
var attributes = require('./attributes');


module.exports = function handleAnnotationDefaults(annIn, fullLayout) {
var annOut = {};
module.exports = function handleAnnotationDefaults(annIn, annOut, fullLayout, opts, itemOpts) {
opts = opts || {};
itemOpts = itemOpts || {};

function coerce(attr, dflt) {
return Lib.coerce(annIn, annOut, attributes, attr, dflt);
}

var visible = coerce('visible', !itemOpts.itemIsNotPlainObject);

if(!visible) return annOut;

coerce('opacity');
coerce('align');
coerce('bgcolor');
Expand All @@ -35,70 +40,57 @@ module.exports = function handleAnnotationDefaults(annIn, fullLayout) {
var borderWidth = coerce('borderwidth');
var showArrow = coerce('showarrow');

if(showArrow) {
coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine);
coerce('arrowhead');
coerce('arrowsize');
coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2);
coerce('ax');
coerce('ay');
coerce('axref');
coerce('ayref');

// if you have one part of arrow length you should have both
Lib.noneOrAll(annIn, annOut, ['ax', 'ay']);
}

coerce('text', showArrow ? ' ' : 'new text');
coerce('textangle');
Lib.coerceFont(coerce, 'font', fullLayout.font);

// positioning
var axLetters = ['x', 'y'];
var axLetters = ['x', 'y'],
arrowPosDflt = [-10, -30],
gdMock = {_fullLayout: fullLayout};
for(var i = 0; i < 2; i++) {
var axLetter = axLetters[i],
tdMock = {_fullLayout: fullLayout};
var axLetter = axLetters[i];

// xref, yref
var axRef = Axes.coerceRef(annIn, annOut, tdMock, axLetter);

// TODO: should be refactored in conjunction with Axes axref, ayref
var aaxRef = Axes.coerceARef(annIn, annOut, tdMock, axLetter);
var axRef = Axes.coerceRef(annIn, annOut, gdMock, axLetter, '', 'paper');

// x, y
var defaultPosition = 0.5;
if(axRef !== 'paper') {
var ax = Axes.getFromId(tdMock, axRef);
defaultPosition = ax.range[0] + defaultPosition * (ax.range[1] - ax.range[0]);

// convert date or category strings to numbers
if(['date', 'category'].indexOf(ax.type) !== -1 &&
typeof annIn[axLetter] === 'string') {
var newval;
if(ax.type === 'date') {
newval = Lib.dateTime2ms(annIn[axLetter]);
if(newval !== false) annIn[axLetter] = newval;

if(aaxRef === axRef) {
var newvalB = Lib.dateTime2ms(annIn['a' + axLetter]);
if(newvalB !== false) annIn['a' + axLetter] = newvalB;
Axes.coercePosition(annOut, gdMock, coerce, axRef, axLetter, 0.5);

if(showArrow) {
var arrowPosAttr = 'a' + axLetter,
// axref, ayref
aaxRef = Axes.coerceRef(annIn, annOut, gdMock, arrowPosAttr, 'pixel');

// for now the arrow can only be on the same axis or specified as pixels
// TODO: sometime it might be interesting to allow it to be on *any* axis
// but that would require updates to drawing & autorange code and maybe more
if(aaxRef !== 'pixel' && aaxRef !== axRef) {
aaxRef = annOut[arrowPosAttr] = 'pixel';
}

// ax, ay
var aDflt = (aaxRef === 'pixel') ? arrowPosDflt[i] : 0.4;
Axes.coercePosition(annOut, gdMock, coerce, aaxRef, arrowPosAttr, aDflt);
}
else if((ax._categories || []).length) {
newval = ax._categories.indexOf(annIn[axLetter]);
if(newval !== -1) annIn[axLetter] = newval;
}
}
}
coerce(axLetter, defaultPosition);

// xanchor, yanchor
if(!showArrow) coerce(axLetter + 'anchor');
else coerce(axLetter + 'anchor');
}

// if you have one coordinate you should have both
Lib.noneOrAll(annIn, annOut, ['x', 'y']);

if(showArrow) {
coerce('arrowcolor', borderOpacity ? annOut.bordercolor : Color.defaultLine);
coerce('arrowhead');
coerce('arrowsize');
coerce('arrowwidth', ((borderOpacity && borderWidth) || 1) * 2);

// if you have one part of arrow length you should have both
Lib.noneOrAll(annIn, annOut, ['ax', 'ay']);
}

if (annIn.classes) {
annOut.classes = annIn.classes;
}
Expand Down
45 changes: 34 additions & 11 deletions src/components/annotations/attributes.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,16 @@ var extendFlat = require('../../lib/extend').extendFlat;


module.exports = {
_isLinkedToArray: true,
_isLinkedToArray: 'annotation',

visible: {
valType: 'boolean',
role: 'info',
dflt: true,
description: [
'Determines whether or not this annotation is visible.'
].join(' ')
},

text: {
valType: 'string',
Expand Down Expand Up @@ -132,27 +141,27 @@ module.exports = {
description: 'Sets the width (in px) of annotation arrow.'
},
ax: {
valType: 'number',
dflt: -10,
valType: 'any',
role: 'info',
description: [
'Sets the x component of the arrow tail about the arrow head.',
'If `axref` is `pixel`, a positive (negative) ',
'component corresponds to an arrow pointing',
'from right to left (left to right).',
'If `axref` is an axis, this is a value on that axis.'
'If `axref` is an axis, this is an absolute value on that axis,',
'like `x`, NOT a relative value.'
].join(' ')
},
ay: {
valType: 'number',
dflt: -30,
valType: 'any',
role: 'info',
description: [
'Sets the y component of the arrow tail about the arrow head.',
'If `ayref` is `pixel`, a positive (negative) ',
'component corresponds to an arrow pointing',
'from bottom to top (top to bottom).',
'If `ayref` is an axis, this is a value on that axis.'
'If `ayref` is an axis, this is an absolute value on that axis,',
'like `y`, NOT a relative value.'
].join(' ')
},
axref: {
Expand Down Expand Up @@ -207,11 +216,18 @@ module.exports = {
].join(' ')
},
x: {
valType: 'number',
valType: 'any',
role: 'info',
description: [
'Sets the annotation\'s x position.',
'Note that dates and categories are converted to numbers.'
'If the axis `type` is *log*, then you must take the',
'log of your desired range.',
'If the axis `type` is *date*, it should be date strings,',
'like date data, though Date objects and unix milliseconds',
'will be accepted and converted to strings.',
'If the axis `type` is *category*, it should be numbers,',
'using the scale where each category is assigned a serial',
'number from zero in the order it appears.'
].join(' ')
},
xanchor: {
Expand Down Expand Up @@ -250,11 +266,18 @@ module.exports = {
].join(' ')
},
y: {
valType: 'number',
valType: 'any',
role: 'info',
description: [
'Sets the annotation\'s y position.',
'Note that dates and categories are converted to numbers.'
'If the axis `type` is *log*, then you must take the',
'log of your desired range.',
'If the axis `type` is *date*, it should be date strings,',
'like date data, though Date objects and unix milliseconds',
'will be accepted and converted to strings.',
'If the axis `type` is *category*, it should be numbers,',
'using the scale where each category is assigned a serial',
'number from zero in the order it appears.'
].join(' ')
},
yanchor: {
Expand Down
6 changes: 3 additions & 3 deletions src/components/annotations/calc_autorange.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var draw = require('./draw').draw;

module.exports = function calcAutorange(gd) {
var fullLayout = gd._fullLayout,
annotationList = fullLayout.annotations;
annotationList = Lib.filterVisible(fullLayout.annotations);

if(!annotationList.length || !gd._fullData.length) return;

Expand Down Expand Up @@ -69,14 +69,14 @@ function annAutorange(gd) {
}

if(xa && xa.autorange) {
Axes.expand(xa, [xa.l2c(ann.x)], {
Axes.expand(xa, [xa.l2c(xa.r2l(ann.x))], {
ppadplus: rightSize,
ppadminus: leftSize
});
}

if(ya && ya.autorange) {
Axes.expand(ya, [ya.l2c(ann.y)], {
Axes.expand(ya, [ya.l2c(ya.r2l(ann.y))], {
ppadplus: bottomSize,
ppadminus: topSize
});
Expand Down
Loading

0 comments on commit f68c77d

Please sign in to comment.