Page 1 of 1

How do I get width of a chart?

Posted: Wed May 22, 2019 4:55 am
by 16082909
Good afternoon, Yeray!

I have question.

1. How do I get width of a chart not a canvas width with javascript or other ways?
2. How do I move legend position?
please refer an attached picture.
tchar2.jpg
tchar2.jpg (139.63 KiB) Viewed 40357 times

Re: How do I get width of a chart?

Posted: Tue May 28, 2019 5:58 am
by 16082909
hello.
is it impossible? :?

Re: How do I get width of a chart?

Posted: Wed May 29, 2019 2:16 pm
by yeray
goodsj wrote:
Wed May 22, 2019 4:55 am
1. How do I get width of a chart not a canvas width with javascript or other ways?
Use the chartRect property:

Code: Select all

var w = Chart1.chartRect.width;
goodsj wrote:
Wed May 22, 2019 4:55 am
2. How do I move legend position?
The legend bounds are calculated in the legend's calcrect function. You could do this to move the legend to any x position you wish:

Code: Select all

    Chart1.legend.oldcalcrect = Chart1.legend.calcrect;
        Chart1.legend.calcrect = function () {
        this.oldcalcrect();
        this.bounds.x = 100;
    }