-
-
Notifications
You must be signed in to change notification settings - Fork 393
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 Question #319
Comments
yeah, sorry. the config format got expanded to be more flexible and to support more contextual refinement. you'll need to tweak your settings slightly. take a look at #299, #303, and the full default array in https://github.com/leeoniya/uPlot/tree/master/docs#axis--grid-opts |
going to close this as resolved. let me know if you have any issues. |
For reference: it seems this can't be an array anymore but needs to be a function. So I used: |
@kjyv not sure what you mean. can you provide an example that doesnt work? this works for me: EDIT: never mind, it works correctly if the timestamps are in seconds instead of millis. copy/pasted wrong thing. https://jsfiddle.net/omc8wx47/1/ const opts = {
width: 800,
height: 400,
axes: [
{
values: [
[31536000, "{YYYY}", null, null, null, null, null, null, 1],
[ 2419200, "{MMM}", "\n{YYYY}", null, null, null, null, null, 1],
[ 86400, "{M}/{D}", "\n{YYYY}", null, null, null, null, null, 1],
[ 3600, "{h}{aa}", "\n{M}/{D}/{YY}", null, "\n{M}/{D}", null, null, null, 1],
[ 60, "{h}:{mm}{aa}", "\n{M}/{D}/{YY}", null, "\n{M}/{D}", null, null, null, 1],
[ 1, ":{ss}", "\n{M}/{D}/{YY} {h}:{mm}{aa}", null, "\n{M}/{D} {h}:{mm}{aa}", null, "\n{h}:{mm}{aa}", null, 1],
[ 0.001, ":{ss}.{fff}", "\n{M}/{D}/{YY} {h}:{mm}{aa}", null, "\n{M}/{D} {h}:{mm}{aa}", null, "\n{h}:{mm}{aa}", null, 1],
]
}
],
series: [
{},
{
stroke: 'blue',
},
],
};
let data = [
[0, 1672531200],
[1, 2],
];
let plot1 = new uPlot(opts, data, document.body); |
Hey, sorry for taking a bit of time to answer. Your jsfiddle obviously works, so something must different in my case.
and I'm using
|
maybe your timestamps are in i really dont feel like guessing through what may be wrong from code snippets and pasted console errors. please make a fiddle that fails in the way you describe. |
Sure, I understand it's a bit annoying this way. I was actually meaning to but jsfiddle didn't load for me yesterday. I don't really need to supply the values in this format, it works fine with a function for my use case. So please also consider that I'm just reporting this in order so you can maybe find a bug, in case there is one. So here is a repro case: https://jsfiddle.net/y9sr1fgn/4/ I guess if possible, showing a better error message if the format string is invalid might help. |
I tried to rewrite the date format like this.
https://jsfiddle.net/STien/kdf6jnzm/1/
In version 1.1.0, first x element will show the correct date and {HH}:{mm}.
But in the newest version, didn't show the date but get extra '4' after {HH}:{mm}.
How can I fix it?
The text was updated successfully, but these errors were encountered: