chartjs-plugin-zoom icon indicating copy to clipboard operation
chartjs-plugin-zoom copied to clipboard

Zoom continuous Bar Chart

Open blurry-code opened this issue 10 years ago • 10 comments

Hi there,

I'm using chart.zoom.js in an ionic application. Zooming and panning works great on line charts. Thanks for that! But now I need a bar chart that has no borders.

This works great until I zoom in. Zooming in creates space between the bars. Is there a way to keep the bars connected when zoomed in?

blurry-code avatar Oct 12 '16 09:10 blurry-code

@blurry-code this would likely be hard to implement.

The best bet you would have is if categorySpace and barSpacing are set to 1.0 in your config. Without a fiddle or other test case I can't really speculate further

etimberg avatar Oct 13 '16 02:10 etimberg

Sorry, this is my first jsfiddle and I cannot get the chart.zoom working. But here is a simplified version of my bar chart which I am trying to zoom in without gaps appearing in between the bars.

http://jsfiddle.net/blurry_code/k4du61x8/

In this fiddle http://jsfiddle.net/blurry_code/k1b2bnvo/ I tried to get the xAxis working with dates since this is closer to my actual use-case. But I cannot get it to work in jsfiddle (unlike in my app)

blue

blurry-code avatar Oct 13 '16 08:10 blurry-code

I think part of the problem is loading the files from GitHub which might not have the correct headers

etimberg avatar Oct 14 '16 11:10 etimberg

Is there another way to load Zoom.Chart.JS in the fiddle?

blurry-code avatar Oct 14 '16 11:10 blurry-code

this should do it https://npmcdn.com/Chart.Zoom.js

etimberg avatar Oct 14 '16 21:10 etimberg

@blurry-code you need to replace the URLs for your external resources with URLs from https://cdnjs.com/ or http://rawgit.com/. If you're still having an issue, please post a fixed jsfiddle link and we will reopen this.

compwright avatar Nov 17 '16 19:11 compwright

I didn't open this thread so I could to learn on how make a working fiddle - many thanks though for the help - but rather because I got a problem with zooming. This problem is still unsolved.

I updated the first fiddle (http://jsfiddle.net/blurry_code/k4du61x8/) so as you zoom in (scroll up with the mouse hovering above the chart) you will see that the bars are keeping their width and gaps appear inbetween the bars.

The desired behavior would be that the bars stay connected even when zooming in on them.

blurry-code avatar Nov 21 '16 15:11 blurry-code

Thanks for the updated jsfiddle.

compwright avatar Nov 21 '16 15:11 compwright

Hello! I have the same issue, where when you zoom in on a bar chart, the bars are not rendered as they would if that were the original zoom level. Consider this Codepen which is based off of the zoom-time sample. Click and drag to zoom in to see how the bars adversely maintain the original widths. I would expect it to resize, respecting the settings for widths, spacing, etc. in my config. This is the one thing holding me back from deploying this wonderful extension to my app! Thanks for all you do :)

MusikAnimal avatar Jan 03 '17 03:01 MusikAnimal

The original issue does not happen with Chart.js v3 + zoom v1 (both beta) https://jsfiddle.net/p1jm86we/

kurkle avatar Mar 08 '21 21:03 kurkle