Blame view

datalets/barchart-datalet/barchart-datalet.html 2.73 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
64
65
66
67
68
69
70
71
72
73
74
  <link rel="import" href="../../bower_components/polymer/polymer.html">

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

  

  <dom-module name="barchart-datalet">

      <template>

          <highcharts-datalet id="charts" data-url="{{dataUrl}}" query="{{query}}" fields-order="{{fieldsOrder}}"></highcharts-datalet>

      </template>

      <script>

          var BarchartBehavior = {

              transformData: function(){

                  //Bluid Highchart element

                  $(this._component.$.charts.$.container).highcharts({

                      chart: {

                          type: 'bar',

                          zoomType: 'xy'

                      },

                      title: {

                          text: 'Bar chart'

                      },

                      xAxis: {

                          categories: this.properties.categories.value,//this._component.categories,

                          title: {

                              text: null

                          }

                      },

                      yAxis: {

                          min: 0,

                          title: {

                              text: 'Foreclosure (units)',

                              align: 'high'

                          },

                          labels: {

                              overflow: 'justify'

                          }

                      },

                      tooltip: {

                          valueSuffix: ' units'

                      },

                      plotOptions: {

                          bar: {

                              dataLabels: {

                                  enabled: true

                              }

                          }

                      },

                      legend: {

                          layout: 'vertical',

                          align: 'right',

                          verticalAlign: 'top',

                          x: -40,

                          y: 100,

                          floating: true,

                          borderWidth: 1,

                          backgroundColor: ((Highcharts.theme && Highcharts.theme.legendBackgroundColor) || '#FFFFFF'),

                          shadow: true

                      },

                      credits: {

                          enabled: false

                      },

                      series: this.properties.series.value//this._component.series

                  });

              }

          };

  

          BarchartDatalet = Polymer({

              is: 'barchart-datalet',

              ready: function(){

  

                  var BarchartComponentBehavior = $.extend(true, {}, HighchartsComponentBehavior, BarchartBehavior);

                  BarchartComponentBehavior.init(this);

              }

          });

      </script>

  </dom-module>