Line Chart Plus Scatter Chart

130 views
Skip to first unread message

Angel Ortiz

unread,
Apr 22, 2013, 3:26:07 PM4/22/13
to google-visua...@googlegroups.com
Greetings:

I am trying to pull something off, but I am not quite sure if it can be done on the visualization api. I have already researched similar solutions to no avail.

I have the following two separate spreadsheet with data as follows:

1.
visits | month
1000 | January
2000 | February
3000 | March

2. 
newsname | date
news1 | jan 31 2013
news2 | feb 28 2013
news3 | mar 30 2013


I want #1 to be a line chart with a scatter overlay for the 2nd one. My goal is to show a correlation between news items and their impact on the overall amount of hits.

Can this be done?

If not, are you able to recommend another api that can get this done?

Thanks in advance.


Sergey Grabkovsky

unread,
Apr 22, 2013, 3:33:16 PM4/22/13
to google-visua...@googlegroups.com
Hello, I believe that we can figure something out. Just so we're clear, you want a single chart, with a line for dataset 1 and a scatter overlay for dataset 2? How do you plan to present dataset2 as a ScatterChart when your first column is discrete? A ScatterChart requires both of your axes to be continuous. If you do not want to change the column to be continuous, then you can just use annotations to show the news stories. You'll wind up with something that looks sort of like the chart on Google Finance.
If you do choose to change the data type of that column, then you can have a line chart where the options of the second series (your news) set the lineWidth to 0 and the pointSize to >0 so you wind up with points but not lines. This will effectively give you a ScatterChart.

- Sergey




--
You received this message because you are subscribed to the Google Groups "Google Visualization API" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.
To post to this group, send email to google-visua...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-visualization-api?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Angel Ortiz

unread,
Apr 22, 2013, 3:46:10 PM4/22/13
to google-visua...@googlegroups.com
If I change the datatype of the column with the names on #2, I'd lose the names right? I'd like for users to hover on the points and see the newstitles. 

Thanks for your support.

On Monday, April 22, 2013 3:33:16 PM UTC-4, Sergey wrote:
Hello, I believe that we can figure something out. Just so we're clear, you want a single chart, with a line for dataset 1 and a scatter overlay for dataset 2? How do you plan to present dataset2 as a ScatterChart when your first column is discrete? A ScatterChart requires both of your axes to be continuous. If you do not want to change the column to be continuous, then you can just use annotations to show the news stories. You'll wind up with something that looks sort of like the chart on Google Finance.
If you do choose to change the data type of that column, then you can have a line chart where the options of the second series (your news) set the lineWidth to 0 and the pointSize to >0 so you wind up with points but not lines. This will effectively give you a ScatterChart.

- Sergey


On Mon, Apr 22, 2013 at 3:26 PM, Angel Ortiz <angel.lu...@gmail.com> wrote:
Greetings:

I am trying to pull something off, but I am not quite sure if it can be done on the visualization api. I have already researched similar solutions to no avail.

I have the following two separate spreadsheet with data as follows:

1.
visits | month
1000 | January
2000 | February
3000 | March

2. 
newsname | date
news1 | jan 31 2013
news2 | feb 28 2013
news3 | mar 30 2013


I want #1 to be a line chart with a scatter overlay for the 2nd one. My goal is to show a correlation between news items and their impact on the overall amount of hits.

Can this be done?

If not, are you able to recommend another api that can get this done?

Thanks in advance.


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

Sergey Grabkovsky

unread,
Apr 22, 2013, 3:47:54 PM4/22/13
to google-visua...@googlegroups.com
That's correct. It sounds to me like you want to use a linechart with annotations. If you insist on a ScatterChart, I'm not sure where the Y axis would come from.

- Sergey


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualizati...@googlegroups.com.

Angel Ortiz

unread,
Apr 22, 2013, 3:50:33 PM4/22/13
to google-visua...@googlegroups.com
Right. Is it still possible?

Again, thanks for your aupport

- Sergey


To unsubscribe from this group and stop receiving emails from it, send an email to google-visualization-api+unsub...@googlegroups.com.

asgallant

unread,
Apr 22, 2013, 4:00:11 PM4/22/13
to google-visua...@googlegroups.com
You can set the value of the news item column to be a number, and the formatted value to a text value, which would render the text value in a tooltip on mouseover.

asgallant

unread,
Apr 22, 2013, 4:09:48 PM4/22/13
to google-visua...@googlegroups.com
Here's an example of the "scatter chart" version: http://jsfiddle.net/asgallant/mgQfG/, and one of the annotation version: http://jsfiddle.net/asgallant/hHdmB/

Angel Ortiz

unread,
Apr 22, 2013, 4:21:41 PM4/22/13
to google-visua...@googlegroups.com
asgallant:

thanks for your replies. One question about your first example:

how would I go about pulling the data from 2 different spreadsheets? I guess I'd have to choose the first example because some of the data has the same date. not sure if I can fit more than one annotation inside the same datapoint.

asgallant

unread,
Apr 22, 2013, 6:15:47 PM4/22/13
to google-visua...@googlegroups.com
If you are querying two different Google docs spreadsheets, then you would have to query each one separately and use the google.visualization.data.join function to create a joined DataTable from the two results.

With the annotations, since they are built from strings, you can include whatever you like in the annotations.  If you want to include two (or more) news items, that is possible, though there isn't much control over how they are displayed, so it may not look good.

Angel Ortiz

unread,
Apr 23, 2013, 8:15:42 AM4/23/13
to google-visua...@googlegroups.com
asgallant:

could you post your example using 2 different data sources on 2 different spreadsheets? I have tried to do so, but I have not been able...  Also I am not sure if I need to change the data table for #2 and add a column for numbers for it to read it into the scatterchart. I'm sorry for the problems, I am but a newb on assignment :)

asgallant

unread,
Apr 23, 2013, 12:27:51 PM4/23/13
to google-visua...@googlegroups.com
I don't have two spreadsheets handy to make an example with, but if you publish your spreadsheets and post their URL's, I'll build one using your sheets.

Angel Ortiz

unread,
Apr 23, 2013, 1:34:52 PM4/23/13
to google-visua...@googlegroups.com
Sheet #1 (monthly visits)

Sheet #2 (News Items)

Thanks for your support. I'll leave these sheets up in case anyone needs a similar solution

asgallant

unread,
Apr 23, 2013, 4:11:09 PM4/23/13
to google-visua...@googlegroups.com
Here's an example using the annotations (which looks pretty poor, I admit): http://jsfiddle.net/asgallant/hHdmB/1/

Angel Ortiz

unread,
Apr 23, 2013, 4:33:58 PM4/23/13
to google-visua...@googlegroups.com
Thank you! believe it or not, I am more inclined to use the one with the points, as the dates can be further refined and the points will be more scattered to the point that there will be no accumulation. But I am sure the other one will be handy not only for me, but for other users as well. 
Reply all
Reply to author
Forward
0 new messages