美文网首页
Chart + Jinja2 调用方法

Chart + Jinja2 调用方法

作者: 龃龉前行 | 来源:发表于2021-01-27 13:21 被阅读0次
    <script>
        var ctx = $('#atndCount');
        var atndCount = new Chart(ctx, {
            type: 'bar',
            data: {
                labels: [ {% set pipe = joiner(",") %}
                            {% for k,v in count_dict.items() %}
                                {{ pipe() }} "{{k}}"
                            {% endfor %}
                            ],
                datasets: [
                    {
                        label: "异常次数 (次)",
                        backgroundColor: ["#FF6384", "#36A2EB", "#4BC0C0", "#FFCD56", "#F39346", "#FF86D0", "#91BAFF", "#FF7979"],
                        data: [{% set pipe = joiner(",") %}
                            {% for k,v in count_dict.items() %}
                                {{ pipe() }} {{v}}
                            {% endfor %}]
                    }
                ]
            },
            options: {
                maintainAspectRatio: false,
                responsive: true,
                legend: {display: false},
                title: {
                    display: true,
                    text: '考勤异常情况'
                }
            }
    
        });
    </script>
    

    相关文章

      网友评论

          本文标题:Chart + Jinja2 调用方法

          本文链接:https://www.haomeiwen.com/subject/jofazktx.html