Closed jmgabriel closed 8 years ago
Hi,
Have you tried to defer the call to getTextWidth() using a Scheduler.DeferredCommand ? It is potentially the problem here.
Hello,
It is THE problem ;-)
This piece of code allows to get the text positions/size once they have been set by D3 :
Scheduler.get().scheduleDeferred(new Command()
{
@Override
public void execute()
{
svg.append("rect")
.attr("x", new DatumFunction<Double>()
{
@Override
public Double apply(Element context, Value d, int index)
{
return(getBBX(context.getParentElement()));
}
})
...
thank a lot for your support and reactivity also.
... and thank you for this very helpful project (!)
Hello
I'm trying to replicate the code provided by Mike Bostock for having borders around a text.
My code based on GWT-D3 is the following (the original javascript code is introduced as comment) :
The code above works well if I set a static value for the width of the rectangle. If not, only the text appears.
The access fucntion to the BBox coordinates is similar to the one proposed in the ArcTween Demo example of the GWT-D3 project. The main difference with this example is that the value are used afterward in a transition function but I don't feel it is the cause of my problem.
Do you have an idea about what could be the problem ?
thank a lot for your help