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

Time chart support? #4

Closed
benmccann opened this issue Feb 13, 2019 · 9 comments
Closed

Time chart support? #4

benmccann opened this issue Feb 13, 2019 · 9 comments

Comments

@benmccann
Copy link

I noticed that the samples are all linear axes. Does it work on time charts? The README doesn't say

@AbelHeinsbroek
Copy link
Owner

I does! I'm planning to add a time series example with zoom and dynamic load (for example stocks data) to the samples, for now you can find a working example on another project I'm working on:

https://vitens.github.io/pi-vue/charting.html#basic-charts

@benmccann
Copy link
Author

That's great. The reason I was asking is because I'm working on https://github.com/chartjs/chartjs-chart-financial and thought this could be good plugin to use with it

@AbelHeinsbroek
Copy link
Owner

It seems to work ok, with some changes to the crosshair-plugin:

https://www.abelheinsbroek.nl/financial/

One issue I ran into is that scatter and line charts work with data.x to position data on the x axis, whereas your plugin uses data.t instead. Is there a specific reason for doing this?

Currently the plugin only works for scatter and line charts, I should change that to work for all charts with an Linear or Time x-axis.

@benmccann
Copy link
Author

Very cool! I love it!

t is a more common way to express time than x, so the time scale supports input as t or x. If instead of doing data.x you do scale.getRightValue(data) it will work with t or x

@Dasheel
Copy link

Dasheel commented Dec 3, 2019

News about this?

@Dasheel
Copy link

Dasheel commented Dec 4, 2019

I got the crosshair plugin to work with the financial plugin by changing this line (xScaleType !== 'linear' && xScaleType !== 'time') to (xScaleType !== 'linear' && xScaleType !== 'time' && xScaleType !== 'realtime')) twice.
@AbelHeinsbroek can i see the source code of https://www.abelheinsbroek.nl/financial/ because i have problem with zoom. Thanks

@AbelHeinsbroek
Copy link
Owner

You can right click and press view source on any webpage to view the source.

This file is what you're looking for I guess:

https://www.abelheinsbroek.nl/financial/index.js

@benmccann
Copy link
Author

Adding xScaleType !== 'realtime' I believe would be adding support for the streaming plugin: https://github.com/nagix/chartjs-plugin-streaming/blob/master/src/scales/scale.realtime.js

@Dasheel
Copy link

Dasheel commented Dec 5, 2019

Adding xScaleType !== 'realtime' I believe would be adding support for the streaming plugin: https://github.com/nagix/chartjs-plugin-streaming/blob/master/src/scales/scale.realtime.js

Yes, adding this line would make the crosshair plugin support the streaming plugin but not for the crosshair zoom, maybe beacuse when you add the streaming plugin some of the axis option are ignored (time.max, time.min)

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

3 participants