【问题标题】:x-axis timestamp graph jsx轴时间戳图js
【发布时间】:2014-12-28 13:42:08
【问题描述】:

我正在尝试创建一个图表,其中 x 轴由时间戳(日期)和 Y 轴数据组成。 X轴有问题 我可以编辑什么代码,使其具有像“日期(Y-m-d)”这样的模板。

我需要帮助我搜索了很多,但没有找到任何东西

$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>

【问题讨论】:

    标签: javascript php timestamp


    【解决方案1】:

    尝试将您的时间戳值乘以 1000,如回答 here。 (代表太低,无法评论)

    【讨论】:

      猜你喜欢
      • 2018-03-17
      • 2014-06-11
      • 1970-01-01
      • 2019-07-25
      • 1970-01-01
      • 2019-06-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多