Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

amCharts - How can I use non-English calendar?

Is there any way to use the Persian or Arabic calendar in Amcharts trendline?
Months names are not useful, because they conflict with other calendars.

AmCharts Live Editor

like image 790
1SaeedSalehi Avatar asked Dec 15 '14 08:12

1SaeedSalehi


2 Answers

I recommend you to make JavaScript file named fa.js with code below in Lang folder which is available in amChart directory.

AmCharts.translations.fa = {
"monthNames": ["دی", "بهمن", "اسفند", "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذز"],
"shortMonthNames":  ["دی", "بهمن", "اسفند", "فروردین", "اردیبهشت", "خرداد", "تیر", "مرداد", "شهریور", "مهر", "آبان", "آذز"],
"dayNames": ["یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"],
"shortDayNames": ["یکشنبه", "دوشنبه", "سه شنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه"],
"zoomOutText": "نمایش همه"}

Now you have to do couple things more:

Import fa.js to your project

<script type="text/javascript" src="/amcharts/lang/fa.js"></script>

Then define it in amchart object

 var chart = AmCharts.makeChart("chartdiv", {
    "type": "serial",
    "theme": "dark",
    "marginRight": 40,
    "marginLeft": 40,
    "language":"fa"
    .
    .
    .
like image 164
Tohid Dadashnezhad Avatar answered Sep 22 '22 10:09

Tohid Dadashnezhad


Unfortunately, you have to regenerate the whole (Persian Sunny) Calendar with the amCharts methods to format or parse dates

You can find the information related to formatting dates on

amCharts Acknowledge Base - Date Formatting

if you could do it please feel free to share it with us

like image 20
CatChMeIfUCan Avatar answered Sep 21 '22 10:09

CatChMeIfUCan