Giter Site home page Giter Site logo

Comments (15)

tim-salabim avatar tim-salabim commented on May 21, 2024 2

Sorry for the long silence on this. After talking to @swoellauer I think we have a plan of action now that should enable legends in both slideView and plainView.

from mapview.

tim-salabim avatar tim-salabim commented on May 21, 2024 1

Thanks @fdetsch ! The issue of bad font rendering of the legend under windows seemed to have been antialiasing. I have now set antialiasing = "none" which seems to resolve this. See a73462c

from mapview.

tim-salabim avatar tim-salabim commented on May 21, 2024

In general, I do like the idea, however, in your example you are referring to RGB images for which a legend does not make much sense in my opinion.

@swoellauer would you have some time to look into this? 2 separate divs on each side with their own legends. I guess we could simply hijack leaflet legends for this.

from mapview.

danklotz avatar danklotz commented on May 21, 2024

well yeah, but one gets the gist.

from mapview.

tim-salabim avatar tim-salabim commented on May 21, 2024

@swoellauer I have just pushed an update that passes the filename of the legend png via the htmlwidget in plainview - RasterLayer method. Can you please check whether that is sufficient for adding a legend this way.

library(mapview)
plainview(poppendorf[[5]], legend = TRUE)

This should produce a valid x.leg_fl on the JS side which points to the legend png.

This is a rough implementation so far as the dimensions of the png are fixed (500 x 200 pixels height and width). I am yet to come up with a clever way to estimate the ratio properly (this is mainly depending on the values of the ticks - in the example above these are largish numbers so should be fine in most occasions, but still...). Also, this means that there is some white space (actually transparent space) around the legend, meaning we will need to find a way to crop/clip the png. This could easily be done on the R side using the magick package, yet I am a bit reluctant towards adding another dependency to mapview if not really needed. So, if there is a way to crop the image in JS (without adding another library dependency) then this would be great. If there isn't, then I guess importing the relevant function from magick is something we need to consider.

@danklotz this is currently only a test implemented in plainview for the easiest case of rendering a RatserLayer but if this works, adding the same to slideview should be straight forward.

from mapview.

tim-salabim avatar tim-salabim commented on May 21, 2024

@danklotz We have a first working legend for plainview can you please let us know if this is what you are after? plainview(poppendorf[[5]])

@swoellauer can we make this flexible, so that plainview(poppendorf[[5]], legend = FALSE) doesn't throw an error?

from mapview.

danklotz avatar danklotz commented on May 21, 2024

Sorry for the late reply.

The first commit (~8 days ago) did not work, but the current dev-version does! It looks a bit rough around the edges (as you said) but would be exactly what I would like to have (if implemented in slideview). Thank you very much πŸ’ƒ πŸ’ƒ πŸ’ƒ

from mapview.

tim-salabim avatar tim-salabim commented on May 21, 2024

@danklotz could you be more specific regarding 'a bit rough around the edges'? So we can try to smooth things... ;-)

from mapview.

danklotz avatar danklotz commented on May 21, 2024

Oh... Well this might be picky, but the rendering/transparency of the font seems off. One can see slight white pixels around it.

from mapview.

tim-salabim avatar tim-salabim commented on May 21, 2024

@danklotz what OS are you using? I don't see any rendering issues on Linux...

@swoellauer I have just updated the R side of cube and plainview to include laegends. Can you adjust JS side to enable legend rendering?

from mapview.

danklotz avatar danklotz commented on May 21, 2024

used windows. Will check it on mac os to then

from mapview.

tim-salabim avatar tim-salabim commented on May 21, 2024

@danklotz slideview and cubeview now also have legends (for numeric data). Testing welcome. Regarding the rough look, I can replicate that on windows and will look into that. Linux seems to render fine. Did get a chance to try on mac?

from mapview.

tim-salabim avatar tim-salabim commented on May 21, 2024

Here's what it looks like on linux

screenshot from 2017-03-06 07 53 19

from mapview.

danklotz avatar danklotz commented on May 21, 2024

Mac rendering looks fine to! Attached a screenshot of the plainview example from above.
mac

from mapview.

fdetsch avatar fdetsch commented on May 21, 2024

plainview works like a charm on Windows as well:
plainview

from mapview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.