You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@echarts.apache.org by Dan Kortschak <da...@kortschak.io.INVALID> on 2023/06/15 20:37:12 UTC

setting to constrain position of graph type visualisation

Hi,

I'm using a graph visualisation similar to the examples here[1]. The
page dynamically fetches data from the server at intervals, re-
rendering the graph. When this happens it is possible for the graph to
gain momentum and can drift out of the viewable area of the canvas.
This makes it impossible to regain until a new polling event or by
manually reloading the page since the grab handle (this appears to be
the area of the rect containing the graph ndes) is not visible.

Is there a way to make the graph be constrained to within the canvas'
view port unless being zoomed or dragged?

thanks

[1]https://echarts.apache.org/examples/en/editor.html?c=graph-label-overlap


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org


Re: setting to constrain position of graph type visualisation

Posted by Ovilia <ov...@gmail.com>.
Here are some links that may be helpful:
https://github.com/apache/echarts/wiki

Thanks

*Ovilia*


On Fri, Jun 16, 2023 at 4:08 PM Dan Kortschak <da...@kortschak.io.invalid>
wrote:

> On Fri, 2023-06-16 at 15:59 +0800, Ovilia wrote:
> > I think this could be a useful feature. Do you mind making a pull
> > request?
> >
> > Thanks
> >
> > *Ovilia*
> >
>
> I will look into it. Thanks.
>
> Dan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
> For additional commands, e-mail: dev-help@echarts.apache.org
>
>

Re: setting to constrain position of graph type visualisation

Posted by Dan Kortschak <da...@kortschak.io.INVALID>.
On Fri, 2023-06-16 at 15:59 +0800, Ovilia wrote:
> I think this could be a useful feature. Do you mind making a pull
> request?
> 
> Thanks
> 
> *Ovilia*
> 

I will look into it. Thanks.

Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org


Re: setting to constrain position of graph type visualisation

Posted by Ovilia <ov...@gmail.com>.
I think this could be a useful feature. Do you mind making a pull request?

Thanks

*Ovilia*


On Fri, Jun 16, 2023 at 3:49 PM Dan Kortschak <da...@kortschak.io.invalid>
wrote:

> On Fri, 2023-06-16 at 15:38 +0800, Ovilia wrote:
> > Hi,
> >
> > If you call chart.setOption when data updates, the view should always
> > get
> > updated because the position of the data is relative to each other,
> > rather
> > than being absolute. So I don't think this is possible.
> >
> > Thanks
> >
> > *Ovilia*
>
> That's unfortunate and I think an oversight. When doing force-directed
> layout the node positions should be drawn back to the centre of the
> view port (or in the more general case, the centre of mass of the
> original set of node positions). From looking at the code for force
> layout, this doesn't happen. If that were fixed, then the requirement
> for making a constraint would go away because it would not be possible
> for a graph to wander off the view port and it would not be possible
> for a user to drag the graph out either.
>
> Dan
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
> For additional commands, e-mail: dev-help@echarts.apache.org
>
>

Re: setting to constrain position of graph type visualisation

Posted by Dan Kortschak <da...@kortschak.io.INVALID>.
On Fri, 2023-06-16 at 15:38 +0800, Ovilia wrote:
> Hi,
> 
> If you call chart.setOption when data updates, the view should always
> get
> updated because the position of the data is relative to each other,
> rather
> than being absolute. So I don't think this is possible.
> 
> Thanks
> 
> *Ovilia*

That's unfortunate and I think an oversight. When doing force-directed
layout the node positions should be drawn back to the centre of the
view port (or in the more general case, the centre of mass of the
original set of node positions). From looking at the code for force
layout, this doesn't happen. If that were fixed, then the requirement
for making a constraint would go away because it would not be possible
for a graph to wander off the view port and it would not be possible
for a user to drag the graph out either.

Dan


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
For additional commands, e-mail: dev-help@echarts.apache.org


Re: setting to constrain position of graph type visualisation

Posted by Ovilia <ov...@gmail.com>.
Hi,

If you call chart.setOption when data updates, the view should always get
updated because the position of the data is relative to each other, rather
than being absolute. So I don't think this is possible.

Thanks

*Ovilia*


On Fri, Jun 16, 2023 at 4:37 AM Dan Kortschak <da...@kortschak.io.invalid>
wrote:

> Hi,
>
> I'm using a graph visualisation similar to the examples here[1]. The
> page dynamically fetches data from the server at intervals, re-
> rendering the graph. When this happens it is possible for the graph to
> gain momentum and can drift out of the viewable area of the canvas.
> This makes it impossible to regain until a new polling event or by
> manually reloading the page since the grab handle (this appears to be
> the area of the rect containing the graph ndes) is not visible.
>
> Is there a way to make the graph be constrained to within the canvas'
> view port unless being zoomed or dragged?
>
> thanks
>
> [1]
> https://echarts.apache.org/examples/en/editor.html?c=graph-label-overlap
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@echarts.apache.org
> For additional commands, e-mail: dev-help@echarts.apache.org
>
>