# Pie Chart label formatting

**URL:** <https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471>\
**Category:** Ignition\
**Created:** [May 14, 2012, 10:08pm UTC](https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471 "2012-05-14T22:08:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [May 14, 2012, 10:08pm UTC](https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471/1 "2012-05-14T22:08:28Z")

</div>

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 😢

Thank you

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [May 14, 2012, 10:57pm UTC](https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471/2 "2012-05-14T22:57:06Z")

</div>

You have to format it in the binding. For example, if the data is bound to a SQL query you can do something like:`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.

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [May 14, 2012, 11:03pm UTC](https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471/3 "2012-05-14T23:03:10Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [May 15, 2012, 12:33am UTC](https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471/4 "2012-05-15T00:33:01Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [May 15, 2012, 4:00pm UTC](https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471/5 "2012-05-15T16:00:03Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Travis.Cox](https://avatars.discourse-cdn.com/v4/letter/t/b9bd4f/32.png) [@Travis.Cox](https://forum.inductiveautomation.com/u/Travis.Cox)\
**Post date:** [May 15, 2012, 5:33pm UTC](https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471/6 "2012-05-15T17:33:56Z")

</div>

I see. You would have to concatenate the two values since there is a single display for each wedge.

---

<div class="post-metadata">

**Author:** ![miketob](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/miketob/32/5936_2.png) [@miketob](https://forum.inductiveautomation.com/u/miketob)\
**Post date:** [May 15, 2012, 5:48pm UTC](https://forum.inductiveautomation.com/t/pie-chart-label-formatting/4471/7 "2012-05-15T17:48:59Z")

</div>

Thank you very much Travis
