Extract colors from series

17 views
Skip to first unread message

Wolf

unread,
Oct 18, 2014, 2:40:40 AM10/18/14
to gf...@googlegroups.com
Good morning Everyone,
I have a problem discovering auto assigned colors from series.
I know they are available after the widget is attached to the DOM but how can I catch the right time? what I do:

public void myEvent(int completedElements, int totalElements,
                boolean loading) {

                plot=createPlotGraph();
                if (plot!=null){
                    plot.setSize("100%","100%");
                    vp.add(plot);
                    vp.setCellHeight(plot, "100%");                     

                    plot.addAttachHandler(new AttachEvent.Handler() {

                       @Override
                        public void onAttachOrDetach(AttachEvent event) {
                            plot.getModel().getSeries().get(0).getAutoGeneratedColor()
                            System.out.println(plot.getModel().getSeries().length());
                            System.out.println(plot.getModel().getSeries().get(0).getColor());

                       }
                    });
                }


But I always have null from this code


Thanks

Nicolas Morel

unread,
Oct 18, 2014, 3:48:01 AM10/18/14
to gf...@googlegroups.com
You could try Scheduler.get().scheduleDeferred(ScheduledCommand).

Giuseppe Parrinello

unread,
Oct 18, 2014, 3:49:28 AM10/18/14
to gf...@googlegroups.com
Ready tried but without success....

--
You received this message because you are subscribed to a topic in the Google Groups "GFlot General Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gflot/rXeuIyelCGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gflot+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Wolf

unread,
Oct 18, 2014, 3:54:29 AM10/18/14
to gf...@googlegroups.com
of course Ready was autocorrector on my ALREADY
To unsubscribe from this group and all its topics, send an email to gflot+unsubscribe@googlegroups.com.

Nicolas Morel

unread,
Oct 18, 2014, 3:59:55 AM10/18/14
to gf...@googlegroups.com
Take a look at PlotWithInteractiveLegend.updateLegend().

I don't remember why I need that, I think flot copy the series you give instead of using them and updating them so the color is not present in the original object.

So the proper way would be to add an handler with plot.addLoadHandler() and use plot.getPlot().getData().get(0).getString("color").

Giuseppe Parrinello

unread,
Oct 18, 2014, 4:06:29 AM10/18/14
to gf...@googlegroups.com
yesss!!! you great!Thankyou i was going nut for that

--
You received this message because you are subscribed to a topic in the Google Groups "GFlot General Discussion" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/gflot/rXeuIyelCGU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to gflot+un...@googlegroups.com.

Nicolas Morel

unread,
Oct 18, 2014, 4:09:01 AM10/18/14
to gf...@googlegroups.com
you're welcome :)
Reply all
Reply to author
Forward
0 new messages