Your first row should have a null value in the second element:
$tmp1 = array("Mike", null, "");
$tmp2 = array("Jim", "Mike", "test1");
$tmp3 = array("Bob", "Jim", "Bob Sponge");
$tmp4 = array("Carol", "Bob", "");
as no element can be its own parent ("Mike" cannot be have "Mike" as a
parent) and there must be a root element in the chart (one where parent is
null).
This will return data in an array structure that is suitable to use with
the arrayToDataTable function, but not the standard DataTable constructor,
so you would need to adjust the javascript slightly:
var data = google.visualization.arrayToDataTable(JSON.parse(jsonData),
true);
Pass true as the second optional argument here since your data does not
include column headers (which are not strictly necessary for an OrgChart to
function properly).
On Wednesday, September 3, 2014 7:03:04 PM UTC-4, Audun Holme wrote:
>
> the getData.php above has the array $return_array speld as $array. fix it
> now and also tryed to create the array little differently. but still the
> same issue => chart not displayed:
> <?php
> $return_array = array();
> $tmp1 = array("Mike", "Mike", "");
> $tmp2 = array("Jim", "Mike", "test1");
> $tmp3 = array("Bob", "Jim", "Bob Sponge");
> $tmp4 = array("Carol", "Bob", "");
>
> array_push($return_array, $tmp1);
> array_push($return_array, $tmp2);
> array_push($return_array, $tmp3);
> array_push($return_array, $tmp4);
> echo json_encode($return_array);
> ?>
>
>
>
--
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.