X - Axis Date & Time value display in multi language

TeeChart for JavaScript for the HTML5 Canvas
Post Reply
SenSeo
Newbie
Newbie
Posts: 71
Joined: Wed Mar 09, 2016 12:00 am

X - Axis Date & Time value display in multi language

Post by SenSeo » Mon Jul 11, 2016 6:11 am

Hi,

We have developed multi language application with Teechart for create different type of charts. We need to display X-axis value in the format of month like 10 May, 12 May, etc. When we change the language from English to other language the X-axis month name is not translated to selected language.

Does Teechart support multi languages for X-axis date time display?

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: X - Axis Date & Time value display in multi language

Post by Yeray » Mon Jul 11, 2016 8:02 am

Hello,

TeeChart uses DateTimeToString function to convert the TDateTime values to strings. Since this takes the ShortMonthNames array for the months ('mmm'), you can modify that array using the language you wish. Ie:

Code: Select all

  ShortMonthNames[1] := 'Jan';
  ShortMonthNames[2] := 'Feb';
  ShortMonthNames[3] := 'Mar';
  ShortMonthNames[4] := 'Apr';
  ShortMonthNames[5] := 'May';
  ShortMonthNames[6] := 'Jun';
  ShortMonthNames[7] := 'Jul';
  ShortMonthNames[8] := 'Aug';
  ShortMonthNames[9] := 'Sep';
  ShortMonthNames[10] := 'Oct';
  ShortMonthNames[11] := 'Nov';
  ShortMonthNames[12] := 'Dec';
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

SenSeo
Newbie
Newbie
Posts: 71
Joined: Wed Mar 09, 2016 12:00 am

Re: X - Axis Date & Time value display in multi language

Post by SenSeo » Mon Jul 11, 2016 4:15 pm

Hello,

Thank you for your reply.I think DateTimeTostring() and given solution in the above post is for Delphi Programming.But I am using Html5 & Javascript to create chart in the application, so how can we achieve the same in the Javascript language?

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: X - Axis Date & Time value display in multi language

Post by Yeray » Tue Jul 12, 2016 8:02 am

SenSeo wrote:Thank you for your reply.I think DateTimeTostring() and given solution in the above post is for Delphi Programming.But I am using Html5 & Javascript to create chart in the application, so how can we achieve the same in the Javascript language?
Oups :oops: , let me check it for Javascript.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Yeray
Site Admin
Site Admin
Posts: 9613
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: X - Axis Date & Time value display in multi language

Post by Yeray » Tue Jul 12, 2016 8:18 am

Hi,

In Javascript you can change the dateFormat.i18n monthNames array:

Code: Select all

  dateFormat.i18n = {
        dayNames: [
            "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat",
            "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"
        ],
        monthNames: [
            "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec",
            "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
        ]
    };
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply