djay / covidthailand

Thailand Covid testing and case data gathered and combined from various sources for others to download or view
126 stars 15 forks source link

SVG with interactive tooltip #217

Closed djay closed 2 years ago

djay commented 2 years ago
djay commented 2 years ago

Maybe a format like this?

*7 May 2021* (7 day average)
o PCR tests Daily
    72345 (71k) - 23%
o ATK rapid tests (free NHSO)
    45343 (42k) - 16%

% would only show when there is a % plot below a stacked area plot

Is this obvious enough to know which is the actual value and which is the avg?

modiholodri commented 2 years ago

@djay Two lines per tooltip entry might be too much and mix lines and patches makes the tooltip wrong.

image

djay commented 2 years ago

@modiholodri you are right two lines won't work. and wrapping to 2 columns doesn't solve it. And we also need to make the font bigger as its currently too small and this will make it even worse.

So I guess its one line but how to do that nicely given there is no text wrapping is svg?

One way is to try doing it with embedded HTML which might be easier regardless.

Or maybe try putting the numbers between the dot and the label? if we can left align the labels so its a table it would be nice but again I think html is only way to do that simply?

djay commented 2 years ago

@modiholodri you can see on this one that the two lines makes it harder to read even when small numbers

Screen Shot 2021-12-15 at 9 35 54 am

I think if we have the dots then its better to have the numbers and text in white since its much easier to read. and matching the colours is less important since we have the labels there anyway. the main reason you are hovering is to get the exact number not use it as a legend I think?

djay commented 2 years ago

@modiholodri here is another example. It works ok with a table. I guess it makes more sense for the numbers to be on the right of the label like this Screen Shot 2021-12-15 at 6 04 38 pm

modiholodri commented 2 years ago

@djay I'll make a new version, probably during the weekend. Had a giant dot in there before (see picture above) but maybe it was too big and did not look good. There is also another quite serious issue, with browsers in night mode (might be experimental, but I am for sure not the only one), because everything will be white. I have the same issue on my mobile and desktop... And that would favor colored text, because the light grey text is nearly invisible...

image

djay commented 2 years ago

@modiholodri the dots looked fine I think. The white background creates many more problems so that needs to be fixed regardless. On my mobile I don't get it. I wonder where its coming from? Maybe we have to manually set a fill colour on the back or even add a background element?

djay commented 2 years ago

@modiholodri switched it to using html table which works ok. But haven't got the positioning right and show how now works not embedded over the whole plot but embedded it only works on the left. Tried to fix the font. not sure why that didn't work. haven't tested the background yet. Screen Shot 2021-12-20 at 10 10 52 am

djay commented 2 years ago

@modiholodri did a few updates. it's almost there. It now sorts based on value

image
djay commented 2 years ago

Bugs