doucong1853 2018-12-04 13:22
浏览 146

使用Laravel Chartjs创建图表动画

I am creating chart using chartJs Laravel (docs: https://charts.erik.cat/). I would like to make animation to chart but it seems that it is not supported. But in chartJs documentation is supported animation.

Controller

 $chart = new CoursesDoneChart();
        $chart->labels(['Dokončené kurzy', 'Nedokončené kurzy']);
        $chart->minimalist('false');
        $chart->title($subject->name, '18');
        $chart->dataset('Course dataset', 'doughnut', [$percentageByDoneCourses, $percentageAllCourses])->options([
            'backgroundColor' => ['#ff0000', '#ff9999'],
            'color' => ['#ff0000', '#ff9999'],

        ]);

Blade

   <div id="chart">
        {!! $chart->container() !!}
        </div>
        <script src="https://unpkg.com/vue"></script>
        <script>
            var app = new Vue({
                el: '#chart',
            });
        </script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.7.1/Chart.min.js" charset="utf-8"></script>
        {!! $chart->script() !!}

Does anybody know how to do animation in ChartJs using Laravel, please? thank you!!

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办
    • ¥15 Python爬取指定微博话题下的内容,保存为txt
    • ¥15 vue2登录调用后端接口如何实现
    • ¥65 永磁型步进电机PID算法
    • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
    • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
    • ¥15 如何处理复杂数据表格的除法运算
    • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)