Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dates as dates #1078

Merged
merged 29 commits into from
Nov 10, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
d4bb89d
improve dateTime2ms edge cases and standardize BADNUM and FP_SAFE con…
alexcjohnson Oct 14, 2016
9e27955
switch date axes to use date strings for range and tick0
alexcjohnson Oct 14, 2016
00138aa
Merge branch 'master' into dates-as-dates
alexcjohnson Oct 14, 2016
9784b3b
axe parseDate - moved to streambed
alexcjohnson Oct 15, 2016
1db4448
refactor dates handling to use date strings as much as possible
alexcjohnson Oct 24, 2016
5ff9722
Merge branch 'master' into dates-as-dates
alexcjohnson Oct 24, 2016
c045bc5
wider acceptance range for mapbox plot size test so it works locally
alexcjohnson Oct 25, 2016
3dd294f
fix for range slider tests with new axis range machinery
alexcjohnson Oct 25, 2016
451ee24
fix date axis ranges and date interactions in gl2d
alexcjohnson Oct 25, 2016
9ccde7e
Merge branch 'master' into dates-as-dates
alexcjohnson Oct 26, 2016
51a0563
lib/constants -> constants/numerical
alexcjohnson Oct 26, 2016
5ccd083
td -> gd once and for all
alexcjohnson Oct 26, 2016
e63ea3b
test and fix shape default positioning
alexcjohnson Oct 26, 2016
2e9dbad
fix date and log axis manual tick0/dtick handling
alexcjohnson Oct 28, 2016
37d52fe
fix handling of default tick0 with dtick for date axes
alexcjohnson Oct 28, 2016
55b313c
get rid of '2012-01-22 12h' tick format and smarter date suffix handling
alexcjohnson Oct 29, 2016
b7121c3
fix #1058 - make sure no date ever returns sub-100microsec precision
alexcjohnson Oct 29, 2016
03b4a0c
Merge branch 'master' into dates-as-dates
alexcjohnson Oct 29, 2016
dd0940a
fix _forceTick0 error
alexcjohnson Oct 29, 2016
f629f71
update baseline with new date tick format
alexcjohnson Oct 29, 2016
a29ce33
fix images on date axes, and standardize axis object names
alexcjohnson Nov 9, 2016
065ac8a
fix annotation drag on date axes, and test date/log annotations
alexcjohnson Nov 9, 2016
4a0a866
Merge branch 'master' into dates-as-dates
alexcjohnson Nov 9, 2016
7679483
update jasmine test of annotation visibility & autorange
alexcjohnson Nov 9, 2016
0d61fcc
Merge branch 'master' into dates-as-dates
alexcjohnson Nov 9, 2016
5e11571
merge lint
alexcjohnson Nov 9, 2016
d807259
add ax.r2p and ax.p2r
alexcjohnson Nov 10, 2016
05c762d
date interval milliseconds constants
alexcjohnson Nov 10, 2016
1b0e133
documentation updates
alexcjohnson Nov 10, 2016
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions src/components/images/draw.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,12 +101,12 @@ module.exports = function draw(gd) {
var thisImage = d3.select(this);

// Axes if specified
var xref = Axes.getFromId(gd, d.xref),
yref = Axes.getFromId(gd, d.yref);
var xa = Axes.getFromId(gd, d.xref),
ya = Axes.getFromId(gd, d.yref);

var size = fullLayout._size,
width = xref ? Math.abs(xref.l2p(d.sizex) - xref.l2p(0)) : d.sizex * size.w,
height = yref ? Math.abs(yref.l2p(d.sizey) - yref.l2p(0)) : d.sizey * size.h;
width = xa ? Math.abs(xa.l2p(d.sizex) - xa.l2p(0)) : d.sizex * size.w,
height = ya ? Math.abs(ya.l2p(d.sizey) - ya.l2p(0)) : d.sizey * size.h;

// Offsets for anchor positioning
var xOffset = width * anchors.x[d.xanchor].offset,
Expand All @@ -115,8 +115,8 @@ module.exports = function draw(gd) {
var sizing = anchors.x[d.xanchor].sizing + anchors.y[d.yanchor].sizing;

// Final positions
var xPos = (xref ? xref.l2p(d.x) + xref._offset : d.x * size.w + size.l) + xOffset,
yPos = (yref ? yref.l2p(d.y) + yref._offset : size.h - d.y * size.h + size.t) + yOffset;
var xPos = (xa ? xa.l2p(xa.r2l(d.x)) + xa._offset : d.x * size.w + size.l) + xOffset,
yPos = (ya ? ya.l2p(ya.r2l(d.y)) + ya._offset : size.h - d.y * size.h + size.t) + yOffset;


// Construct the proper aspectRatio attribute
Expand All @@ -141,8 +141,8 @@ module.exports = function draw(gd) {


// Set proper clipping on images
var xId = xref ? xref._id : '',
yId = yref ? yref._id : '',
var xId = xa ? xa._id : '',
yId = ya ? ya._id : '',
clipAxes = xId + yId;

if(clipAxes) {
Expand Down
Binary file modified test/image/baselines/layout_image.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 12 additions & 7 deletions test/image/mocks/layout_image.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,22 @@
"x": [1,2,3],
"y": [1,2,3]
}, {
"x": [1,2,3],
"y": [1,2,3],
"x": ["2001-01-01","2002-01-01","2003-01-01"],
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you're catching on to the reusing existing mocks philosophy. Thanks! Our CI test time will thank you too

"y": [10,100,1000],
"xaxis": "x2",
"yaxis": "y2"
}
],
"layout": {
"xaxis2": {
"anchor": "y2"
},
"yaxis": {
"domain": [0, 0.5]
"domain": [0, 0.45]
},
"yaxis2": {
"domain": [0.5, 1]
"domain": [0.55, 1],
"type": "log"
},
"images": [
{
Expand All @@ -41,11 +46,11 @@
},
{
"source": "https://images.plot.ly/language-icons/api-home/r-logo.png",
"xref": "x",
"xref": "x2",
"yref": "y2",
"x": 1,
"x": "2001-01-01",
"y": 3,
"sizex": 2,
"sizex": 63072000000,
"sizey": 2,
"sizing": "stretch",
"opacity": 0.4,
Expand Down