It is currently Sat Apr 19, 2014 9:45 pm




Post new topic Reply to topic  [ 7 posts ] 
 Pie Chart label formatting 
Author Message
Lieutenant
Lieutenant

Joined: Mon May 03, 2010 10:08 am
Posts: 63
Post Pie Chart label formatting
Hello,

I have a doubt with the formatting of labels in a pie chart:

The data for the pie chart has two columns: EventName and Duration where Duration is in seconds.

Is there a way to format the label to display the duration like "hh:mm:ss"?

I tried to write an expression binding for the "labelFormat" property, but without success :cry:

Thank you

_________________
Miguel A. Torres Orozco B.
Image


Mon May 14, 2012 2:08 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Pie Chart label formatting
You have to format it in the binding. For example, if the data is bound to a SQL query you can do something like:
Code:
SELECT DATE_FORMAT(t_stamp, '%h:%i:%s'), duration FROM table
That function above exists in MySQL so it might be different depending on your database.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Mon May 14, 2012 2:57 pm
Profile WWW
Lieutenant
Lieutenant

Joined: Mon May 03, 2010 10:08 am
Posts: 63
Post Re: Pie Chart label formatting
Thank you Travis,

Yes, I thought about that, but the problem is that Duration is precisely the quantity that is being graphed, and I might have troubles if I cast it into a string, isn't it?

_________________
Miguel A. Torres Orozco B.
Image


Mon May 14, 2012 3:03 pm
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Pie Chart label formatting
No, you just want to alter the first column which is the name of each wedge. Leave the duration column alone. It will be a numeric value.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Mon May 14, 2012 4:33 pm
Profile WWW
Lieutenant
Lieutenant

Joined: Mon May 03, 2010 10:08 am
Posts: 63
Post Re: Pie Chart label formatting
Mmmh, yes, it can work but I'd loose the Event Name, perhaps I can concatenate the Event Name and the formatted duration.

I think it would be great that the labelFormat property could accept formatting codes, something like:
"{1:d}" or "{1:format('hh:mm:ss')}" or "{1:#,##0}" or something like that.

_________________
Miguel A. Torres Orozco B.
Image


Tue May 15, 2012 8:00 am
Profile
Moderator
Moderator

Joined: Sun Apr 02, 2006 2:46 pm
Posts: 1982
Location: Sacramento, CA
Post Re: Pie Chart label formatting
I see. You would have to concatenate the two values since there is a single display for each wedge.

_________________
Travis Cox
Inductive Automation
Technical Support Rep.


Tue May 15, 2012 9:33 am
Profile WWW
Lieutenant
Lieutenant

Joined: Mon May 03, 2010 10:08 am
Posts: 63
Post Re: Pie Chart label formatting
Thank you very much Travis

_________________
Miguel A. Torres Orozco B.
Image


Tue May 15, 2012 9:48 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: