Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Displaying Persian dates in highchart from its corresponding Georgian date

Can we use Gregorian dates together with a Georgian to Persian date converter script to show Persian dates in Highchart and Highstock?

like image 746
r.zarei Avatar asked Dec 03 '11 19:12

r.zarei


1 Answers

Then better way to override date formating is to use Highcharts.dateFormats (and persianDate library), This allows conversion of all dates (not x or y axis) to Persian calendar.

Sample: http://jsfiddle.net/smpaB/1/

Highcharts with persian date

Add pesianDate library with:

<script src="http://rawgithub.com/babakhani/PersianDate/master/dist/persian-date.min.js"></script>

And configure highcharts with:

Highcharts.dateFormats = {
    'a': function(ts){return new persianDate(ts).format('dddd')},
    'A': function(ts){return new persianDate(ts).format('dddd')},
    'd': function(ts){return new persianDate(ts).format('DD')},
    'e': function(ts){return new persianDate(ts).format('D')},
    'b': function(ts){return new persianDate(ts).format('MMMM')},
    'B': function(ts){return new persianDate(ts).format('MMMM')},
    'm': function(ts){return new persianDate(ts).format('MM')},
    'y': function(ts){return new persianDate(ts).format('YY')},
    'Y': function(ts){return new persianDate(ts).format('YYYY')},
    'W': function(ts){return new persianDate(ts).format('ww')}
};
like image 164
Taha Jahangir Avatar answered Oct 08 '22 00:10

Taha Jahangir