-
-
Notifications
You must be signed in to change notification settings - Fork 6k
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
xValues on X-Axis for non-continuous dates #2398
Comments
If this is the case, you can just creating a mapping that maps [0,1,2,...,n] as xVals to your date strings and no blanks, e.g. 0 for Jan 1, 1 for Jan 3, 2 for Feb 28, etc. Am I missing anything? |
I had thought of that, but that would mean that suddenly, the configuration of the axis, that is probably better as being independent from the data itself, would suddenly become tied to it. Now to make this work, this would mean that I would have to put a formatter that would need to know about the data, and be updated each and every time the data changes, which seems prone to problems, and blurs the line between the data and the chart configuration. So yes, it should work, but it means reworking my code quite a bit because data and configuration were quite clearly separated (which I will do to try and make it work for now), as they were on the Charts side (configuration was once and for all, data was dynamic and changing), and it doesn't feel like a formatter should know that "10" means "03/04/16". Wouldn't you agree that may reveal that something is just missing on the side of Charts (even though you can hack around it)? |
On one side, the library is not perfect and lots of things to improve, and need your help, if you are able to pull a request for the standard cases you mentioned. But the axis is always tied to data I think, because it needs to know the range and what label you want to display, and needs to calculate the width/height to make sure it looks good. To your question, I don't have you project, but having an array that's holding all of the date strings, does not mean Basically, the new x axis behaves like y axis now, so it's very different now. We think make x axis behaves like y axis gives more flexibility. |
Has there been any developments on the concerns raised by this issue? I'm also implementing financial charts and ran into the exact same issue as described by @kettch. (ping @liuxuan30) |
no, you have to figure out a way that suits you. |
I've been trying to migrate to Charts 3.0, but I'm running into trouble with a candle stick chart. I'm rendering candle sticks that match days of the week (with sometimes some days even missing), as any financial chart for a stock is usually rendered. With the previous version of Charts, here's what I was doing:
That way, I could have a chart with one candle per x index, with correct dates displayed as I wanted them. All is good...
Unfortunately, now with Charts 3.0, those xValues have disappeared, and I can only give a double value, using a formatter to display the date as I want it. I found a few issues here on this topic, but unfortunately, all of them assume that you either have continuous data or that you want to interpolate or leave blanks in between, which is not the case here.
So, to sum it up:
Taking the candle stick sample as an example, the first screen would be what I would get with time intervals as X values, while the second one will be using straight and continuous indices (imagining there are dates to be displayed, too):
Is there a way I'm missing that would allow for proper dates and an X-axis without blanks, or is that something that is just not possible and should be considered a bug?
The text was updated successfully, but these errors were encountered: