I'm using highcharts. I'm trying to change its date to Persian but since it is using Date.UTC I can not change it!
I've seen the http://api.highcharts.com/highstock#lang but it seems that it doesn't support persian.
Do you know any way to change it into persian date? One method I can come across with is the algorithm that changes UTC date to Persian date.
Is there any way to solve this problem? Please help me...
Thank you
You will have to do a bit of work to get this into highcharts.
Firstly, find a javascript library which converts dates to persian date. This one looks promising: http://intldate.codeplex.com/
Secondly, you need to customise the highcharts date formatting. Highcharts provides an API to do this:
http://api.highcharts.com/highcharts#Highcharts.dateFormat()
You need to use the dateFormats hook to add a %P option to the date format string which prints in persian format using the javascript library you choose. Once you have defined a %P format, you can customise the date formats to be used on the x-axis: http://api.highcharts.com/highcharts#xAxis.dateTimeLabelFormats
{
second: '%H:%M:%S',
minute: '%H:%M',
hour: '%H:%M',
day: '%P',
week: '%P',
month: '%P',
year: '%P'
}
Note, you can define several dateFormat parameters, not just %P, to handle days, months etc.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With