How do I get width of a chart?

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
goodsj
Newbie
Newbie
Posts: 18
Joined: Thu Jan 25, 2018 12:00 am

How do I get width of a chart?

Post by goodsj » Wed May 22, 2019 4:55 am

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 25198 times

goodsj
Newbie
Newbie
Posts: 18
Joined: Thu Jan 25, 2018 12:00 am

Re: How do I get width of a chart?

Post by goodsj » Tue May 28, 2019 5:58 am

hello.
is it impossible? :?

Yeray
Site Admin
Site Admin
Posts: 9514
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: How do I get width of a chart?

Post by Yeray » Wed May 29, 2019 2:16 pm

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;
    }
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply