# Value Precision in a Bar Chart

**URL:** <https://forum.inductiveautomation.com/t/value-precision-in-a-bar-chart/15985>\
**Category:** Ignition\
**Created:** [November 13, 2017, 9:51pm UTC](https://forum.inductiveautomation.com/t/value-precision-in-a-bar-chart/15985 "2017-11-13T21:51:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![dturner](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dturner](https://forum.inductiveautomation.com/u/dturner)\
**Post date:** [November 13, 2017, 9:51pm UTC](https://forum.inductiveautomation.com/t/value-precision-in-a-bar-chart/15985/1 "2017-11-13T21:51:51Z")

</div>

I have a bar chart that shows the number of times a particular torque value occurred. The dataset is a comprised of a double for the torque value and an integer for the number of times the torque occurred. In the dataset everything shows correctly but when the values are shown in the bar chart, the precision is off. The information comes from a SQL query in my database. Everything shows with the correct precision except for the bar chart. I thought this only happens with float datatype. I am using Ignition 7.7

 ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/c/c24bc627a7cea35128dd21ea93d139cc5341c818.png) ![](https://us1.discourse-cdn.com/inductiveautomation/original/2X/1/1eea9a85bfd570f4c05e3b40e92d62b9b13bdd1c.png)

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 13, 2017, 10:29pm UTC](https://forum.inductiveautomation.com/t/value-precision-in-a-bar-chart/15985/2 "2017-11-13T22:29:04Z")

</div>

Binary literally can’t represent arbitrary decimal precision the way that you’re expecting it to. Neither the float nor double type will behave differently - this is how [all computers](https://en.wikipedia.org/wiki/Floating-point_arithmetic) work on the backend.

You will need to round the data before it’s displayed; either in your SQL query, in scripting before it’s displayed on the chart, or using the JFreeChart API (you will probably have the best results with the [Chart](https://docs.inductiveautomation.com/display/DOC79/Chart) component, which allows you to run a `configureChart` scripting function).

---

<div class="post-metadata">

**Author:** ![dturner](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dturner](https://forum.inductiveautomation.com/u/dturner)\
**Post date:** [November 14, 2017, 4:39pm UTC](https://forum.inductiveautomation.com/t/value-precision-in-a-bar-chart/15985/3 "2017-11-14T16:39:57Z")

</div>

The result data in the SQL query is already in the format, #.##, that I am trying to achieve. Does that need to be converted to something else or am I misunderstanding your statement? The only place it is displayed with a lot of numbers behind the decimal is the bar chart.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [November 14, 2017, 6:43pm UTC](https://forum.inductiveautomation.com/t/value-precision-in-a-bar-chart/15985/4 "2017-11-14T18:43:28Z")

</div>

The result data you see in management studio/workbench/etc does not indicate how the value is actually stored in binary. Explicitly round the results and you should get the expected output.

---

<div class="post-metadata">

**Author:** ![dturner](https://avatars.discourse-cdn.com/v4/letter/d/90ced4/32.png) [@dturner](https://forum.inductiveautomation.com/u/dturner)\
**Post date:** [November 14, 2017, 8:51pm UTC](https://forum.inductiveautomation.com/t/value-precision-in-a-bar-chart/15985/5 "2017-11-14T20:51:34Z")

</div>

Thank you! I understand now and I am getting the values I expect.
