ThomUK / SPCreporter

Creates Metric Reports using Statistical Process Control in the NHS style
https://thomuk.github.io/SPCreporter/
Other
6 stars 2 forks source link

Y axis - do not use decimals when the unit of the measure is "integer" #30

Closed ThomUK closed 1 year ago

ThomUK commented 1 year ago

Currently, some measures with integer units render a y axis similar to this: image

francisbarton commented 1 year ago

I would think this is an issue with plotthedots and I am wondering if this might be related:

https://github.com/nhs-r-community/NHSRplotthedots/blob/main/R/ptd_spc.R#L126:L127

Even if you feed ptd_spc() integers, they will get converted to doubles.

ThomUK commented 1 year ago

You're right that plotthedots could handle this better if integer types were passed in. I'll raise an issue there before this is closed.

This package also knows the intended unit explicitly from the measure_config, so it may be worth handling specifically here too.

The "wide" format of the incoming data might be problematic if mixing integer and doubles and then letting plotthedots implicitly apply the right y axis (although they're both numeric, so there may be a way around that).

ThomUK commented 1 year ago

Investigated at length some time ago. There is no simple way to ensure the y axis gets at least two integer labels, as well as expands to cover the control limits appropriately. Closing as wontfix for now. Happy to accept PRs if anyone can find a way of handling the y axis scaling issues.