Round to 2 decimals in a line chart.

1
Hi, I have a line chart that is filled with data from a microflow. What i want to do is round the numbers to 2 decimals. Where can i change this, i cant round it anywhere.  
asked
5 answers
0

Hi Mayhan,

  Are you using the Mendix 'Charts' widget collection? https://appstore.home.mendix.com/link/app/105695/

  If so, there is an 'Advanced' tab where you can set layout and data options.  You will need to use JSON to pass the parameters along.  I believe the option you want is 'hoverformat' so your layout JSON might look like:

{

"yaxis":{"hoverformat": ".2f"}

}

*EDIT - added quotation marks to JSON

Here is a link to more information on hover configuration of the the plotly.js library.  Plotly is what the Mendix Charts widget package uses.

  Worst case, you could create a display value attribute in your entities and round everything to 2 places in an on-commit microflow.  I think you should be able to accomplish this without changing your data, however, so try the Charts widget package 

answered
0

answered
0

Hi Mayhan,

  It is still JSON, so you will need to include quotation marks.  It looks like you already are using valid JSON to do some formatting in your layout options.  The property I mentioned is no different from zerolinewidth. Try adding the hoverformat option to your existing yaxis layout string instead of adding it to the Configuration Options box. So something like:

{ "font": { ……} "yaxis" : { "zerolinewidth": 1, "zerolinecolor": "black", "hoverformat": ".2f"}….

answered
0

Hi Rob,

It looks like this now, but still dont work, do you have any idea why?

 

Also is it possible to group digit the numbers and round to 0 decimal so 165658,06465 be 165.658

answered
0

I’ve been having this issue for years with still no solution. Has anyone solved this problem?

answered