Jqplot DateAxis rendering is not proper

我与影子孤独终老i 提交于 2019-12-12 08:16:20

问题


I tried to plot data useage per day using jqPlot along with its DateAxisRenderer, the data was static to test the graph, but I found that the points on graph are not corresponding to the exact date on the grid.

Is there a better tool out there to do this more accurately? I need to render light and interactive graphs on browser using JavaScript.


回答1:


I can fix this problem.

You can use tickInterval:'1 day' after you set min:'yyyy-mm-dd' and max:'yyyy-mm-dd' of xais. This is my example (use tickInterval:'7 day'):

   xaxis:{
        min:'2010-12-14',
        max:'2011-01-06',
        renderer:$.jqplot.DateAxisRenderer,
        rendererOptions:{tickRenderer:$.jqplot.CanvasAxisTickRenderer},
        tickInterval:'7 day',            
        tickOptions:{
          fontFamily:'Verdata',
          fontSize:'10pt',
          formatString:'%b %#d, %Y',
          angle:-30
        }
    },



回答2:


I've been using the data axis renderer for months -- no bugs or problems. I did run into problems because times in JS are measured in milliseconds.



来源:https://stackoverflow.com/questions/3218348/jqplot-dateaxis-rendering-is-not-proper

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!