Dual-Y chart with multiple series

24 views
Skip to first unread message

Matt Long

unread,
May 9, 2016, 10:42:51 AM5/9/16
to Google Visualization API
Hi,

I need help with a chart I'm attempting to create. The idea is that each user will have their own series (so they show up on the legend), and that user has an x and a y (scatter chart), but also Time value and then their tooltip, and style column.

So this works for one series:

X, Y, Time, Tooltip, Style

But how do I get that to work for multiple series?

Rough example code for one series (example data):

var data = new google.visualization.DataTable(
 
{
 cols
: [
 
{label: "X", type: "number"},
 
{label: "User Name", type: "number"},
 
{label: "Time", type: "number"},
 
{label: "Tooltip", type:"string", p:{role:"tooltip"}},
 
{label: "Colour", type:"string", p:{role:"style"}},';
  ],
 rows: [
{v: 123}, {v: 123}, {v:60}, {v: "Tooltip text"}, {v: "point {size: 3; opacity: 1; fill-color:#ffffff;}"}
]});


So how do I get this to work for multiple users?

There is also a NumberRangeFilter which scales the time number, for the 3rd column.

Just to clarify, this all works for one series - I would just like multiple.

Thank you in advance!

Daniel LaLiberte

unread,
May 9, 2016, 10:57:00 AM5/9/16
to Google Visualization API
Hi Matt,

The way you have set up your columns, the User Name (number) and Time columns are actually 2 series, and the tooltip and color would apply to the second, the time.

If you can use the time column for another role, such as use it for an interval value, then all the roles, including the tooltip and color columns, would apply to the user column.  And then you could repeat this multiple times, keeping the same X column for all.  

You can use null values in columns that don't have values.  And your X values don't have to be in order, and can be repeated, though you might get a more condensed table if you can share the X values where possible.  

I hope all that is clear. 

--
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 https://groups.google.com/group/google-visualization-api.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-visualization-api/7ccfbb8e-b89e-4f3f-9d94-e14e909617db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--

Matt Long

unread,
May 9, 2016, 5:22:25 PM5/9/16
to Google Visualization API
Hi Daniel,

Thanks a lot for the quick answer!

Could you clarify what you mean by internal? Would this just be role: "internal" ?

Can my NumberFilter still apply on this column?

And would I need to reposition the columns, or will the current setup have them in the same series? (Once I setup the null values properly, which I know how to do)

Thanks again!

Daniel LaLiberte

unread,
May 9, 2016, 10:45:03 PM5/9/16
to Google Visualization API
Intervals, as in role: 'interval'.  See the docs at: https://developers.google.com/chart/interactive/docs/gallery/intervals

I believe the NumberFilter should still apply even to a column with role: 'interval', though I have never tried it.

The roles all immediately follow the series that they apply to, so repeat the whole block of four columns for each series.

--
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 https://groups.google.com/group/google-visualization-api.

For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages