hikari001 2018-04-28 12:15 采纳率: 0%
浏览 919
已结题

highcharts 6.1.0中图表无法显示

view部分代码
def show(request):
exceptions = Exception.objects.order_by("-hit")[:5]
# exceptions = Exception.objects.all()
listx = []
listy = []
for exception in exceptions: #遍历,拼横纵坐标
listx.append(int(exception.hit))
listy.append(str(exception.name))

return render(request, "show.html", {'exceptions': exceptions, 'X': listx, 'Y': listy})

html部分代码
<!DOCTYPE html>
{% load staticfiles %}




Title






<script type="text/javascript">

    Highcharts.chart('container', {

            chart: {
                type: 'bar'
            },
            title: {
                text: '查询统计'
            },
            xAxis: {
                categories: {{ Y|safe }},
                title: {
                    text: null
                }

            },
            yAxis: {
                min: 0,

                title: {
                    text: '次数',
                    align: 'high'
                },
                labels: {
                    overflow: 'justify'
                }
            },
            tooltip: {
                valueSuffix: '次'
            },
            plotOptions: {
                bar: {
                    dataLabels: {
                        enabled: true,
                        allowOverlap: true
                    }
                }
            },
            legend: {
                layout: 'vertical',
                align: 'right',
                verticalAlign: 'top',
                x: -40,
                y: 80,
                floating: true,
                borderWidth: 1,
                backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),
                shadow: true
            },
            credits: {
                enabled: false
            },
            series: [{
                name: '次数',
                data: {{ X|safe  }}
            }]
        });

</script>


  • 写回答

2条回答

  • hikari001 2018-04-28 12:18
    关注

    页面显示

    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器