-
Notifications
You must be signed in to change notification settings - Fork 25
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
time labels are offset #39
Comments
Thanks @djh42 I think it might be possible to do what your looking for by adjusting the value here to align:left: https://github.com/emoncms/graph/blob/master/graph.js#L689, the graph module would likely need an option to be user settable. |
Thanks @TrystanLea. Can I just edit the graph.js file to experiment or do I need to build something? |
@TrystanLea, I've been looking but I still don't understand. I found I can just edit the .js so that's fine. But I don't understand your suggestion. The line you pointed at is: 'plotdata.push(plot);' and I don't see what that has to do with time tick alignment. I've looked at the flot docs and there doesn't seem to be anything there about options for label alignment, so I'm a bit lost on helping myself. |
Actually at the time he posted Line 689 was
it is currently line 687 due to a commit Trystan made after he posted the link but before you followed said link, that commit added 2 line of code pushing line 689 back to 687. This is the pitfall of pointing to a line in "master" as master is always changing. for the link to be (always) useful it should point to a line at a specific point in time either by released version or by commit number, ie the link should have been https://github.com/emoncms/graph/blob/1.2.1/graph.js#L689. |
Ah thanks @pb66 that makes it clearer. It still doesn't help me I'm afraid, because that line is using flot options described at https://github.com/flot/flot/blob/master/API.md#customizing-the-data-series whereas I would need https://github.com/flot/flot/blob/master/API.md#customizing-the-axes or https://github.com/flot/flot/blob/master/API.md#time-series-data but none of those allow for the possibility. I think I may be getting some way to resolving the problem, but I still have to learn some more first. Just to be clear, the problem is that time series ticks can be of two fundamentally different types. Those that include a time describe a particular instant or epoch and are appropriately aligned below the grid line/tick. But those that don't include a time, and just express a date, describe an interval, not an instant. So they are more appropriately aligned with the centre of the interval, or at least to the correct side of the tick so they are under the interval. |
OK, so I have a fix for this. The problem is actually in flot rather than the graph module but here are the three lines that need inserting to get my desired behaviour:
|
sounds like you need to raise an issue here then: There seems to be activity there, so I am sure they would appreciate/consider a PR |
Ah, excellent. It seems the project has sparked back into life. I've created issue #1608 |
Shouldn't this stay open until flot #1608 is resolved or some other solution is found? |
Sorry, I assumed since the issue was with Flot rather than Emoncms this issue could be closed. In retrospect, I can see there is a good reason to keep it open. Apologies, I will past the full link to the Flot issue so the two issues will be referenced together: flot/flot#1608 |
You're looking at an image where the labels should be centred, since they reference a point in time. If you look at the other image I posted, where the labels refer to a period (a whole day), you can see I've modified it so the labels are NOT centred, to make it clear which interval the label belongs to. In unmodified code labels are always centred, which is ambiguous. |
The time labels are sometimes placed in the wrong place. I don't know under what conditions it occurs, but I've attached an example. The vertical lines mark the day boundaries and the labels are ambiguously centred below them. It would make more sense if they had their left hand edges aligned with the vertical lines, or if they were centred in the interval that represents the day the label describes.
Hmm, github won't let me attach a FF screenshot png showing the problem, sorry. 'Something went really wrong, and we can't process that file'. Anyway it's just a weekly graph of any data item - it's always the same.
The text was updated successfully, but these errors were encountered: