javascript - How to use a 'plotWidth' calculation to position a highcharts pie -
i'm using combination of pie charts , stand alone svg images in chart have encountered positioning problem pies. pies linked each other , chart resized, want them remain exact distance away each other. if @ example in fiddles , resize window bigger , smaller see travel apart window grows , clash when window size reduced.
to position pies relative each other, wanted +/- 50px 75% width of plot area:
(this.plotwidth * 0.75) - 50 //for first pie (this.plotwidth * 0.75) + 50 //for second pie
that way, no matter size window, pair of pies sit together.
http://jsfiddle.net/so7k6w7v/1/
i tried use logic in center
, however, x position appears set 0 demonstrated in fiddle.
series: [ { type: 'pie', //center: [(this.plotwidth * 0.75) - 50, 71], //for first pie center: ['50%', 71], name: 'bbb', data: [ ['', 40.5], ['', 59.5] ], innersize: '60%', colors: ['#ff0000',"#f5f5f5"], }, { type: 'pie', //center: [(this.plotwidth * 0.75) + 50, 71], //for second pie center: ['65%', 128], name: 'aaa', data: [ ['', 43.1], ['', 56.9] ], innersize: '60%', colors: ["#555","#f5f5f5"], },
as aside, reason using pie way instead of solidguage
because of bug #3947 produces error when used other series types.
i played around center: []
elements , got them aligned vertical , horizontal:
center: [71, 10], name: 'bbb',
and
center: [200, 10], name: 'aaa',
since not know how want them positioned proof can have them not overlapping.
Comments
Post a Comment