GWT + ScatterChart: How to show a regression line

50 views
Skip to first unread message

Mario Rossi

unread,
Jan 22, 2013, 2:46:26 AM1/22/13
to google-visua...@googlegroups.com
I am sorry I post here, but I cannot post into the GWT group

The question is: Using GWT is there an example of showing the regression line into a ScatterChart ?

P.S. Yes, I know I have to calculate the line points, the question is just how to actually show the line

Thanks, Damiano


Sergey Grabkovsky

unread,
Jan 22, 2013, 9:39:34 AM1/22/13
to google-visua...@googlegroups.com
Hello,

GViz currently has no capabilities to calculate and display regression lines. However, if you have already calculated the points and put them in a DataTable, you may either use the lineWidth option to connect all the points in all your series or use the options.series[seriesIndex].lineWidth option to control the line width of each individual series (you can even set the options.series[seriesIndex].pointSize option to get rid of the points themselves). Hope this answers your question!

- Sergey




--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To view this discussion on the web visit https://groups.google.com/d/msg/google-visualization-api/-/2lTOzL5oRccJ.
To post to this group, send email to google-visua...@googlegroups.com.
To unsubscribe from this group, send email to google-visualizati...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-visualization-api?hl=en.

Mario Rossi

unread,
Jan 22, 2013, 10:10:38 AM1/22/13
to google-visua...@googlegroups.com
Thanks Sergey

The question is really how you do what you say using GWT.

I will try to actually find out by digging up in the code, if needed, but if there is an answer somewhere then I would prefer that :)

Thanks for you help !

Damiano

Sergey Grabkovsky

unread,
Jan 22, 2013, 10:37:24 AM1/22/13
to google-visua...@googlegroups.com
It seems that this option is not currently exposed via GWT as a Java option, but you can still use this options via the JavaScript Native Interface. We're currently working to expose more options via GWT so that you don't have to do this, but meanwhile you may use the following method to set the option:

public final native void setSeriesLineWidth(Options options, int seriesIndex, double lineWidth) /*-{
  options.series[seriesIndex] = {
    lineWidth: lineWidth
  };
}-*/;

I haven't tested this code myself, so I hope it works for you!

- Sergey



Damiano

--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.

Mario Rossi

unread,
Jan 23, 2013, 3:19:18 AM1/23/13
to google-visua...@googlegroups.com
Dear Sergey

I did some digging up and found this

 public final native void setSeries(int index, Series seriesAtIndex) /*-{
      if (!this.series) {
        this.series = {};
      }
      this.series[index] = seriesAtIndex;
    }-*/;

It is from 

I also found an implementation of Series

I will be experimenting with it


Reply all
Reply to author
Forward
0 new messages