Welcome Guest Search | Active Topics |

Axes label formatting question
evangels
#1 Posted : Thursday, December 12, 2013 12:59:48 AM(UTC)
Rank: Member

Groups: ExpiredLicense, Registered
Joined: 7/30/2013(UTC)
Posts: 15

Thanks: 6 times
Was thanked: 0 time(s) in 0 post(s)
hi Team,

I'm trying to formatting the label on a Y Axis,
the original values are int values like 10000,20000,30000.....
and I tired to format these values to 10K,20K,30K....

tried label formatting feature as below, but not work:

Code:
axes: [
                       {
                           name: 'y1',
                           location: 'left',
                           interval: 4000,
                           maximum: 120000,
                           labels: {
                               stringFormat: '%d'/1000
                           }
                       }

         ]


how can I do that?

any comment is appreciated, thanks!
Dragan
#2 Posted : Thursday, December 12, 2013 5:48:16 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)
You can use 'axisLabelCreating' event.
http://www.jqchart.com/jquery/chart/CustomizingChart/AxisLabelCreatingEvent

You can use the following code:

Code:
$('#jqChart').bind('axisLabelCreating', function (event, data) {
                if (data.context.axis.location == 'left') {

                    var vl = parseFloat(data.text) / 1000;

                    data.text = vl + " K";
                }
            });

            $('#jqChart').jqChart({
Best Regards,
Dragan Matek
jqChart Inc.
1 user thanked Dragan for this useful post.
evangels on 12/12/2013(UTC)
evangels
#3 Posted : Thursday, December 12, 2013 9:22:40 PM(UTC)
Rank: Member

Groups: ExpiredLicense, Registered
Joined: 7/30/2013(UTC)
Posts: 15

Thanks: 6 times
Was thanked: 0 time(s) in 0 post(s)
dragan wrote:
You can use 'axisLabelCreating' event.
http://www.jqchart.com/jquery/chart/CustomizingChart/AxisLabelCreatingEvent

You can use the following code:

Code:
$('#jqChart').bind('axisLabelCreating', function (event, data) {
                if (data.context.axis.location == 'left') {

                    var vl = parseFloat(data.text) / 1000;

                    data.text = vl + " K";
                }
            });

            $('#jqChart').jqChart({


thank you so much!~
Users browsing this topic
Guest
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.098 seconds.