整了一天了  还是没找到原因,调试后台没有问题,传到前台也没问题,
就是时间周期太短就会出现问题,时间轴变成1970开始的,但我这里的数据确实没错、、、
时间周期小于4天的时候就会出现这种问题~~  SOS

解决方案 »

  1.   

    后台传入的数据出错的时间范围设置代码 $('#container').highcharts('StockChart', {
                        lang: {
                            decimalPoint: '.',
                            downloadPNG: '下载PNG图片',
                            downloadJPEG: '下载JPG图片',
                            downloadPDF: '下载PDF文件',
                            downloadSVG: '下载SVG文件',
                            exportButtonTitle: '导出...',
                            loading: '加载中...',
                            months: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12'],
                            printChart: '打印图表',
                            resetZoom: '还原图表',
                            resetZoomTitle: '还原图表为1:1大小',
                            thousandsSep: ',',
                            weekdays: ['周天', '周一', '周二', '周三', '周四', '周五', '周六']
                        },
                        chart: {
                            renderTo: 'container'//画到id为sysThreadChart的div容器里
                        },
                        credits: {
                            enabled: false
                        },
                        //lang: {
                        //    downloadJPEG: "下载JPEG 图片",
                        //    downloadPDF: "下载PDF文档",
                        //    downloadPNG: "下载PNG 图片",
                        //    downloadSVG: "下载SVG 矢量图",
                        //    exportButtonTitle: "导出图片"  ,
                        //    //resetZoom: "rest",
                        //    printButtonTitle :"打印",
                        //    months: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],  
                        //},
                        legend: {
                            layout: 'horizontal',
                            //【图例】显示的样式:水平(horizontal)/垂直(vertical)
                            backgroundColor: '#FFFFFF',
                            borderColor: '#CCC',
                            borderWidth: 1,
                            align: 'center',
                            verticalAlign: 'top',//默认为底部
                            enabled: true,
                            //x: 100,
                            y: 50,
                            //floating: true,
                            shadow: true,
                        },
                        subtitle: {
                            //   text: '副标题',
                        },
                        rangeSelector: {
                            selected: 1
                        },                    title: {
                            text: '历史记录'
                        },
                        xAxis: {
                            type: "datetime",
                            tickPixelInterval: 150,
                            tickWidth: 5,
                            //  min: mintime,
                            //max:maxtime
                            labels: {
                                formatter: function () {
                                    var temptime = this.value;
                                    var date = new Date(parseInt(temptime, 10));
                                    var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1) : date.getMonth() + 1;
                                    var currentDate = date.getDate() < 10 ? "0" + date.getDate() : date.getDate();
                                    var hours = date.getHours() < 10 ? "0" + date.getHours() : date.getHours();
                                    var min = date.getMinutes() < 10 ? "0" + date.getMinutes() : date.getMinutes();
                                    var sec = date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
                                    return date.getFullYear() + "/" + month + "/" + currentDate + "/" + hours + ":" + min + ":" + sec;
                                }
                            }
                   //         dateTimeLabelFormats:
                   //{
                   //    second: '%H:%M:%S',
                   //    minute: '%b月.%e日 %H:%M',
                   //    hour: '%b月.%e日 %H:%M',
                   //    day: '%b月.%e日',
                   //    week: '%b月.%e日 ',
                   //    month: '%y年.%b月',
                   //    year: '%Y年'
                   //}
                        },
                        yAxis: {
                            labels: {
                                format: '{value} ℃'
                            }
                        },
                        //credits: {
                        //    enabled: false
                        //},
                        series: series
                    });
      

  2.   

    分享下。。
    1、
    关于Highchart汉化问题
    使用lang属性
    但本人使用lang的过程中  发现只有右上角打印 导出按钮的文字修改了,
    这里有个解决方法
    如果只是想简单的把x的labels汉化  可以到highchart.js 内直接修改默认的配置属性,
    2、关于formatter
    在highchart的formatter中是可以实现对x轴的label重新赋值,
    这里有个事例:http://bbs.csdn.net/topics/390500044
    另外  本人在解决问题的过程当中 使用jq的$.each方法  发现 xAxis 与 yAxis 还有tooltip中的formatter 属性上还是是些不同的,感觉和现在挺多资料上写的。  大概就这些,暂时没有再详细的深入研究了   还有东西要整
      

  3.   

    如果x轴刻度不为时间,那下图中的讨厌的00:00:00:000和FROM·····TO····怎么才能去掉啊?