Blame view

datalets/google-map/google-map-datalet.html 1.94 KB
73bcce88   luigser   COMPONENTS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
  <link rel="import" href="../../bower_components/polymer/polymer.html">

  <link rel="import" href="../base-csv-datalet/base-csv-datalet.html">

  <link rel="import" href="http://www.vm.webcomponents.com/webComp/COMPONENTS/bower_components/google-map/google-map.html">

  

  <dom-module id="google-map-datalet">

      <template>

  

          <google-map id="map" fit-to-markers>

              <template is="dom-repeat" items="{{markers}}">

                  <google-map-marker latitude="{{item.Lat}}" longitude="{{item.Lng}}">

                  </google-map-marker>

              </template>

          </google-map>

  

          <base-datalet data_url="{{data_url}}" query="{{query}}"></base-datalet>

  

      </template>

  

      <script src="../shared_js/papa_parse/papaparse.min.js"></script>

  

      <script>

          var googleMapBehavior = {

  

              selectData: function(e){

              },

  

              transformData: function(){

  

                  var behavior = this;

  

                  Papa.parse(this.properties.csv_results.value, {

                      header:true,

                      skipEmptyLines:true,

                      complete: function(results, file) {

                          behavior.properties.data.value = results;

                          behavior._component.markers = googleMapComponentBehavior.properties.data.value.data;

                      }

                  });

              }

          };

  

          var googleMapComponentBehavior =  $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, CVSDataRequestBehavior, googleMapBehavior);

  

          Polymer({

              is : 'google-map-datalet' ,

  

              ready: function(){

                  googleMapComponentBehavior.init(this);

              },

  

              //markers : null

  

              properties : {

                  markers :

                  {

                      type : Array,

                      value : []

                  }

              }

          });

      </script>

  </dom-module>