Ah, I see. Since you want n lines, one for each of your datatables, then,
yes, you need to put them in different columns. It would not be a join in
that case. Just add more rows to the one datatable. For each row of data,
just use nulls for all the columns where you don't have a value. It
might be good enough to leave null values undefined, but I suspect the rows
have to be the same length. You could ensure that by just adding a last
column.
for (i = 0; i < numRows; i++) {
var row = [];
row[0] = dt.getValue(i, 0);
row[i] = dt.getValue(i, 1);
row[numCols] = null;
}
mergedDatatable.addRow(row);
On Sun, May 7, 2017 at 12:54 PM, Daniel LaLiberte <[email protected]>
wrote:
> Hi Justin,
>
> I'm not sure I understand what you mean by "This approach requires the
> dt1columns argument is different for each joining of an additional data
> set.", but that sounds wrong. You could join the same columns in different
> datatables each time. The result of each join is a new datatable, so you
> could do a loop like this:
>
> dtJoin = dtables[0];
> for (i = 1; i < dtables.length; i++) {
> dtJoin = google.visualization.data.join(dtJoin, dtables[i], joinMethod,
> joinKeys, 1, 1);
> }
>
> On Sun, May 7, 2017 at 11:28 AM, Justin Stay <[email protected]> wrote:
>
>> I have many (2+, number unknown at time of generation) of 1D data sets
>> that I would like to plot together. This data is being queried from a
>> MySQL database. The generation of these datasets are captured through N
>> queries (where there are N lines to plot on the line chart). For example:
>>
>> Dataset #1: MySQL query results a data set with M1 (x,y) data points
>> Dataset #2: M2 (x,y) data points
>> etc . . .
>>
>> Such that you end with some number of datasets that are not the same
>> length nor share the same x values.
>>
>> I have seen a few questions/examples that seem to address this question
>> using the join method (https://developers.google.com
>> /chart/interactive/docs/reference#join). This approach requires the
>> dt1columns argument is different for each joining of an additional data set.
>>
>> Is this approach the only method for solving this problem? Is there a
>> better approach? No other plotting tool I've used requires that each data
>> set be the same size.
>>
>> Thanks!
>>
>> --
>> 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 [email protected].
>> To post to this group, send email to google-visualization-api@googl
>> egroups.com.
>> Visit this group at https://groups.google.com/grou
>> p/google-visualization-api.
>> To view this discussion on the web visit https://groups.google.com/d/ms
>> gid/google-visualization-api/a6ee493c-11db-4303-9268-ac56e1
>> cdefb5%40googlegroups.com
>> <https://groups.google.com/d/msgid/google-visualization-api/a6ee493c-11db-4303-9268-ac56e1cdefb5%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>
>
> --
> Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
> [email protected] <[email protected]> 5CC, Cambridge MA
>
--
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>
[email protected] <[email protected]> 5CC, Cambridge MA
--
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 [email protected].
To post to this group, send email to [email protected].
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/CAOtcSJMJCvT9v8njUpL_YA-ui0wN1LcZ7_f_hOtHJfB8TRfnWw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.