The correct way to specify column roles in JSON is in the column
properties: "p: {role: "certainty"}", so your JSON should look like this:
var grundJsonDataResultatrakning = {
cols: [
{type: 'number', p: {role: 'domain'}},
{type: 'number', p: {role: 'data'}},
{type: 'boolean', p: {role: 'certainty'}}
],
rows: [
{c: [{v: 1}, {v: 7}, {v: false}]},
{c: [{v: 2}, {v: 8}, {v: false}]}
]
};
Technically, if you are returning that JSON from an AJAX request, all of
the properties and all of the string should be enclosed with double-quotes
to make it valid JSON, but it works fine as is for a test case.
On Thursday, September 6, 2012 10:37:12 AM UTC-4, Bassa Safa wrote:
>
> I get a All series on a given axis must be of the same data type× when
> adding Roles Certaintity. Probably something really simple that I have
> missed... but 4 hours of trying with different possibilities im lost. It
> works when I populate DataTable with "regular" data as in the playground.
> But when populating with JSON it fails.
>
> As a related question? How do one debug "google chart" code?
>
> regards
> bassa
>
>
> function drawVisualization() {
> // Create and populate the data table.
>
>
> var grundJsonDataResultatrakning = {cols:[
> {type:'number',role:'domain'},
> {type:'number',role:'data'},
> {type:'boolean',role:'certainty'
> }],
> rows:[
> {c:[{v:1},{v:7},{v:false}]},
> {c:[{v:2},{v:8},{v:false}]}]};
> var dataResultatrakning = new google.visualization.DataTable(
> grundJsonDataResultatrakning);
>
> // Create and draw the visualization.
> new google.visualization.LineChart(document.getElementById(
> 'visualization')).
> draw(dataResultatrakning , {curveType: "function",
> width: 500, height: 400,
> vAxis: {maxValue: 10}}
> );
> }
--
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/-/hX6grUsPNyIJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-visualization-api?hl=en.