5e6ba8af
isisadmin
datalet doc update
|
1
2
3
4
|
<!--
@license
The MIT License (MIT)
|
b4accc86
Renato De Donato
datalet improved
|
5
|
Copyright (c) 2015 Dipartimento di Informatica - Universit� di Salerno - Italy
|
5e6ba8af
isisadmin
datalet doc update
|
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-->
|
ae17a8dc
Luigi Serra
Controllet and da...
|
26
|
<!--
|
950d181d
Luigi Serra
license updates
|
27
28
|
* Developed by :
* ROUTE-TO-PA Project - grant No 645860. - www.routetopa.eu
|
ae17a8dc
Luigi Serra
Controllet and da...
|
29
30
31
|
*
-->
|
98d9d8a5
Renato De Donato
filters+groupby
|
32
|
<link rel="import" href="../base-ajax-json-alasql-datalet/base-ajax-json-alasql-datalet.html">
|
73bcce88
luigser
COMPONENTS
|
33
|
|
5e6ba8af
isisadmin
datalet doc update
|
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
<!--
The `highcharts-datalet` uses the base-ajax-json-jsonpath-datalet as data retriving and selection mechanism. It defines the common properties
for all the highchart datalets : categories, series and series_type. Overmore override the transformData method
to create and populate categories and series array. Every specific highchart chart implementation (eg linechart, barchart, columnchart ...)
will use highcharts-datalet properties to create the appropriate chart.
Example :
<dom-module id="highcarts-chart-datalet">
<template>
...
<highcharts-datalet id="charts" data-url="{{dataUrl}}" fields="{{fields}}"></highcharts-datalet>
...
</template>
</dom-module>
@element highcharts-datalet
@status v0.1
@homepage
@group datalets
-->
|
73bcce88
luigser
COMPONENTS
|
56
|
<dom-module id="highcharts-datalet">
|
a1f0799c
isisadmin
datalet global re...
|
57
|
|
73bcce88
luigser
COMPONENTS
|
58
59
|
<template>
<div id="container" style="width:auto; height:auto;"></div>
|
498cdf34
Andrea Petta
leafletjs
|
60
|
<base-ajax-json-alasql-datalet data-url="{{dataUrl}}" fields="{{fields}}" data="{{data}}" title="{{title}}" description="{{description}}" export_menu="{{export_menu}}"></base-ajax-json-alasql-datalet>
|
73bcce88
luigser
COMPONENTS
|
61
|
</template>
|
a1f0799c
isisadmin
datalet global re...
|
62
|
|
5e6ba8af
isisadmin
datalet doc update
|
63
|
<script src="static/js/highcharts.js"></script>
|
9819a403
Renato De Donato
bubble scatter tr...
|
64
|
<script src="static/js/highcharts-more.js"></script>
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
65
|
<script src="static/themes/themes.js"></script>
|
a1f0799c
isisadmin
datalet global re...
|
66
|
|
73bcce88
luigser
COMPONENTS
|
67
68
|
<script>
var HighchartsBehavior = {
|
a1f0799c
isisadmin
datalet global re...
|
69
|
|
73bcce88
luigser
COMPONENTS
|
70
|
properties: {
|
73bcce88
luigser
COMPONENTS
|
71
72
73
74
|
categories: {
type: Array,
value: []
},
|
73bcce88
luigser
COMPONENTS
|
75
76
77
|
series: {
type: Array,
value: []
|
420ea6ab
Renato De Donato
workcicle...
|
78
|
}
|
73bcce88
luigser
COMPONENTS
|
79
|
},
|
a1f0799c
isisadmin
datalet global re...
|
80
|
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
81
|
transformData: function () {
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
82
83
|
if(this.data.length == 0)
return;
|
a1f0799c
isisadmin
datalet global re...
|
84
|
|
256ece27
Renato De Donato
new controllet
|
85
86
87
88
89
90
91
92
93
94
|
var selectedFields = JSON.parse(this._component.getAttribute("selectedfields"));
var inputs = [];
if(selectedFields) { /*if deprecated*/
for (var i=0; i < selectedFields.length; i++)
if (selectedFields[i])
inputs.push(selectedFields[i].field);
}
var cat_index = inputs.indexOf("Categories");
|
0f4f5f1b
Renato De Donato
new datalets mult...
|
95
|
|
256ece27
Renato De Donato
new controllet
|
96
97
98
99
100
|
if(cat_index == -1) {
categories = this.data[0].data;
series = [];
for (var i = 1; i < this.data.length; i++)
series.push(this.data[i]);
|
0b7cbd33
Renato De Donato
title-desciption
|
101
|
|
256ece27
Renato De Donato
new controllet
|
102
103
104
105
|
this.properties.categories.value = categories;
this.properties.series.value = series;
}
else {
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
106
|
var x = this.data[0]["data"];
|
256ece27
Renato De Donato
new controllet
|
107
108
|
var y = this.data[1]["data"];
var cat = this.data[cat_index]["data"];
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
109
110
111
|
var categories = x.filter(function(item, pos) {
return x.indexOf(item) == pos;
|
256ece27
Renato De Donato
new controllet
|
112
|
});
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
113
|
|
256ece27
Renato De Donato
new controllet
|
114
115
116
|
var s = cat.filter(function(item, pos) {
return cat.indexOf(item) == pos;
});
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
117
118
119
120
121
122
|
var series = [];
for(var i = 0; i < s.length; i++) {
series.push({name: s[i], data: new Array(categories.length+1).join('0').split('').map(parseFloat)});
}
|
0f4f5f1b
Renato De Donato
new datalets mult...
|
123
|
for(var i = 0; i < y.length; i++){
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
124
125
|
var index = categories.indexOf(x[i]);
var s = series.filter(function( obj ) {
|
256ece27
Renato De Donato
new controllet
|
126
|
return obj.name == cat[i];
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
127
|
});
|
0f4f5f1b
Renato De Donato
new datalets mult...
|
128
|
s[0]["data"][index] = y[i];
|
fb05b400
Renato De Donato
controllet 2.0, n...
|
129
130
131
132
|
}
this.properties.categories.value = categories;
this.properties.series.value = series;
|
b4accc86
Renato De Donato
datalet improved
|
133
|
}
|
71ed2ed2
Renato De Donato
redraw
|
134
135
136
|
},
redraw: function () {
|
ff028a33
Andrea Petta
plugin update
|
137
|
$(this._component.$.charts.$.container).highcharts().reflow();
|
420ea6ab
Renato De Donato
workcicle...
|
138
|
}
|
8afca675
Renato De Donato
title-description
|
139
|
|
73bcce88
luigser
COMPONENTS
|
140
141
|
};
|
98d9d8a5
Renato De Donato
filters+groupby
|
142
|
var HighchartsComponentBehavior = $.extend(true, {}, BaseDataletBehavior, WorkcycleBehavior, AjaxJsonAlasqlBehavior, HighchartsBehavior);
|
73bcce88
luigser
COMPONENTS
|
143
144
145
146
147
148
149
|
HighchartsDatalet = Polymer({
is : 'highcharts-datalet'
});
</script>
</dom-module>
|