2014-12-28 196 views
0

我想创建一个图形,其中x轴由时间戳(日期)和Y轴数据组成。 我遇到了X轴的问题, 我该如何编辑代码,以便它具有像“date(Y-m-d)”这样的模板。x轴时间戳图js

请我需要帮助我搜索了很多,并没有发现什么

$a=[1419717600000,0],[1419631200000,1000],[1419544800000,1000],[1419458400000,6000],[1419372000000,2000],[1419285600000,0],[1419199200000,0],[1419112800000,0],[1419026400000,0],[1418940000000,0],[1418853600000,0]; 

<script type='text/javascript'>//<![CDATA[ 
$(window).load(function(){ 
$(function() { 


    var plot = $.plot($("#placeholder"),[ 


     { data: [$a], color: 'black'} 

    ], { 

     series: { 
      lines: { show: true, fill: true, fillColor: 'rgba(143, 198, 242, 0)' }, 
      points: { show: true} 
     }, 
     grid: { 
      color: 'transparent', 
      margin: 10 
     },xaxis: { 
     mode: "time", 
    timeformat: "%Y/%m/%d" 
    }, 
     xaxis: { 
      color: 'white', 
      font: { color: 'white', family: 'sans-serif', size: 11} 
     }, 
     yaxis: { 
      color: 'white', 
      font: { color: 'white', family: 'sans-serif', size: 11} 
     } 
    }); 
}); 



});//]]> 

</script> 

回答

0

尝试通过1000的时间戳值相乘,作为回答here。 (太低代表意见)

+0

我尝试过,现在也... ...仍然不工作:| – TheQuestionerMan