Ken,

You can get the column labels from your DataTable data with
data.getColumnLabel(i).  So use that expression instead of your literal
string value.  In fact, you could use a loop to setup all of the columns
for your DataView, building a columns array that you then pass to
view.setColumns().

On Mon, Dec 22, 2014 at 11:03 AM, Ken Burkhalter <[email protected]>
wrote:

>
> On Sunday, December 21, 2014 7:39:05 PM UTC-5, Daniel LaLiberte wrote:
>>
>> ... to use the DataTable (without the DataView) would have to instead add
>> a header row to your arrayData that specifies the types of the columns and
>> pass that to arrayToDataTable().
>>
>>  Daniel - this morning I just noticed that using the dataView approach
> caused the labels to disappear from my chart legend.  They are in the 1st
> line (header) of the CSV file and previously provided labels with the
> non-DataView approach.
>
> But as soon as I add the DataView visualization the labels disappear.
>
> I restored labels with sourceColumn options (as exampled below) but would
> prefer to pass the labels in the CSV file for generality.  Is that
> possible?  I couldn't discover a way to make it work.
>
> var data = google.visualization.arrayToDataTable(arrayData, false);
> var view = new google.visualization.DataView(data);
> view.setColumns([
>  {sourceColumn: 0, type: "number", label: "Hour"},
>  {sourceColumn: 1, type: "number", label: "Dwn"},
>  {sourceColumn: 2, type: "number"},
>  {sourceColumn: 3, type: "number", label: "Mid"},
> . . . .
> . . . .
>
>
>
> 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
> [email protected].
> Visit this group at
> http://groups.google.com/group/google-visualization-api.
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Daniel LaLiberte <https://plus.google.com/100631381223468223275?prsrc=2>  -
978-394-1058
[email protected] <[email protected]>   5CC, Cambridge MA
[email protected] <[email protected]> 9 Juniper Ridge
Road, Acton 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 http://groups.google.com/group/google-visualization-api.
For more options, visit https://groups.google.com/d/optout.

Reply via email to