protected static function get_chart($labels, $data) {
        $chart = new \core\chart_bar();
        $chart->set_labels($labels);
        $chart->get_xaxis(0, true)->set_label(get_string('grade'));

        $yaxis = $chart->get_yaxis(0, true);
        $yaxis->set_label(get_string('participants'));
        $yaxis->set_stepsize(max(1, round(max($data) / 10)));

        $series = new \core\chart_series(get_string('participants'), $data);
        $chart->add_series($series);
        return $chart;
    }
protected static function get_chart($labels, $data) {
        $chart = new \core\chart_bar();
        $chart->set_labels($labels);
        $chart->get_xaxis(0, true)->set_label(get_string('grade'));

        $yaxis = $chart->get_yaxis(0, true);
        $yaxis->set_label(get_string('participants'));
        $yaxis->set_stepsize(max(1, round(max($data) / 10)));

        $series = new \core\chart_series(get_string('participants'), $data);
        $chart->add_series($series);
        return $chart;
    }
protected static function get_chart ( $ labels , $ data ) { $ chart = new \ core \ chart_bar ( ) ; $ chart -> set_labels ( $ labels ) ; $ chart -> get_xaxis ( 0 , true ) -> set_label ( get_string ( 'grade' ) ) ; $ yaxis = $ chart -> get_yaxis ( 0 , true ) ; $ yaxis -> set_label ( get_string ( 'participants' ) ) ; $ yaxis -> set_stepsize ( max ( 1 , round ( max ( $ data ) / 10 ) ) ) ; $ series = new \ core \ chart_series ( get_string ( 'participants' ) , $ data ) ; $ chart -> add_series ( $ series ) ; return $ chart ; }
Get a chart.

@param string[] $labels Chart labels.
@param int[] $data The data.
@return \core\chart_base
Get a chart .