You must be logged in to post your query.
Home › Forums › Chart Support › Get the real x axis width in pixel?
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?
console.log(chart.bounds)
resize
thanks.
@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.
You can get the bounds of axisX as chart.axisX[0].get("bounds"); as mentioned in this documentation page.
chart.axisX[0].get("bounds");
— Vishwas R Team CanvasJS
That’s it; thanks!
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.
Thanks for the update
You must be logged in to reply to this topic. Login/Register