Skip to content

Fix date handling - #804

Merged
VeraZab merged 4 commits into
masterfrom
date-axis
Dec 12, 2018
Merged

Fix date handling#804
VeraZab merged 4 commits into
masterfrom
date-axis

Conversation

@VeraZab

@VeraZab VeraZab commented Dec 11, 2018

Copy link
Copy Markdown
Contributor

part of #803

  • Adjusts AxesRange and allows to detect when fullValue is date so that proper control shows
  • Create and use NumericOrDate where applicable (there's a larger need for it)
  • Adjust Bin Size to take 'M[number]' format

before
screen shot 2018-12-12 at 12 43 38 pm

after
screen shot 2018-12-12 at 12 44 00 pm

@VeraZab
VeraZab force-pushed the date-axis branch 4 times, most recently from cc6d4ea to 868fa0d Compare December 11, 2018 21:44
@VeraZab VeraZab changed the title Rename AxisRangeValue to NumericOrDate Fix date handling for axes Dec 11, 2018
@VeraZab
VeraZab force-pushed the date-axis branch 3 times, most recently from de6a072 to 537e73f Compare December 12, 2018 16:38
@VeraZab VeraZab changed the title Fix date handling for axes Fix date handling Dec 12, 2018
@VeraZab
VeraZab force-pushed the date-axis branch 3 times, most recently from 986844f to f45f92d Compare December 12, 2018 17:36
@VeraZab

VeraZab commented Dec 12, 2018

Copy link
Copy Markdown
Contributor Author

@nicolaskruchten @dmt0 ready for review I will tackle issue 803 incrementally

Comment thread src/components/fields/derived.js Outdated
Comment thread src/components/fields/NumericOrDate.js
@dmt0

dmt0 commented Dec 12, 2018

Copy link
Copy Markdown
Contributor

💃 for the code

@VeraZab
VeraZab merged commit 74e6d4a into master Dec 12, 2018
@VeraZab
VeraZab deleted the date-axis branch December 12, 2018 19:05
plotProps.fullValue = plotProps.fullValue.substring(1);
plotProps.min = 1;
plotProps.max = 12;
plotProps.units = parseInt(plotProps.fullValue, 10) === 1 ? _('Month') : _('Months');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

does plotly.js accept any other format than M for months? D for days? seconds? I'd be surprised if it was only months :)

@VeraZab VeraZab Dec 13, 2018

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Well actually, from the docs, it does look that months is the only option:
https://plot.ly/javascript/reference/#layout-yaxis-dtick

If the axis `type` is "date", then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. "date" also has special values "M<n>" gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to "2000-01-15" and `dtick` to "M3". To set ticks every 4 years, set `dtick` to "M48"

Either that or time in milliseconds, so I could add a richer widgets that allows to do either milliseconds or months

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Call me "surprised" :)

@nicolaskruchten

Copy link
Copy Markdown
Contributor

Should we actually bake NumericOrDate into AxesRange or just have that derive from NumericOrDate ?

@nicolaskruchten nicolaskruchten mentioned this pull request Jan 3, 2019
6 tasks
@VeraZab VeraZab mentioned this pull request Jan 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants