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

Serious issue on time scaling bar data with x/y coordinates #3107

Closed
Montrazul opened this issue Aug 7, 2016 · 9 comments
Closed

Serious issue on time scaling bar data with x/y coordinates #3107

Montrazul opened this issue Aug 7, 2016 · 9 comments

Comments

@Montrazul
Copy link

I wanted to create a combined chart containing line data and bar data which are both independent from each other and are providing data to set with x/y coordinates in a time scale.

Here is the current solution in a js fiddle:

[https://jsfiddle.net/av15kuwj/6/](combined chart with line %28x/y%29 and bar only y)

As you can see for the line data i provided a x and y value for each entry. Now i wanted to do the same for the bar data:

[https://jsfiddle.net/o7Lk1m0n/1/](combined chart with line %28x/y%29 and bar %28x/y%29)

As you can see the bar data now isnt even showing up. What i need to do is to have a chart showing to completely independent datasets, one line dataset and one bar dataset in a time scale and i need to be able to define their positions by providing x and y coordinates.

@etimberg
Copy link
Member

etimberg commented Aug 7, 2016

@Montrazul using an { x: , y: } data syntax is not supported for bars. Further, bars on time axes have sizing issues so if this worked you would not get the result you want.

@Montrazul
Copy link
Author

So there is no possibility to display independent datasets in a combined line and bar data chart?

@etimberg
Copy link
Member

etimberg commented Aug 7, 2016

that is not currently possible

@AlexeiDarmin
Copy link

+1 for this feature, trying to make something along the lines of a price/volume chart like in Google Finance and noticed that the bars don't line up.

If one were to submit a PR for this functionality, would it have to be backwards compatible with the current data : Array<Number> implementation of bars? Also it may conflict with other ongoing issues such as #2323 which should affect how the bars are drawn and resized in the future.

@etimberg
Copy link
Member

etimberg commented Aug 9, 2016

@AlexDar it does not necessarily need to be backwards compatible with an array of numbers. I agree that it might affect the other bar sizing issues. Maybe we should tackle those first

@AlexeiDarmin
Copy link

@etimberg agreed.

Is there any temporary work around that could achieve this effect with a line graph that has multiple datasets?

I'm trying combinations of stepped, showLine, spanGaps, fill to create a discrete disconnected graph of points whereby the fill property would create a bar (failing here). Since they're stacked line charts they align on the x-axis, and perhaps the width of the bar could also be set to look more like a bar.

However I've failed to create the discrete points with a working fill beneath them.

I'm not proficient in canvas but I imagine there must be an 'area' to fill, therefore if it's even possible to convert the line into a discrete set of points, then there would be no area to fill unless each point created a vertical line along the y-axis.

@etimberg
Copy link
Member

etimberg commented Aug 9, 2016

When we fill the line, we automatically go down to the baseline of the chart when spanGaps == false. You could make a 'bar' with 2 points, one for each corner and then an NaN value inbetween. This might have the effect you are looking for. I don't know how the tooltips would work though

@benmccann
Copy link
Contributor

@Montrazul bar chart on a time scale should work well with the release of 2.7. Can you check out the latest version and see if it works for you?

Here's a sample: http://www.chartjs.org/samples/latest/scales/time/financial.html

@benmccann
Copy link
Contributor

I'm closing this as fixed in 2.7. Please feel free to reopen if you don't think it's addressed yet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants