Home forums Using CanvasJS Change the position of the rectangle that compose the StackedBar

Tagged: ,

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #29350

    Hi everybody, I have create a stackedbar chart composed by 5 quantitative variable where each variable is a rectangle, now my problem is the following: I have to click on a rectangle of a stacked bar, after the click this rectangle have to take the position of the rectangle above it and this must happen in each stacked bar, I thought also to use not the click event but the drag and drop event but i Don’t know how can i do in each case.
    I have to do this in JavaScript and using d3.js.
    If we want the code to understand better tell me.

    • This topic was modified 1 month, 2 weeks ago by Ciere.
    #29364

    @ciere,

    Please take a look at the documentation page for information on Stacked Bar Chart and mousemove event.


    Manoj Mohan
    Team CanvasJS

    #29372

    The stacked bar are the 100% stacked bar chart and each bar is composed by 5 rectangle and I have to change the position of the rectangle in the bar, I’m not sure that mousemove can help me.

    #29396

    @ciere,

    You can swap the dataSeries with the help of click event as shown in this JSFiddle.

    —-
    Manoj Mohan
    Team CanvasJS

    #29404

    Yes, but this code only change the dimension of the rectangle after the click, what I want is that after the click on one rectangle changes the position with the rectangle above it, in you example the rectangle red change the position with the rectangle blu
    Thank you for the answer.

    #29419

    @ciere,

    Please take a look at this updated JSFiddle.

    —-
    Manoj Mohan
    Team CanvasJS

    #29436

    Perfect, it’s what I wanted, thank you. Other question, this logic use for your code is usable with d3.js?

    #29446

    @ciere,

    You can achieve this using CanvasJS as provided in the above JSFiddle.

    Please feel free to post any queries related to CanvasJS.

    —-
    Manoj Mohan
    Team CanvasJS

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

You must be logged in to reply to this topic.