Home forums Chart Support Get the real x axis width in pixel?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #29857

    Hello,

    I would like to dynamically get the width of the plot area (Or the full X axis width, not the dataserie).

    I think there are some problems with the current ways to get this value, for example, let’s take your jsfiddle https://jsfiddle.net/r20Lan6o/ where I just added a console.log(chart.bounds) on resize.
    The values in bounds do not match anything close to real pixel values https://imgur.com/L37deFT
    I’ve got 628 for the chart div.
    I’ve got 668 for the x2 in bounds.
    What is this 668?
    How to legitimately get the value I’d like?

    thanks.

    #29866

    @xavcactus,

    Sorry for the inconvenience caused. Chart bounds not being updated on resizing is a known bug and we will be fixing it in our upcoming version.

    I would like to dynamically get the width of the plot area (Or the full X axis width, not the dataserie).

    You can get the bounds of axisX as chart.axisX[0].get("bounds"); as mentioned in this documentation page.


    Vishwas R
    Team CanvasJS

    #29870

    That’s it; thanks!

    #30246

    @xavcactus,

    We have just released v3.0 Beta-1 with this fix. Please refer to the release blog for more information. Do download the latest version from download page & let us know your feedback.


    Vishwas R
    Team CanvasJS

    #30335

    Thanks for the update

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

You must be logged in to reply to this topic.