简体   繁体   English

一年中的星期的jqplot号

[英]jqplot number of the week of the year

I'm trying to show the number of the week of the year on the xAxis, so this my code but it's not working 我试图在xAxis上显示一年中的星期几,所以这是我的代码,但是它不起作用

$.jqplot('my_canvas' + id, data, {
    title: 'Graphic',
    xaxis: {
            renderer : $.jqplot.DateAxisRenderer,
            min: from_date,
            label: "WEEK",
            tickInterval: '1 week',
            tickOptions:{
                formatter: Formatter   //why formatter is not not being called?
            }                

        },
        yaxis: {
            min: 0,
            max: maximum_value
        }
        highlighter: {
           show: true
    }
}



Formatter = function (format, val) {    
    return numberOftheWeek(val);
}

formatter is not being called when using renderer : $.jqplot.DateAxisRenderer but when i use renderer: $.jqplot.CategoryAxisRenderer. 使用renderer时不会调用formatter :$ .jqplot.DateAxisRenderer,但是当我使用renderer时:$ .jqplot.CategoryAxisRenderer。 it's called but all the aAxis labels are superimposed. 它被调用,但是所有aAxis标签都被叠加。

All help will be greatly appreciated. 所有帮助将不胜感激。 Thanks! 谢谢!

try this ,not sure whether it works or not: 试试这个,不确定是否有效:

 xaxis: { 
            renderer:$.jqplot.DateAxisRenderer,
            label: "WEEK",
            min:  from_date,

            tickInterval: '1 WEEK',
            tickOptions: {formatString:Formatter, markSize: 4},


            }, 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM