 $(document).ready ->
-  params = fromURLParameter(location.search.slice(1))
-  id = params.userId
-  fetch("/api/user/#{id}/focal")
-    .then (res) -> res.json()
-    .then (json) -> renderFocalGraph(json)
-  fetch("/api/user/#{id}/iso")
-    .then (res) -> res.json()
-    .then (json) -> renderISOGraph(json)
-  fetch("/api/user/#{id}/f_number")
-    .then (res) -> res.json()
-    .then (json) -> renderFNumberGraph(json)
-  fetch("/api/user/#{id}/exposure")
-    .then (res) -> res.json()
-    .then (json) -> renderExposureGraph(json)
-  fetch("/api/user/#{id}/camera")
-    .then (res) -> res.json()
-    .then (json) -> renderCameraGraph(json)
-  fetch("/api/user/#{id}/lens")
-    .then (res) -> res.json()
-    .then (json) -> renderLensGraph(json)
+  params = new URLSearchParams(location.search.slice(1))
+  id = params.get('userId')
+  fetch("/api/user/#{id}/focal?#{params.toString()}")
+    .then (res) -> res.json()
+    .then (json) ->
+      chart = renderFocalGraph(json)
+      clickFocal(chart)
+  fetch("/api/user/#{id}/iso?#{params.toString()}")
+    .then (res) -> res.json()
+    .then (json) ->
+      chart = renderISOGraph(json)
+      clickISO(chart)
+  fetch("/api/user/#{id}/f_number?#{params.toString()}")
+    .then (res) -> res.json()
+    .then (json) ->
+      chart = renderFNumberGraph(json)
+      clickFNumber(chart)
+  fetch("/api/user/#{id}/exposure?#{params.toString()}")
+    .then (res) -> res.json()
+    .then (json) ->
+      chart = renderExposureGraph(json)
+      clickExposure(chart)
+  fetch("/api/user/#{id}/camera?#{params.toString()}")
+    .then (res) -> res.json()
+    .then (json) ->
+      chart = renderCameraGraph(json)
+      clickCamera(chart)
+  fetch("/api/user/#{id}/lens?#{params.toString()}")
+    .then (res) -> res.json()
+    .then (json) ->
+      chart = renderLensGraph(json)
+      clickLens(chart)
 
 focalGroup = [10, 15, 20, 25, 30, 35, 40, 45, 50, 60, 70, 80, 90, 100, 150, 200, 250, 300, 400, 500, 600, 800, 1000, 1500, 2000]
 renderFocalGraph = (elems) ->

    options: _.merge(barOptions('Focal count (35mm equivalent)'), xScaleLabel('mm'))
  }

renderISOGraph = (elems) ->
  ctx = getCtx('isoChart')
  elemGroup = _.groupBy elems, (elem) ->

        backgroundColor: colorSet(0.5)
      }]
  }

clickLens = (chart) ->
  document.getElementById('lensChart').onclick = (evt) ->
    points = chart.getElementsAtEvent(evt)
    lens = lensIds[points[0]._index]
    addParams({lens: lens})

colorSet = (a) -> [
  "rgba(0, 65, 255, #{a})",
