website icon indicating copy to clipboard operation
website copied to clipboard

Cases/Hospitalizations chart bar stacking bug

Open majazaloznik opened this issue 5 years ago • 1 comments

When removing variables from view that are subsets of visible variables, they are subtracted from the bar height, which they shouldn't be.

Minimal example: removing patients on ventilator from patients in ICU results in bar heights for "patients in ICU that are not on venitlator" instead of all patients in ICU.

Screenshot_2020-11-06_16-37-57

Screenshot_2020-11-06_16-38-38

majazaloznik avatar Nov 06 '20 16:11 majazaloznik

I think the right solution would be to track enable/disable events on legend items, like this: https://stackoverflow.com/questions/29833018/check-if-all-legend-items-are-selected-in-highcharts

That way, we would know which items are shown and we need to subtract only those from "supersets": https://github.com/sledilnik/website/blob/master/src/visualizations/PatientsChart.fs#L240

But since this would require chart.data change, I am not sure what is the best way to do it. Here is example how they change chart properties and they trigger chart.redraw afterwards: https://stackoverflow.com/questions/16073403/highcharts-how-to-programmatically-toggle-legend-items-and-determine-which-ite

But this requires proper developer like @joahim or @breki

lukarenko avatar Nov 07 '20 06:11 lukarenko