x轴上的日期值的高亮显示错误

时间:2015-11-26 16:21:32

标签: php highcharts

我正在尝试构建折线图,但我的高图不会使用以下代码进行渲染。 有人可以检查我做错了什么吗?

$('#employee_chart').highcharts({
        chart: {
            type: 'line'
        },
        title: {
            text: 'REPORTS AT A GLANCE (LAST 30 DAYS)'
        },
        xAxis: {            
            type: "datetime",
            dateTimeLabelFormats: {
                day: '%d'   
            },
            tickInterval: 24 * 3600 * 1000,
            min: Date.UTC(<?php echo date("Y, m, d",strtotime("-30 days"));?>),
            max: Date.UTC(<?php echo date("Y, m, d");?>)
        },
        yAxis: {
            title: {
                text: 'Temperature (°C)'
            }
        },
        plotOptions: {
            line: {
                dataLabels: {
                    enabled: true
                },
                enableMouseTracking: false
            }
        },
        series: [{
            name: 'Unique Logins',
            data: [7, 6, 9, 14, 18, 21, 25, 26, 23, 18, 13, 9, 7, 6, 9, 14, 18, 21, 25, 26, 23, 18, 13, 9, 7, 6, 9, 14, 18, 21]
        }]
    });

谢谢

2 个答案:

答案 0 :(得分:1)

您似乎缺少pointStart,这是问题的原因。

  pointStart :someDate

没有pointStart

时请参阅Fiddle with similar issue

Working fiddle when defined pointStart

答案 1 :(得分:0)

问题似乎来自您的xaxis设置: 如您所见,您的图表在没有这些设置的情况下呈现:http://jsfiddle.net/e4fru078/

            tickInterval: 24 * 3600 * 1000,
            min: Date.UTC(<?php echo date("Y, m, d",strtotime("-30 days"));?>),
            max: Date.UTC(<?php echo date("Y, m, d");?>)

我建议调查categories for your xaxis: 例如:http://jsfiddle.net/gh/get/jquery/1.7.2/highslide-software/highcharts.com/tree/master/samples/highcharts/chart/reflow-true/