rte-antares-rpackage / antaresViz

ANTARES Visualizations
https://rte-antares-rpackage.github.io/antaresViz
20 stars 12 forks source link

update leaflet : plotMap bugs ? #163

Closed jalazawa closed 6 years ago

jalazawa commented 6 years ago

I received this mail


Hi leaflet Reverse Dependency Maintainer,

This is an email to let you know about the upcoming release of `leafet` version 2.0.0, which will be submitted to CRAN on April 16th, 2018.

Previous releases of the `leaflet` R package used leaflet.js v0.7.x.  This release upgrades us to leaflet.js v1.3.1, which is not completely backward compatible with leaflet.js v0.7.x.  For this reason, we highly recommend you manually test your packages for breakage. 

To check for potential R problems, I ran R CMD check on your package on my personal machine. If I could install your package, I did not find any new issues while updating `leaflet`.  To see any problems, please visit https://github.com/rstudio/leaflet/blob/master/revdep/problems.md.

To get the development version of `leaflet` so you can run checks yourself, you can run:

`r
devtools::install_github("rstudio/leaflet")
`

To see what's changed, please visit https://github.com/rstudio/leaflet/blob/master/NEWS. To see a list of all reverse dependency checks for `leaflet` visit https://github.com/rstudio/leaflet/blob/master/revdep/.

If you have any questions, please feel free to respond directly to this email.

Best, 
Barret

When I test plotMap with the previous version --> OK

studyPath<-"E:\\ANTARES\\Exemple_antares\\2_exemple_etudes_importantes\\TYNDP\\ST2030\\ST2030"
setSimulationPath(studyPath,-1)

myData<-readAntares(areas = "all", links = "all", linkCapacity = TRUE)

myDataR<-removeVirtualAreas(myData, storageFlexibility = getAreas(select = c("z_dsr", "turb", "pump")), newCols = TRUE)

ml<-readRDS("E:\\ANTARES\\Exemple_antares\\2_exemple_etudes_importantes\\TYNDP\\mapLayoutTyndp.RDS")

varPlotMap<-c("WIND", "SOLAR")
addLoadFactorLink(myDataR)
plotMap(
  myDataR, 
  ml, 
  sizeAreaVars = varPlotMap, 
  interactive = FALSE)

result

leaflet_1

Now with the new version

devtools::install_github("rstudio/leaflet")

plotMap(
  myDataR, 
  ml, 
  sizeAreaVars = varPlotMap, 
  interactive = FALSE)

result (no addin in the map)

leaflet_2

But, the problem is not in antaresViz, I think it's related with leaflet.minichart.

I tried examples of addFlows with the previous version, it's ok with the new one it's KO

## test leaflet.minicharts 

require(leaflet)
library(leaflet)
library(magrittr)
library(leaflet.minicharts)
# Toy example
leaflet() %>% addTiles() %>%
  addFlows(0, 0, 1, 1, flow = 10)

# Electric exchanges between France and neighbouring countries
data("eco2mixBalance")
bal <- eco2mixBalance
leaflet() %>% addTiles() %>%
  addFlows(
    bal$lng0, bal$lat0, bal$lng1, bal$lat1,
    flow = bal$balance,
    time = bal$month
  )

And maybe, the problem is in the lib js leaflet.minichart

https://github.com/rte-antares-rpackage/leaflet.minichart

jalazawa commented 6 years ago

I tried also addMinicharts and this function works with leaflet 2.0.0 (the new one)

library(leaflet)
library(magrittr)
library(leaflet.minicharts)

mymap <- leaflet() %>% addTiles() %>% addMinicharts(0, 0, chartdata = 1:3, layerId = "c1")

mymap
mymap %>% updateMinicharts("c1", maxValues = 6)
mymap %>% updateMinicharts("c1", type="pie")
bthieurmel commented 6 years ago

C'est ok, et a priori pour les deux versions du package leaflet.

Modification apportée dans ici https://github.com/rte-antares-rpackage/leaflet.flow/tree/leaflet_1.3.1

Et package R recompilé ici https://github.com/rte-antares-rpackage/leaflet.minicharts/tree/leaflet_2.0.0

Dans l'idéal, il faudra pousser leaflet.flow avec npm (cf mail françois)

jalazawa commented 6 years ago

OK