I am trying to include on the same brilliant page both the map flyer and the nvd3 rCharts graph. When I do this, the sheet no longer displays the circles / POIs that I used to display on the map (not including nvd3). I suspect this is a JS / CSS conflict, because when I try to include them separately, it works just fine.
As soon as I run "runapp" and look at the html-code, I see that the only difference when including both leaflets and nvd3 is the libraries used:
<link href="nvd3/css/nv.d3.css" rel="stylesheet"/>
<link href="nvd3/css/rNVD3.css" rel="stylesheet"/>
<script src="nvd3/js/d3.v3.min.js" type="text/javascript"></script>
<script src="nvd3/js/nv.d3.min-new.js" type="text/javascript"></script>
<script src="nvd3/js/fisheye.js" type="text/javascript"></script>
<link href="leaflet/external/leaflet.css" rel="stylesheet"/>
<link href="leaflet/external/leaflet-rCharts.css" rel="stylesheet"/>
<link href="leaflet/external/legend.css" rel="stylesheet"/>
<script src="leaflet/external/leaflet.js" type="text/javascript"></script>
<script src="leaflet/external/leaflet-providers.js" type="text/javascript"></script>
<script src="leaflet/external/Control.FullScreen.js" type="text/javascript"></script>
when the nvd3 libraries load, I assume it is messing with the worksheet. So I am wondering if anyone has a quick solution to selling this problem?
Below is a fragment of the mainPanel file of the UI.R block
mainPanel(
tabsetPanel(
tabPanel("All trips", tableOutput("view"), tags$head(tags$style("#view th {color:slategray; background-color: #F2F2F2; text-align:left}", media="screen", type="text/css")),
conditionalPanel(
condition = "input.comparison == true",
showOutput('comp1', 'nvd3'),
br(),
br(),
br(),
br(),
showOutput('comp2', 'nvd3'),
br(),
br(),
br(),
br()
)
),
tabPanel("Selected trip",
tabsetPanel(
tabPanel("map", tags$style('.leaflet {height: 400px;}'), showOutput('myChart', 'leaflet'),
br(),
h2("Detailed information", style = "color:slategray; border-bottom:2px solid slategray; padding-bottom: 0.1in"), htmlOutput('details')
),
dat_list <- toJSONArray2(dat, json = F)
L1 <- Leaflet$new()
mid <- round(nrow(dat),0)/2
L1$setView(c(dat$lat[mid], dat$lng[mid]), 13)
L1$geoJson(toGeoJSON(dat_list, lat = 'lat', lon = 'lng'),
onEachFeature = '#! function(feature, layer){
layer.bindPopup(feature.properties.label)
} !#',
pointToLayer = "#! function(feature, latlng){
return L.circleMarker(latlng, {
radius: 4,
fillColor: feature.properties.Color || 'red',
color: '#000',
weight: 1,
fillOpacity: 0.8
})
} !#"
)
L1
}
nvd3 :
p <- nPlot(AC ~ Time, group = "id", data = t, type = "lineWithFocusChart")
p$xAxis( tickFormat="#!function(d) {return d3.time.format('%X')(new Date(d));}!#" )
p$x2Axis( tickFormat="#!function(d) {return d3.time.format('%X')(new Date(d));}!#" )
!