Question

I’m creating a zoomable chart with jqChart. I’m using the code from this sample:

http://www.jqchart.com/samples

The issue is when I’m zooming the chart a lot, the x-axis labels switch form dates to times.

How can I display the real date (not only time) when zoom?

Was it helpful?

Solution

The jqChart axis labels are formatted depending on the date time interval, which is calculated. If interval becomes ‘hours’ it changes the labels string format.

You can change the string format with:

axes: [ 
       { 
          type: 'dateTime', 
          location: 'bottom', 
          labels: { stringFormat: 'm/d/yy' }
      } 
     ]

and in this case the labels won’t turn to a time.

More about the labels formatting you can find here:

http://www.jqchart.com/documentation/userguide/default.aspx#!LabelsFormatting

OTHER TIPS

Hi you can specify the intervalType in the dateTimeAxisOptions when you construct the chart

here is the documentation and you can do something like this, this should solve your peoblem

axes: [
    {
          type: 'dateTime',
          location: 'bottom',
          minimum: new Date(2011, 1, 4),
          maximum: new Date(2011, 1, 18),
          interval: 1,
          intervalType: 'days'
      }
   ]
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top