flot - gFlot get color ..when is it attached to DOM in GWT -
After determining the color, the color is fixed after the DOM is connected. When can I call the method using GWT?
plot = createPlotGraph (); Edit: The actual context is something (VP is a vertical panel):
plot = createPlotGraph (); If (conspiracy! = Null) {plot.setSize ("100%", "100%"); Vp.add (conspiracy); Vp.setCellHeight (plot, "100%"); plot.addAttachHandler (New AttachEvent.Handler () {@Override public void onAttachOrDetach (AttachEvent event) {plot.getModel (). getSeries (). get (0) .getAutoGeneratedColor () println (plot.getModel () .getSeries ( ). Length ()); System.out.println (plot.getModel (). GetSeries (). Get (0) .getcolor ());}}}}}
and I found I have 3 (or more) series that is actually rendered correctly, I see everyone on the screen properly, but the color println written below is always empty.
Other attempts Do:
if (plot! = Null) {plot.setSize ("100%", "100%"); .. Plot.addAttachHandler (New AttachEvent.Handler () {@Override public void onAttachOrDetach (AttachEvent event) {println (plot.getModel () getSeries () Length ()); println (conspiracy. GetModel (). GetSeries () get (0). getColor ());}}}; vp.add (plot); Vp.setCellHeight (plot, "100%");}
similar results
update Please try another:
plot.setSize ("100%", "100%"); plot.addAttachHandler (New AttachEvent.Handler () {@Override public void onAttachOrDetach (AttachEvent event) {Scheduler.get (). scheduleDeferred (New ScheduledCommand () {@Override public void execute () {println (conspiracy. GetModel () . GetSeries () length ()); System.out.println (plot.getModel (). GetSeries (). Get (0) .getColor ());}})}}}};
Similar results ... empty
You should add one to your widget
:
Widgets. AddAttachHandler (new AttachEvent.Handler) {@Override public void Praktachordet (AttachEvent event)) {If (event.isAttached ( )) {// Widget DOM Attached to} else {// Detached}}});
If you reach your JSNI wrapper values (in this case gflot), it usually helps to call the call in a ScheduledCommand
problem Has been there. This will ensure that the order will be executed after the browser event loop returns - and that is when your cover should be properly started in DOM
Scheduler .get () ScheduleDeferred (New Scheduled Commands) {@Override Public Zero Execution () {System.out.println (plot.getModel (). GetSeries (.) Length ()); System.out.println (plot.getModel () .getSeries (). Get (0) .getColor ());}}};
Comments
Post a Comment