Welcome Guest Search | Active Topics |

axisLabelCreating and DateTime axis
Pooya
#1 Posted : Saturday, July 27, 2013 6:55:04 AM(UTC)
Rank: Member

Groups: Registered
Joined: 9/17/2011(UTC)
Posts: 23

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Hi

Is it possible to bind axisLabelCreating to DateTime axis?

Best Regards
Pooya
Dragan
#2 Posted : Sunday, July 28, 2013 3:21:40 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Sure, it is possible. Are there any issues?
Best Regards,
Dragan Matek
jqChart Inc.
Pooya
#3 Posted : Sunday, July 28, 2013 5:49:32 AM(UTC)
Rank: Member

Groups: Registered
Joined: 9/17/2011(UTC)
Posts: 23

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
I want to convert DateTime and show DateTime base on Arabic in axis label.
I try this:

$('#jqChart').bind('axisLabelCreating', function (event, data) {
if (data.context.axis.location == 'bottom') {
data.text = ConvertToArabic(data.text);
}
});

and ConvertToArabic is my function to convert date time to arabic. but I have no luck.

Best Regards
Pooya
Dragan
#4 Posted : Sunday, July 28, 2013 6:08:55 AM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
"data.text" is the actual text, which is displayed on the axis. You can try converting it to Date object.
Code:
var date = new Date(data.text);

and after that you can convert it to Arabic.

Also you can try using our built-in Arabic localization:
http://www.jqchart.com/jquery/chart/ChartFeatures/Localization

You need to reference:
Code:
<script src="../js/i18n/chart.locale-ar.js" type="text/javascript"></script>

Localization files are included in the jqChart package.
Best Regards,
Dragan Matek
jqChart Inc.
Pooya
#5 Posted : Sunday, July 28, 2013 11:57:04 PM(UTC)
Rank: Member

Groups: Registered
Joined: 9/17/2011(UTC)
Posts: 23

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
Thanks for your answer

Your tip about converting text to date was very helpful.
But the trick is to bind "axisLabelCreating" before calling jqChart not after it!

Best Regards
Pooya
Dragan
#6 Posted : Monday, July 29, 2013 1:02:28 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Yes, you should bind axisLabelCreating before jqChart declaration.

What about our built-in localization? Did you try it?
Best Regards,
Dragan Matek
jqChart Inc.
Pooya
#7 Posted : Tuesday, July 30, 2013 10:23:13 AM(UTC)
Rank: Member

Groups: Registered
Joined: 9/17/2011(UTC)
Posts: 23

Thanks: 2 times
Was thanked: 0 time(s) in 0 post(s)
I tried built-in localization but localization only convert month name to Arabic.
what I need is to convert date from Gregorian to Hihri
for example 13. Juli 2010 must convert to 1. SHa`baan 1431 A.H. (1/8/1431)

I think you can add DateTime convertor for Calenars (Arabic, Persian, Chinese ... ) or allow to bind DateConvertor fucntion that called everywhere (tooltip,axis ...).
To show Arabic date Correctly I bind tooltipFormat and axisLabelCreating to convert Date. but if you allow to define my convertor in some place (bind my function or some other way), building chart for other languages become easier.

Best Regards
Pooya
Dragan
#8 Posted : Wednesday, July 31, 2013 12:09:31 PM(UTC)
Rank: Advanced Member

Groups: Administrators, DataVizJavaScript, jQueryChart, jQueryDV, MvcChart, Registered
Joined: 1/3/2011(UTC)
Posts: 483

Thanks: 0 times
Was thanked: 87 time(s) in 87 post(s)
Thank you for your suggestions.
Best Regards,
Dragan Matek
jqChart Inc.
Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

FlatEarth Theme by Jaben Cargman (Tiny Gecko)
Powered by YAF 1.9.4 | YAF © 2003-2010, Yet Another Forum.NET
This page was generated in 0.121 seconds.