Chart JS organized by group

I have installed chart js and it shows the bars but I cannot get it to group by days, I insert the records in the bd with this format
date(“Y-m-d H-i-s”)

<?php
                        echo Chart::widget([
                        'type' => Chart::TYPE_BAR,
                        'datasets' => [
                            [
                                'query' => Pagos::find()
                                    ->select('fecha')
                                    ->addSelect('sum(valor) as data')
                                    ->groupBy('fecha')
                                    ->limit(10)
                                    ->createCommand(),
                                'labelAttribute' => 'fecha'
                            ]
                        ]
                    ]);
                ?>