Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jqplot: "this.proxy.getTime is not a function" / date input parser?

I try to use jqplot for drawing an graph. So i modified this example in order to get an date based graph.

Currently my code is like this:

  var plot1 = $.jqplot('chartdiv', [[["2010-12-25.14:19:47",1],
                                     ["2010-11-25.14:19:47",2],
                                     ["2010-10-25.14:19:47",3]]], {
      title: 'mytitle',

      series: [{
          label: 'my label',
          neighborThreshold: -1
      }],
      axes: {
          xaxis: {
              renderer: $.jqplot.DateAxisRenderer,
            //  min:'August 1, 2010 16:00:00',
              tickInterval: '1 months',
              tickOptions:{formatString:'%Y-%m-%d.%H:%M:%S'}
          },
          yaxis: {
              tickOptions:{formatString:'$%.2f'}
          }
      },
      cursor:{
        show: true,
        zoom:true,
        showTooltip:false
      }
  });

But I get the following error:

this.proxy.getTime is not a function
(function(w){var l;w.fn.emptyForce=fun...))?([nAscboxXuidfegpEGP])/g})(jQuery);

It looks like, the script have problems by parsing the date format. But why?

thank you, for any kind of help.

//Update.. ups, I found the reason very quickly after writing this post (and after 1 day of try-and-error" ;-) ) So the reason I found generates a new question: is there any jqplot option, to define how to parse the input date format?

like image 552
The Bndr Avatar asked Jan 29 '26 04:01

The Bndr


2 Answers

...sorry, after reading the documentation the 3rd time, I found the error: The date input format is wrong. I though, that tickOptions:{formatString:'%Y-%m-%d.%H:%M:%S'} will define "how to parse the input data". But it is only relevant for displaying the data, not for parsing the input string.

But on this "formatString" you can guess, how jqPlot will parse the input date. So i had to change the input format to something like that: 2011-09-18 02:00:00

Byt the way: is there any jqplot option, to define how to parse the input date format?

like image 100
The Bndr Avatar answered Jan 31 '26 20:01

The Bndr


The errors is caused when jqPlot does not recognise the date format. The string format is auto detected (probably by the standard Date method).

To fix this, correct the string format, for example: 12/25/12 for December 25th, 2012.

like image 28
cmcginty Avatar answered Jan 31 '26 20:01

cmcginty



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!