Displaying Persian dates in highchart from its corresponding Georgian date

后端 未结 5 1851
迷失自我
迷失自我 2021-02-04 10:30

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

5条回答
  •  清歌不尽
    2021-02-04 10:56

    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:

    
    

    And configure highcharts with:

    Highcharts.dateFormats = {
        'a': function(ts){return new persianDate(ts).format('ffffdd')},
        'A': function(ts){return new persianDate(ts).format('ffffdd')},
        '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')}
    };
    

提交回复
热议问题