Home Forums Chart Support How to make a vertical bar graph with horizontally draggable bars?

How to make a vertical bar graph with horizontally draggable bars?

Viewing 9 posts - 1 through 9 (of 9 total)
  • #32015

    Hello! I was wondering, could you please link me to a CanvasJS fiddle that shows a vertical bar graph with columns that the user can click on and drag horizontally? I have seen your posts for horizontally bars graphs that can be dragged left to right, and vertical bar graphs that can be dragged up and down, but I need a combination of both: a vertical bar graph whose columns can be dragged left and right. I need to do this in my React.js version of CanvasJS. Thanks, I love your technology!

    #32047

    @mepc36,

    It is not possible to drag column chart horizontally as of now. However, you can use Error chart to achieve the above requirement. Please take a look at this JSFiddle for an example.

    ___________
    Indranil Deo
    Team CanvasJS

    #32057

    Hi Idranil! Thanks for your help…however, that Fiddle does not do what I need. I need the column at 10 to move left or right to 12 or 8, but all that Fiddle does is make the column thicker, so that it overlaps with 8 and 12. I need to move the whole column to the left, not just make it wider.

    Is that possible?

    #32079

    @mepc36,

    Please take a look at this JSFiddle.

    ___________
    Indranil Deo
    Team CanvasJS

    #32081

    Hey Indranil! This looks great. There seems to be one small bug though — the columns get really thin and then really wide whenever the column you’re dragging overlaps with its first neighbor to the left or right. Is there any way to prevent that?

    Thanks!

    #32114

    @mepc36,

    Width of columns / datapoints depends on multiple factors like width of the chart, number of dataPoints within the viewport, value difference between the consecutive dataPoints, etc. As dataPoints are dragged to reposition it, dataPoint’s x-value gets updated which in turn changes the value difference between its neighboring dataPoints. Hence width of dataPoints / columns are getting updated when you reposition the column. However, you can fix the width of the column / dataPoint by setting dataPointWidth property.

    ___________
    Indranil Deo
    Team CanvasJS

    #32115

    Oh great, thanks! Do you mind please updating that Fiddle you just sent me with a fixed dataPointWidth property, please? I’d really appreciate it Indranil!

    #32124

    @mepc36,

    Please take a look at this updated JSFiddle.

    ___________
    Indranil Deo
    Team CanvasJS

    #32130

    Great, thanks Indranil! I appreciate it.

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.