Blame view

datalets/column3Dchart-datalet/column3Dchart-datalet.html 3.75 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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
  <link rel="import" href="../../bower_components/polymer/polymer.html">

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

  

  <link rel="import" href="../../bower_components/iron-ajax/iron-ajax.html">

  <script src="http://code.highcharts.com/highcharts-3d.js"></script>

  

  

  

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

  

      <template>

          <table>

              <tr><td>Alpha Angle</td><td><input id="R0" type="range" min="0" max="45" value="15"/> <span id="R0-value" class="value"></span></td></tr>

              <tr><td>Beta Angle</td><td><input id="R1" type="range" min="0" max="45" value="15"/> <span id="R1-value" class="value"></span></td></tr>

          </table>

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

      </template>

  

      <script>

          var chart = null;

  

  

          var column3DchartBehavior = {

  

  

              transformData: function(){

                           //Bluid Highchart element

                           chart = new Highcharts.Chart({

                               chart: {

                                   //To Modify renderTo: 'container',

                                   renderTo: this._component.$.charts.$.container,

                                   borderColor: '#EBBA95',

                                   borderWidth: 2,

                                   zoomType : 'xy',

                                   type: 'line',

                                   type: 'column',

                                   margin: 75,

                                   options3d: {

                                       enabled: true,

                                       alpha: 15,

                                       beta: 15,

                                       depth: 50,

                                       viewDistance: 25

                                   }

                               },

                               xAxis: {

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

                                   title: {

                                       text: null

                                   }

                               },

                               title: {

                                   text: this.properties.title

                               },

                               subtitle: {

                                   text: '3D CHART demo by dragging the sliders below'

                               },

                               plotOptions: {

                                   column: {

                                       depth: 25

                                   }

                               },

  

                       series: this.properties.series.value

                  });//highcharts

  

                  // Activate the sliders

                  $('#R0').on('change', function () {

                      chart.options.chart.options3d.alpha = this.value;

                      chart.redraw(false);

                  });

  

                  $('#R1').on('change', function () {

                      chart.options.chart.options3d.beta = this.value;

                      chart.redraw(false);

                  });

              }

          };

  

          //element registration

          column3DchartDatalet = Polymer({

              is: 'column3Dchart-datalet',

  

              ready: function(){

                  var column3DchartComponentBehavior = $.extend({}, HighchartsComponentBehavior, column3DchartBehavior);

                  column3DchartComponentBehavior.properties = $.extend({}, HighchartsComponentBehavior.properties, column3DchartBehavior.properties);

  

                  column3DchartComponentBehavior.init(this);

              }

          });

      </script>

  </dom-module>