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

Support for 24 hour time format #3542

Closed
upsteer opened this issue Feb 13, 2020 · 2 comments
Closed

Support for 24 hour time format #3542

upsteer opened this issue Feb 13, 2020 · 2 comments

Comments

@upsteer
Copy link

upsteer commented Feb 13, 2020

We have a situation with plottable.

Bug report

Steps to repro:

  1. Create any chart with time axis.
  2. Create a custom formatter for the time axis.
  3. The formatter doesn't work for the time axis.

Expected behavior

The formatter should work for the time axis.

Actual behavior

The formatter for the time axis is completely avoided when formatting the time axis.

Possible Solution

This could have been caused by the Time._DEFAULT_TIME_AXIS_CONFIGURATIONS
Since it only takes the default values, I would only like to have a variable so that the configs could be updated or rather, instead of defining my custom configs, I would simply like to add/modify these DEFAULT CONFIGURATIONS

  • Plottable version: Plottable 1.16.2
  • Browser name/version: Any browser
  • OS name/version: MacOS/Windows
@Sopwafel
Copy link

Sopwafel commented Apr 23, 2020

I stumbled upon this problem too, but I McGyvered a solution:

myTimeAxis.axisConfigurations().forEach(tierConfiguration =>  
      tierConfiguration.forEach(function (row) {
        if(row.interval === "hour" || row.interval === "minute")  
          row.formatter = new Plottable.Formatters.time("%H:%M")  
      })  
 )  

With myTimeAxis being a Plottable.Axes.Time object.
I used http://plottablejs.org/tutorials/time-axes/ and https://github.com/d3/d3-time-format/blob/v2.2.3/README.md#isoFormat.

@upsteer
Copy link
Author

upsteer commented May 7, 2020

Thank you, that worked wonders!

@upsteer upsteer closed this as completed May 7, 2020
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

No branches or pull requests

2 participants