jqplot: Separating ticks and series values

前端 未结 2 425

I have a web service that sends date values (for x-axis) in one array. It sends y-axis values in another array.

Is it possible to have jqPlot create a chart with 2

相关标签:
2条回答
  • 2021-01-14 23:02

    The 'multiple ticks for the same date' for the date-axis can be solved by including the following code snippet:

      xaxis: {
               label: "Whatever you name it",
               renderer: $.jqplot.DateAxisRenderer,
               min:dateVal[0],
               max:dateVal[dateVal.length-1],
               tickInterval: '1 day',
    

    Please include min,max and tickInterval under xaxis: and not under tickOptions: .

    In my case I am having the date values in the array dateVal where the 0th element is the minimum value of date for the x-axis and the last element is the max date value. If you so wish you could hard-code the date values.

    I hope this will be of help.

    0 讨论(0)
  • 2021-01-14 23:07

    I can not figure out a way for jqPlot to accept how you want to define your inputs (the ticks option seems to only work with numbers). I'm curious as to the "avoid the extra processing" comment. With jQuery it would be as easy as:

    $.map(dateValues, 
           function(val,idx){
               return [[val,dailyValues[idx]]];
           }
    );
    

    to "merge" the two arrays into point pairs.

    0 讨论(0)
提交回复
热议问题