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 drone 推送镜像时候 purge: true 推送完毕后没有删除对应的镜像,手动拷贝到服务器执行结果正确在样才能让指令自动执行成功删除对应镜像,如何解决?
  • ¥15 求daily translation(DT)偏差订正方法的代码
  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler