Hi Jonathan,

echarts is rendered synchronously after `setOption`. So you can always use
`view.group.getBoundingRect` to get the bounds after `setOption`.
Or if you wan't to do it before rendering to canvas. There is a stage post
update that can be extended by `registerPostUpdate`.

But I will suggest you calculating the right offset according to the axis
number and maximum width of the axis labels, which I think is not hard to
get if the result is not required to be very accurate.

Regards

On Mon, Feb 22, 2021 at 10:33 PM Jonathan Avila <avilajonat...@gmail.com>
wrote:

> Hi Echart Dev Team,
>
> I'm working on a chart that will have a dynamic number of y axis positioned
> to the right. I want to be able to set the right offset for each axis to
> avoid label overlap, but I would like to avoid setting a fixed number for
> the offset to maximize the available space.
>
> My first attempt was to try and use `echarts.registerVisual` function to
> get the ComponentView and then get its width and height with
> `view.group.getBoundingRect()`. Unfortunately, the method will execute
> before the axis view has rendered, so the boundingRect will have width 0
> and height 0. Do you guys have any suggestions on how I could proceed? Is
> there a way that I listen for a render event on an component view or
> perhaps some zRender event that I can try?
>
> Thanks,
>
> Jonathan
>


-- 
Yi Shen
Apache ECharts(incubating) PMC

Reply via email to