Welcome Guest! To enable all features please Login or Register.



Go to last post Go to first unread
#1 Posted : Thursday, August 8, 2019 8:54:28 AM(UTC)

Rank: Member

Groups: Registered
Joined: 4/7/2019(UTC)
Posts: 24

Thanks: 7 times
We're trying several ways to get a data element value with a specific unit measure but we don't success. Moreover, the result is different if we get the result in datable or chart.
For instance, I've a field that is the difference in hours between two datetime's. I want to view the number with two decimals (like D2) followed by "h".
Following .Net instructions, if I add something between simple or double quotes, this displayed value should concatenate it. But it doesn't work. Examples. The calculated value is 335,6167:

Format D2: In chart I get 335,62 (OK). In datable I get 335,6167 (No OK).
Format D2 "h": In chart I get 335,6167 (No OK). In datable I get D2 h (h without quotes, like if it recognized the concatenation but not the number. No OK)

Format 0.00: In chart I get 335,6167(No OK). In datatable I get 335,62 (OK).
Format 0.00 "h": In chart I get 335,6167(No OK). In datable I get 335,62 h (OK).

So, the only way to see the result OK is woth a datable and format 0.00. There is no way to get correctly the number with the chart (same results with the three supported chart libraries).

Thanks in advance
#2 Posted : Wednesday, August 14, 2019 2:24:34 PM(UTC)

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 989

Thanks: 14 times
Was thanked: 169 time(s) in 163 post(s)
Yes, custom format are limited for charts as the conversion tend to be automatic,
which is difficult from .Net format to go to the D3 format used by the charts.
this could be enhanced in a future release...

however it is easy to modify your chart template to have the format wanted,
e.g. for chart JS:
edit your chartJS view template and just modify the lines:

Line 89 for the ToolTip
                            else valStr = d3.format(",.2f")(val) + " \'Day\'";

Line 159 for the axis
                                        return d3.format(",.2f")(label) + " \'Day\'";

This correspond to the Custom .Net:
#,##0.00 "'Day'"

This is just a sample, you might change it if the axis is a date, etc.
Users browsing this topic
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.