Display report in dashboard code in develop doc not works & page showed element as text

this is the related develop doc link.

  1. when I tried to make report a widget showed in dashboard, this WidgetsList::add method seemed not exist? Is it out of date or something?

  1. and I don’t know why my page is like this, it seemed not a part of html element but only text, is it right?

    my controller code is same as the code in this page, and my API code is as follows

public function myReport($idSite, $period, $date, $segment = false)
$table = DataTable::makeFromSimpleArray(array(
array(‘label’ => ‘My Label 1’, ‘nb_visits’ => ‘1’),
array(‘label’ => ‘My Label 2’, ‘nb_visits’ => ‘5’),
return $table;