martykan / forecastie

A simple, opensource weather app for Android.
Other
865 stars 334 forks source link

Add directional arrows to wind speed graph #536

Open robinpaulson opened 3 years ago

robinpaulson commented 3 years ago

This might make the graph way too crowded, but i think it's worth investigating, at least for the "two days" graph.

An example, which works reasonably well on a phone screen:

https://www.windguru.net/station/766

robinpaulson commented 3 years ago

Perhaps we could set the interval between arrows based upon the screen resolution/size?

robinpaulson commented 3 years ago

From my measurements, the wind speed arrows we use appear to be a maximum of 20 pixels wide (east and west, the others are narrower). On my Galaxy S3 with a 720 pixel wide screen, there are 530 pixels for the graph canvas (removing the margins and the space for the units on the y-axis), which means if we have 16 arrows (8 per day, for two days), we will have around 33 pixels per arrow, which leaves a gap between arrows of ~13 pixels. I think that's enough, I'll make a mockup and post here.

robinpaulson commented 3 years ago

dir_arrows_mockup

So, in this example we start with a temperature of 24 deg C, from the West....

Also I used the wrong image as background, 5 day forecast instead of 2. It doesn't make a huge difference to the intent though.

robinpaulson commented 3 years ago

I'm sure it will look better with black arrows and no surrounding block.

robinpaulson commented 3 years ago

@FridoDeluxe I've had a look through the WC docs, to the extent they exist, and I don't think we can implement this using the published API, it would require a "hack" such as you did for the background bars to indicate days. I have an idea we could overlay another line chart on top of the wind speed, but offset upwards say 5 units, then use a custom (arrow) marker for the direction, and a hidden line. Given WC likely doesn't allow multiple markers per line graph, we may need 8 overlaid charts, one for each of the directional arrows (i.e. one for N, one for NE, one for E, etc.).

Does this sound doable? I realise it's very low priority, but it intrigues me to see if I can do it. It's also getting rather clunky and way beyond the bounds of what WC was intended for.

FridoDeluxe commented 3 years ago

I have no idea if and how WilliamChart allows to use custom markers. Is there any example for that? If it's possible this shouldn't add too much confusion to the code, it's like adding one other graph background (as all eight wind directions are of the same type basically). But with so many requirements it might be wise to drop the lightweightness and change to a charting library that has all these features (of course keeping the clean look) ...

Wouldn't it be better to include the wind direction into the wind speed graph instead of temperature? It's more related and you could compare wind direction and speed directly.

robinpaulson commented 3 years ago

I have no idea if and how WilliamChart allows to use custom markers. Is there any example for that?

i think so, i don't recall. i should look more, plus encourage the owner to do some better docs

If it's possible this shouldn't add too much confusion to the code, it's like adding one other graph background (as all eight wind directions are of the same type basically). But with so many requirements it might be wise to drop the lightweightness and change to a charting library that has all these features (of course keeping the clean look) ...

a different chart library is always possible, although it would be beyond my coding skills

Wouldn't it be better to include the wind direction into the wind speed graph instead of temperature? It's more related and you could compare wind direction and speed directly.

yeah, i realised afterwards i used the wrong chart when making the mock up, but as i said, it's about showing the idea not every detail.

robinpaulson commented 3 years ago

Perhaps we only draw arrows on the graph at the point the wind changes direction, that would save a lot of space and reduce clutter.