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

Date Format issue #552

Open
patterson opened this issue Sep 11, 2018 · 4 comments
Open

Date Format issue #552

patterson opened this issue Sep 11, 2018 · 4 comments

Comments

@patterson
Copy link

I'm having trouble getting the date formatting to to work in the latest version of Taucharts. Here is my configuration:
{ "type": "stacked-bar", "x": "date", "y": "activites", "color": "activityGroup", "guide": { "x": { "autoScale": true, "nice": true, "tickFormat": "%d-%b-%y" } } }

Here is my data:
[{ "activityGroup": "Growth Personal", "activites": 1, "value": 2, "date": "2018-08-02 21:29:14" }, { "activityGroup": "Growth Personal", "activites": 2, "value": 4, "date": "2018-08-02 21:29:14" }]

I get the following error:
image

@Mavrin
Copy link
Contributor

Mavrin commented Sep 12, 2018

Taucharts does not attempt to detect the type of data. You need to cast string to date type explicitly for date field.
It should be something like this:

const data = [{ "activityGroup": "Growth Personal", "activites": 1, "value": 2, "date": new  Date("2018-08-02 21:29:14")}]

@patterson
Copy link
Author

Thank you, that solved my issue with the Javascript error.

@Mavrin
Copy link
Contributor

Mavrin commented Sep 13, 2018

@patterson. It is strange. I need some time for investigate this issue. Could you try to make https://jsfiddle.net/taucharts/c5806yeg/33/
I just remove time from Day and convert it to string.
Some docs which can be useful
https://api.taucharts.com/datasource/#time-based-dimensions
https://api.taucharts.com/basic/guide.html#tickperiod

@patterson
Copy link
Author

patterson commented Sep 13, 2018

I was able to fix it by adding a tickPeriod to the guide.

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