Version Description
FREE = * [new] Usage of WP Object Cache for stats * [new] Moved tracker data to WP Transient API * [change] Stats now counted per hour instead of per day * [change] Updated Elycharts to v2.1.6 * [fix] Post Injection not always in the right location for categories * [fix] Tracking hash split in the right values * [fix] Graph date labels showing through each other
Download this release
Release Info
Developer | adegans |
Plugin | AdRotate Banner Manager |
Version | 3.17 |
Comparing to | |
See all releases |
Code changes from version 3.16.3 to 3.17
- adrotate-functions.php +1 -124
- adrotate-manage-publisher.php +0 -1
- adrotate-output.php +3 -3
- adrotate-setup.php +15 -49
- adrotate-statistics.php +150 -86
- adrotate.php +4 -6
- dashboard/publisher/adverts-edit.php +12 -8
- dashboard/publisher/adverts-main.php +1 -3
- dashboard/publisher/groups-edit.php +1 -1
- dashboard/settings/maintenance.php +2 -2
- images/clicksor.png +0 -0
- images/viglink.png +0 -0
- library/elycharts.min.js +2 -2
- readme.txt +33 -11
adrotate-functions.php
CHANGED
@@ -146,127 +146,6 @@ function adrotate_is_tablet() {
|
|
146 |
return false;
|
147 |
}
|
148 |
|
149 |
-
/*-------------------------------------------------------------
|
150 |
-
Name: adrotate_count_impression
|
151 |
-
|
152 |
-
Purpose: Count Impressions where needed
|
153 |
-
Receive: $ad, $group
|
154 |
-
Return: -None-
|
155 |
-
Since: 3.10.12
|
156 |
-
-------------------------------------------------------------*/
|
157 |
-
function adrotate_count_impression($ad, $group = 0, $blog_id = 0, $impression_timer = 0) {
|
158 |
-
global $wpdb, $adrotate_config, $adrotate_debug;
|
159 |
-
|
160 |
-
if(($adrotate_config['enable_loggedin_impressions'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
|
161 |
-
$now = adrotate_now();
|
162 |
-
$today = adrotate_date_start('day');
|
163 |
-
$remote_ip = adrotate_get_remote_ip();
|
164 |
-
|
165 |
-
if($adrotate_debug['timers'] == true) {
|
166 |
-
$impression_timer = $now;
|
167 |
-
} else {
|
168 |
-
$impression_timer = $now - $impression_timer;
|
169 |
-
}
|
170 |
-
|
171 |
-
$saved_timer = $wpdb->get_var($wpdb->prepare("SELECT `timer` FROM `".$wpdb->prefix."adrotate_tracker` WHERE `ipaddress` = '%s' AND `stat` = 'i' AND `bannerid` = %d ORDER BY `timer` DESC LIMIT 1;", $remote_ip, $ad));
|
172 |
-
if($saved_timer < $impression_timer AND adrotate_is_human()) {
|
173 |
-
$stats = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `".$wpdb->prefix."adrotate_stats` WHERE `ad` = %d AND `group` = %d AND `thetime` = $today;", $ad, $group));
|
174 |
-
if($stats > 0) {
|
175 |
-
$wpdb->query("UPDATE `".$wpdb->prefix."adrotate_stats` SET `impressions` = `impressions` + 1 WHERE `id` = $stats;");
|
176 |
-
} else {
|
177 |
-
$wpdb->insert($wpdb->prefix.'adrotate_stats', array('ad' => $ad, 'group' => $group, 'thetime' => $today, 'clicks' => 0, 'impressions' => 1));
|
178 |
-
}
|
179 |
-
|
180 |
-
$wpdb->insert($wpdb->prefix."adrotate_tracker", array('ipaddress' => $remote_ip, 'timer' => $now, 'bannerid' => $ad, 'stat' => 'i', 'country' => '', 'city' => ''));
|
181 |
-
}
|
182 |
-
}
|
183 |
-
}
|
184 |
-
|
185 |
-
/*-------------------------------------------------------------
|
186 |
-
Name: adrotate_impression_callback
|
187 |
-
|
188 |
-
Purpose: Register a impression for dynamic groups
|
189 |
-
Receive: $_POST
|
190 |
-
Return: -None-
|
191 |
-
Since: 3.10.14
|
192 |
-
-------------------------------------------------------------*/
|
193 |
-
function adrotate_impression_callback() {
|
194 |
-
define('DONOTCACHEPAGE', true);
|
195 |
-
define('DONOTCACHEDB', true);
|
196 |
-
define('DONOTCACHCEOBJECT', true);
|
197 |
-
|
198 |
-
global $adrotate_debug;
|
199 |
-
|
200 |
-
$meta = $_POST['track'];
|
201 |
-
if($adrotate_debug['track'] != true) {
|
202 |
-
$meta = base64_decode($meta);
|
203 |
-
}
|
204 |
-
|
205 |
-
$meta = esc_attr($meta);
|
206 |
-
list($ad, $group, $blog_id, $impression_timer) = explode(",", $meta, 4);
|
207 |
-
adrotate_count_impression($ad, $group, $blog_id, $impression_timer);
|
208 |
-
|
209 |
-
wp_die();
|
210 |
-
}
|
211 |
-
|
212 |
-
|
213 |
-
/*-------------------------------------------------------------
|
214 |
-
Name: adrotate_click_callback
|
215 |
-
|
216 |
-
Purpose: Register clicks for clicktracking
|
217 |
-
Receive: $_POST
|
218 |
-
Return: -None-
|
219 |
-
Since: 3.10.14
|
220 |
-
-------------------------------------------------------------*/
|
221 |
-
function adrotate_click_callback() {
|
222 |
-
define('DONOTCACHEPAGE', true);
|
223 |
-
define('DONOTCACHEDB', true);
|
224 |
-
define('DONOTCACHCEOBJECT', true);
|
225 |
-
|
226 |
-
global $wpdb, $adrotate_config, $adrotate_debug;
|
227 |
-
|
228 |
-
$meta = $_POST['track'];
|
229 |
-
|
230 |
-
if($adrotate_debug['track'] != true) {
|
231 |
-
$meta = base64_decode($meta);
|
232 |
-
}
|
233 |
-
|
234 |
-
$meta = esc_attr($meta);
|
235 |
-
list($ad, $group, $blog_id, $impression_timer) = explode(",", $meta, 4);
|
236 |
-
|
237 |
-
if(is_numeric($ad) AND is_numeric($group) AND is_numeric($blog_id)) {
|
238 |
-
if(($adrotate_config['enable_loggedin_clicks'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
|
239 |
-
$remote_ip = adrotate_get_remote_ip();
|
240 |
-
|
241 |
-
if(adrotate_is_human() AND $remote_ip != "unknown" AND !empty($remote_ip)) {
|
242 |
-
$now = adrotate_now();
|
243 |
-
$today = adrotate_date_start('day');
|
244 |
-
|
245 |
-
if($adrotate_debug['timers'] == true) {
|
246 |
-
$click_timer = $now;
|
247 |
-
} else {
|
248 |
-
$click_timer = $now - $adrotate_config['click_timer'];
|
249 |
-
}
|
250 |
-
|
251 |
-
$saved_timer = $wpdb->get_var($wpdb->prepare("SELECT `timer` FROM `".$wpdb->prefix."adrotate_tracker` WHERE `ipaddress` = '%s' AND `stat` = 'c' AND `bannerid` = %d ORDER BY `timer` DESC LIMIT 1;", $remote_ip, $ad));
|
252 |
-
if($saved_timer < $click_timer) {
|
253 |
-
$stats = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `".$wpdb->prefix."adrotate_stats` WHERE `ad` = %d AND `group` = %d AND `thetime` = $today;", $ad, $group));
|
254 |
-
if($stats > 0) {
|
255 |
-
$wpdb->query("UPDATE `".$wpdb->prefix."adrotate_stats` SET `clicks` = `clicks` + 1 WHERE `id` = $stats;");
|
256 |
-
} else {
|
257 |
-
$wpdb->insert($wpdb->prefix.'adrotate_stats', array('ad' => $ad, 'group' => $group, 'thetime' => $today, 'clicks' => 1, 'impressions' => 1));
|
258 |
-
}
|
259 |
-
|
260 |
-
$wpdb->insert($wpdb->prefix.'adrotate_tracker', array('ipaddress' => $remote_ip, 'timer' => $now, 'bannerid' => $ad, 'stat' => 'c', 'country' => '', 'city' => ''));
|
261 |
-
}
|
262 |
-
}
|
263 |
-
}
|
264 |
-
|
265 |
-
unset($remote_ip, $track, $meta, $ad, $group, $remote, $banner);
|
266 |
-
}
|
267 |
-
|
268 |
-
wp_die();
|
269 |
-
}
|
270 |
/*-------------------------------------------------------------
|
271 |
Name: adrotate_filter_schedule
|
272 |
|
@@ -400,9 +279,7 @@ function adrotate_select_categories($savedcats, $count = 2, $child_of = 0, $pare
|
|
400 |
$output = '';
|
401 |
if($parent == 0) {
|
402 |
$output = '<table width="100%">';
|
403 |
-
|
404 |
-
$output .= '<thead><tr><td scope="col" class="manage-column check-column" style="padding: 0px;"><input type="checkbox" /></td><td style="padding: 0px;">Select All</td></tr></thead>';
|
405 |
-
}
|
406 |
$output .= '<tbody>';
|
407 |
}
|
408 |
foreach($categories as $category) {
|
146 |
return false;
|
147 |
}
|
148 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
/*-------------------------------------------------------------
|
150 |
Name: adrotate_filter_schedule
|
151 |
|
279 |
$output = '';
|
280 |
if($parent == 0) {
|
281 |
$output = '<table width="100%">';
|
282 |
+
$output .= '<thead><tr><td scope="col" class="manage-column check-column" style="padding: 0px;"><input type="checkbox" /></td><td style="padding: 0px;">Select All</td></tr></thead>';
|
|
|
|
|
283 |
$output .= '<tbody>';
|
284 |
}
|
285 |
foreach($categories as $category) {
|
adrotate-manage-publisher.php
CHANGED
@@ -489,7 +489,6 @@ function adrotate_reset($id) {
|
|
489 |
|
490 |
if($id > 0) {
|
491 |
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d", $id));
|
492 |
-
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE `bannerid` = %d", $id));
|
493 |
}
|
494 |
}
|
495 |
|
489 |
|
490 |
if($id > 0) {
|
491 |
$wpdb->query($wpdb->prepare("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d", $id));
|
|
|
492 |
}
|
493 |
}
|
494 |
|
adrotate-output.php
CHANGED
@@ -43,7 +43,7 @@ function adrotate_ad($banner_id, $individual = true, $group = null, $site = 0) {
|
|
43 |
if($individual == true) $output .= '</div>';
|
44 |
|
45 |
if($adrotate_config['stats'] == 1) {
|
46 |
-
adrotate_count_impression($banner->id, 0, 0
|
47 |
}
|
48 |
} else {
|
49 |
$output .= adrotate_error('ad_expired', array($banner_id));
|
@@ -178,7 +178,7 @@ function adrotate_group($group_ids, $fallback = 0, $weight = 0, $site = 0) {
|
|
178 |
}
|
179 |
|
180 |
if($adrotate_config['stats'] == 1){
|
181 |
-
adrotate_count_impression($selected[$banner_id]->id, $group->id, 0
|
182 |
}
|
183 |
|
184 |
unset($selected[$banner_id]);
|
@@ -193,7 +193,7 @@ function adrotate_group($group_ids, $fallback = 0, $weight = 0, $site = 0) {
|
|
193 |
$output .= '</div>';
|
194 |
|
195 |
if($adrotate_config['stats'] == 1){
|
196 |
-
adrotate_count_impression($selected[$banner_id]->id, $group->id, 0
|
197 |
}
|
198 |
}
|
199 |
|
43 |
if($individual == true) $output .= '</div>';
|
44 |
|
45 |
if($adrotate_config['stats'] == 1) {
|
46 |
+
adrotate_count_impression($banner->id, 0, 0);
|
47 |
}
|
48 |
} else {
|
49 |
$output .= adrotate_error('ad_expired', array($banner_id));
|
178 |
}
|
179 |
|
180 |
if($adrotate_config['stats'] == 1){
|
181 |
+
adrotate_count_impression($selected[$banner_id]->id, $group->id, 0);
|
182 |
}
|
183 |
|
184 |
unset($selected[$banner_id]);
|
193 |
$output .= '</div>';
|
194 |
|
195 |
if($adrotate_config['stats'] == 1){
|
196 |
+
adrotate_count_impression($selected[$banner_id]->id, $group->id, 0);
|
197 |
}
|
198 |
}
|
199 |
|
adrotate-setup.php
CHANGED
@@ -85,12 +85,6 @@ function adrotate_activate_setup() {
|
|
85 |
adrotate_prepare_roles('remove');
|
86 |
}
|
87 |
|
88 |
-
// Set up some schedules
|
89 |
-
$firstrun = adrotate_date_start('day');
|
90 |
-
if(!wp_next_scheduled('adrotate_clean_trackerdata')) { // Periodically clean trackerdata
|
91 |
-
wp_schedule_event($firstrun, 'twicedaily', 'adrotate_clean_trackerdata');
|
92 |
-
}
|
93 |
-
|
94 |
if(!wp_next_scheduled('adrotate_evaluate_ads')) {// Periodically check ads
|
95 |
wp_schedule_event($firstrun + 900, 'twicedaily', 'adrotate_evaluate_ads');
|
96 |
}
|
@@ -133,7 +127,6 @@ function adrotate_deactivate_setup() {
|
|
133 |
|
134 |
// Clear out wp_cron
|
135 |
wp_clear_scheduled_hook('adrotate_notification');
|
136 |
-
wp_clear_scheduled_hook('adrotate_clean_trackerdata');
|
137 |
wp_clear_scheduled_hook('adrotate_evaluate_ads');
|
138 |
}
|
139 |
|
@@ -160,7 +153,6 @@ function adrotate_uninstall_setup() {
|
|
160 |
// Drop MySQL Tables
|
161 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate`");
|
162 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_groups`");
|
163 |
-
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_tracker`");
|
164 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_linkmeta`");
|
165 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats`");
|
166 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats_archive`");
|
@@ -218,10 +210,6 @@ function adrotate_network_propagate($pfunction, $network_wide) {
|
|
218 |
-------------------------------------------------------------*/
|
219 |
function adrotate_check_schedules() {
|
220 |
$firstrun = adrotate_now();
|
221 |
-
if(!wp_next_scheduled('adrotate_clean_trackerdata')) { // Periodically clean trackerdata
|
222 |
-
wp_schedule_event($firstrun, 'twicedaily', 'adrotate_clean_trackerdata');
|
223 |
-
}
|
224 |
-
|
225 |
if(!wp_next_scheduled('adrotate_evaluate_ads')) { // Periodically check ads
|
226 |
wp_schedule_event($firstrun + 900, 'twicedaily', 'adrotate_evaluate_ads');
|
227 |
}
|
@@ -310,7 +298,7 @@ function adrotate_check_competition() {
|
|
310 |
'adkingpro/adkingpro.php',
|
311 |
// 'advanced-advertising-system/advanced_advertising_system.php',
|
312 |
// 'advert/advert.php',
|
313 |
-
|
314 |
'bannerman/bannerman.php',
|
315 |
// 'easy-ads-manager/easy-ads-manager.php',
|
316 |
// 'easy-adsense-injection/easy-adsense-injection.php',
|
@@ -530,21 +518,6 @@ function adrotate_database_install() {
|
|
530 |
) ".$charset_collate.$engine.";");
|
531 |
}
|
532 |
|
533 |
-
if(!in_array("{$wpdb->prefix}adrotate_tracker", $found_tables)) {
|
534 |
-
dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate_tracker` (
|
535 |
-
`id` bigint(9) unsigned NOT NULL auto_increment,
|
536 |
-
`ipaddress` varchar(15) NOT NULL default '0',
|
537 |
-
`timer` int(15) unsigned NOT NULL default '0',
|
538 |
-
`bannerid` int(15) unsigned NOT NULL default '0',
|
539 |
-
`stat` char(1) NOT NULL default 'c',
|
540 |
-
`country` text NOT NULL,
|
541 |
-
`city` text NOT NULL,
|
542 |
-
PRIMARY KEY (`id`),
|
543 |
-
KEY `ipaddress` (`ipaddress`),
|
544 |
-
KEY `timer` (`timer`)
|
545 |
-
) ".$charset_collate.$engine.";");
|
546 |
-
}
|
547 |
-
|
548 |
if(!in_array("{$wpdb->prefix}adrotate_transactions", $found_tables)) {
|
549 |
dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate_transactions` (
|
550 |
`id` mediumint(8) unsigned NOT NULL auto_increment,
|
@@ -941,6 +914,13 @@ function adrotate_database_upgrade() {
|
|
941 |
}
|
942 |
}
|
943 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
944 |
update_option("adrotate_db_version", array('current' => ADROTATE_DB_VERSION, 'previous' => $adrotate_db_version['current']));
|
945 |
}
|
946 |
|
@@ -1104,6 +1084,11 @@ function adrotate_core_upgrade() {
|
|
1104 |
if(get_option('adrotate_hide_banner') == 1) update_option('adrotate_hide_banner', adrotate_now());
|
1105 |
}
|
1106 |
|
|
|
|
|
|
|
|
|
|
|
1107 |
update_option("adrotate_version", array('current' => ADROTATE_VERSION, 'previous' => $adrotate_version['current']));
|
1108 |
}
|
1109 |
|
@@ -1121,8 +1106,8 @@ function adrotate_optimize_database() {
|
|
1121 |
$now = adrotate_now();
|
1122 |
|
1123 |
if($adrotate_db_timer < ($now - 86400)) {
|
1124 |
-
dbDelta("OPTIMIZE TABLE `{$wpdb->prefix}adrotate`, `{$wpdb->prefix}adrotate_groups`, `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate_stats`, `{$wpdb->prefix}adrotate_stats_archive`, `{$wpdb->prefix}
|
1125 |
-
dbDelta("REPAIR TABLE `{$wpdb->prefix}adrotate`, `{$wpdb->prefix}adrotate_groups`, `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate_stats`, `{$wpdb->prefix}adrotate_stats_archive`, `{$wpdb->prefix}
|
1126 |
update_option('adrotate_db_timer', $now);
|
1127 |
adrotate_return('adrotate-settings', 403, array('tab' => 'maintenance'));
|
1128 |
} else {
|
@@ -1151,10 +1136,6 @@ function adrotate_cleanup_database() {
|
|
1151 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` < $lastyear;");
|
1152 |
}
|
1153 |
|
1154 |
-
// Clean up Tracker data
|
1155 |
-
$yesterday = $now - 2073600;
|
1156 |
-
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE `timer` < $yesterday;");
|
1157 |
-
|
1158 |
// Delete empty ads, groups and schedules
|
1159 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate` WHERE `type` = 'empty' OR `type` = 'a_empty';");
|
1160 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` = '';");
|
@@ -1186,21 +1167,6 @@ function adrotate_cleanup_database() {
|
|
1186 |
adrotate_return('adrotate-settings', 406, array('tab' => 'maintenance'));
|
1187 |
}
|
1188 |
|
1189 |
-
/*-------------------------------------------------------------
|
1190 |
-
Name: adrotate_clean_trackerdata
|
1191 |
-
Purpose: Removes old statistics
|
1192 |
-
Since: 2.0
|
1193 |
-
-------------------------------------------------------------*/
|
1194 |
-
function adrotate_clean_trackerdata() {
|
1195 |
-
global $wpdb;
|
1196 |
-
|
1197 |
-
$now = adrotate_now();
|
1198 |
-
$clicks = $now - 86400;
|
1199 |
-
$impressions = $now - 3600;
|
1200 |
-
|
1201 |
-
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE (`timer` < ".$clicks." AND `stat` = 'c') OR (`timer` < ".$impressions." AND `stat` = 'i') OR `ipaddress` = 'unknown' OR `ipaddress` = '';");
|
1202 |
-
}
|
1203 |
-
|
1204 |
/*-------------------------------------------------------------
|
1205 |
Name: adrotate_add_column
|
1206 |
Purpose: Check if the column exists in the table
|
85 |
adrotate_prepare_roles('remove');
|
86 |
}
|
87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
88 |
if(!wp_next_scheduled('adrotate_evaluate_ads')) {// Periodically check ads
|
89 |
wp_schedule_event($firstrun + 900, 'twicedaily', 'adrotate_evaluate_ads');
|
90 |
}
|
127 |
|
128 |
// Clear out wp_cron
|
129 |
wp_clear_scheduled_hook('adrotate_notification');
|
|
|
130 |
wp_clear_scheduled_hook('adrotate_evaluate_ads');
|
131 |
}
|
132 |
|
153 |
// Drop MySQL Tables
|
154 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate`");
|
155 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_groups`");
|
|
|
156 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_linkmeta`");
|
157 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats`");
|
158 |
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats_archive`");
|
210 |
-------------------------------------------------------------*/
|
211 |
function adrotate_check_schedules() {
|
212 |
$firstrun = adrotate_now();
|
|
|
|
|
|
|
|
|
213 |
if(!wp_next_scheduled('adrotate_evaluate_ads')) { // Periodically check ads
|
214 |
wp_schedule_event($firstrun + 900, 'twicedaily', 'adrotate_evaluate_ads');
|
215 |
}
|
298 |
'adkingpro/adkingpro.php',
|
299 |
// 'advanced-advertising-system/advanced_advertising_system.php',
|
300 |
// 'advert/advert.php',
|
301 |
+
'advertising-manager/advertising-manager.php',
|
302 |
'bannerman/bannerman.php',
|
303 |
// 'easy-ads-manager/easy-ads-manager.php',
|
304 |
// 'easy-adsense-injection/easy-adsense-injection.php',
|
518 |
) ".$charset_collate.$engine.";");
|
519 |
}
|
520 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
521 |
if(!in_array("{$wpdb->prefix}adrotate_transactions", $found_tables)) {
|
522 |
dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate_transactions` (
|
523 |
`id` mediumint(8) unsigned NOT NULL auto_increment,
|
914 |
}
|
915 |
}
|
916 |
|
917 |
+
// Database: 60
|
918 |
+
// AdRotate: 3.17
|
919 |
+
if($adrotate_db_version['current'] < 60) {
|
920 |
+
$wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_tracker`");
|
921 |
+
}
|
922 |
+
|
923 |
+
|
924 |
update_option("adrotate_db_version", array('current' => ADROTATE_DB_VERSION, 'previous' => $adrotate_db_version['current']));
|
925 |
}
|
926 |
|
1084 |
if(get_option('adrotate_hide_banner') == 1) update_option('adrotate_hide_banner', adrotate_now());
|
1085 |
}
|
1086 |
|
1087 |
+
// 3.17
|
1088 |
+
if($adrotate_version['current'] < 385) {
|
1089 |
+
wp_clear_scheduled_hook('adrotate_clean_trackerdata');
|
1090 |
+
}
|
1091 |
+
|
1092 |
update_option("adrotate_version", array('current' => ADROTATE_VERSION, 'previous' => $adrotate_version['current']));
|
1093 |
}
|
1094 |
|
1106 |
$now = adrotate_now();
|
1107 |
|
1108 |
if($adrotate_db_timer < ($now - 86400)) {
|
1109 |
+
dbDelta("OPTIMIZE TABLE `{$wpdb->prefix}adrotate`, `{$wpdb->prefix}adrotate_groups`, `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate_stats`, `{$wpdb->prefix}adrotate_stats_archive`, `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_transactions`;");
|
1110 |
+
dbDelta("REPAIR TABLE `{$wpdb->prefix}adrotate`, `{$wpdb->prefix}adrotate_groups`, `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate_stats`, `{$wpdb->prefix}adrotate_stats_archive`, `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_transactions`;");
|
1111 |
update_option('adrotate_db_timer', $now);
|
1112 |
adrotate_return('adrotate-settings', 403, array('tab' => 'maintenance'));
|
1113 |
} else {
|
1136 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` < $lastyear;");
|
1137 |
}
|
1138 |
|
|
|
|
|
|
|
|
|
1139 |
// Delete empty ads, groups and schedules
|
1140 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate` WHERE `type` = 'empty' OR `type` = 'a_empty';");
|
1141 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` = '';");
|
1167 |
adrotate_return('adrotate-settings', 406, array('tab' => 'maintenance'));
|
1168 |
}
|
1169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1170 |
/*-------------------------------------------------------------
|
1171 |
Name: adrotate_add_column
|
1172 |
Purpose: Check if the column exists in the table
|
adrotate-statistics.php
CHANGED
@@ -27,105 +27,34 @@ function adrotate_draw_graph($id = 0, $labels = 0, $clicks = 0, $impressions = 0
|
|
27 |
jQuery(document).ready(function(){
|
28 |
jQuery("#chart-'.$id.'").chart({
|
29 |
type: "line",
|
30 |
-
margins: [5, 45,
|
31 |
values: {
|
32 |
-
serie1: ['.$clicks.'],
|
33 |
-
serie2: ['.$impressions.']
|
34 |
},
|
35 |
labels: ['.$labels.'],
|
36 |
tooltips: function(env, serie, index, value, label) {
|
37 |
-
return "<div class=\"
|
38 |
},
|
39 |
defaultSeries: {
|
40 |
-
|
41 |
-
"stroke-width": 3
|
42 |
-
},
|
43 |
-
dot: true,
|
44 |
-
rounded: true,
|
45 |
-
dotProps: {
|
46 |
-
stroke: "white",
|
47 |
-
size: 5,
|
48 |
-
"stroke-width": 1,
|
49 |
-
opacity: 0 // dots invisible until we hover it
|
50 |
-
},
|
51 |
-
highlight: {
|
52 |
-
scaleSpeed: 0, // do not animate the dot scaling. instant grow.
|
53 |
-
scaleEasing: "",
|
54 |
-
scale: 1.2, // enlarge the dot on hover
|
55 |
-
newProps: {
|
56 |
-
opacity: 1 // show dots on hover
|
57 |
-
}
|
58 |
-
},
|
59 |
-
tooltip: {
|
60 |
-
height: 40,
|
61 |
-
width: 120,
|
62 |
-
padding: [0],
|
63 |
-
offset: [-10, -10],
|
64 |
-
frameProps: {
|
65 |
-
opacity: 0.95,
|
66 |
-
stroke: "#000"
|
67 |
-
|
68 |
-
}
|
69 |
-
}
|
70 |
},
|
71 |
series: {
|
72 |
serie1: {
|
73 |
-
fill: true,
|
74 |
-
fillProps: {
|
75 |
-
opacity: .1
|
76 |
-
},
|
77 |
-
color: "#26B",
|
78 |
},
|
79 |
serie2: {
|
80 |
-
axis: "r",
|
81 |
-
color: "#F80",
|
82 |
-
plotProps: {
|
83 |
-
"stroke-width": 2
|
84 |
-
},
|
85 |
-
dotProps: {
|
86 |
-
stroke: "white",
|
87 |
-
size: 3,
|
88 |
-
"stroke-width": 1
|
89 |
-
}
|
90 |
}
|
91 |
-
|
92 |
},
|
93 |
defaultAxis: {
|
94 |
-
labels: true,
|
95 |
-
labelsProps: {
|
96 |
-
fill: "#777",
|
97 |
-
"font-size": "10px"
|
98 |
-
},
|
99 |
-
labelsAnchor: "start",
|
100 |
-
labelsMargin: 5,
|
101 |
-
labelsDistance: 8
|
102 |
},
|
103 |
axis: {
|
104 |
l: { // left axis
|
105 |
-
labels: true,
|
106 |
-
labelsDistance: 0,
|
107 |
-
labelsSkip: 1,
|
108 |
-
labelsAnchor: "end",
|
109 |
-
labelsMargin: 15,
|
110 |
-
labelsDistance: 4,
|
111 |
-
labelsProps: {
|
112 |
-
fill: "#26B",
|
113 |
-
"font-size": "11px",
|
114 |
-
"font-weight": "bold"
|
115 |
-
}
|
116 |
},
|
117 |
r: { // right axis
|
118 |
-
labels: true,
|
119 |
-
labelsDistance: 0,
|
120 |
-
labelsSkip: 1,
|
121 |
-
labelsAnchor: "start",
|
122 |
-
labelsMargin: 15,
|
123 |
-
labelsDistance: 4,
|
124 |
-
labelsProps: {
|
125 |
-
fill: "#F80",
|
126 |
-
"font-size": "11px",
|
127 |
-
"font-weight": "bold"
|
128 |
-
}
|
129 |
}
|
130 |
},
|
131 |
features: {
|
@@ -167,7 +96,8 @@ function adrotate_stats($ad, $when = 0, $until = 0) {
|
|
167 |
if($when > 0 AND is_numeric($when) AND $until > 0 AND is_numeric($until)) {
|
168 |
$whenquery = " AND `thetime` >= '$when' AND `thetime` <= '$until' GROUP BY `ad` ASC";
|
169 |
} else if($when > 0 AND is_numeric($when) AND $until == 0) {
|
170 |
-
$
|
|
|
171 |
} else {
|
172 |
$whenquery = "";
|
173 |
}
|
@@ -183,7 +113,7 @@ function adrotate_stats($ad, $when = 0, $until = 0) {
|
|
183 |
} else {
|
184 |
$ad_query = '`ad` = '.$ad;
|
185 |
}
|
186 |
-
$stats = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `
|
187 |
|
188 |
if(empty($stats['clicks'])) $stats['clicks'] = '0';
|
189 |
if(empty($stats['impressions'])) $stats['impressions'] = '0';
|
@@ -239,19 +169,19 @@ function adrotate_stats_graph($type, $id, $chartid, $start, $end) {
|
|
239 |
global $wpdb;
|
240 |
|
241 |
if($type == 'ads' OR $type == 'advertiser') {
|
242 |
-
$stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `
|
243 |
}
|
244 |
|
245 |
if($type == 'groups') {
|
246 |
-
$stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `
|
247 |
}
|
248 |
|
249 |
if($type == 'global-report') {
|
250 |
-
$stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `
|
251 |
}
|
252 |
|
253 |
if($type == 'advertiser-global') {
|
254 |
-
$stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `
|
255 |
}
|
256 |
|
257 |
if($stats) {
|
@@ -356,4 +286,138 @@ function adrotate_date_start($what) {
|
|
356 |
function adrotate_now() {
|
357 |
return time() + (get_option('gmt_offset') * HOUR_IN_SECONDS);
|
358 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
359 |
?>
|
27 |
jQuery(document).ready(function(){
|
28 |
jQuery("#chart-'.$id.'").chart({
|
29 |
type: "line",
|
30 |
+
margins: [5, 45, 45, 45],
|
31 |
values: {
|
32 |
+
serie1: ['.$clicks.'], serie2: ['.$impressions.']
|
|
|
33 |
},
|
34 |
labels: ['.$labels.'],
|
35 |
tooltips: function(env, serie, index, value, label) {
|
36 |
+
return "<div class=\"adrotate_label\">" + label + "<br /><span class=\"adrotate_clicks\">Clicks:</span> " + env.opt.values[\'serie1\'][index] + "<br /><span class=\"adrotate_impressions\">Impressions:</span> " + env.opt.values[\'serie2\'][index] + "</div>";
|
37 |
},
|
38 |
defaultSeries: {
|
39 |
+
plotProps: { "stroke-width": 3 }, dot: true, rounded: true, dotProps: { stroke: "white", size: 5, "stroke-width": 1, opacity: 0 }, highlight: { scaleSpeed: 0, scaleEasing: "", scale: 1.2, newProps: { opacity: 1 } }, tooltip: { height: 55, width: 120, padding: [0], offset: [-10, -10], frameProps: { opacity: 0.95, stroke: "#000" } }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
},
|
41 |
series: {
|
42 |
serie1: {
|
43 |
+
fill: true, fillProps: { opacity: .1 }, color: "#26B",
|
|
|
|
|
|
|
|
|
44 |
},
|
45 |
serie2: {
|
46 |
+
axis: "r", color: "#F80", plotProps: { "stroke-width": 2 }, dotProps: { stroke: "white", size: 3, "stroke-width": 1 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
|
|
48 |
},
|
49 |
defaultAxis: {
|
50 |
+
labels: true, labelsProps: { fill: "#777", "font-size": "10px", }, labelsAnchor: "start", labelsMargin: 5, labelsDistance: 8, labelsRotate: 65
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
},
|
52 |
axis: {
|
53 |
l: { // left axis
|
54 |
+
labels: true, labelsDistance: 0, labelsSkip: 1, labelsAnchor: "end", labelsMargin: 15, labelsDistance: 4, labelsProps: { fill: "#26B", "font-size": "11px", "font-weight": "bold" }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
},
|
56 |
r: { // right axis
|
57 |
+
labels: true, labelsDistance: 0, labelsSkip: 1, labelsAnchor: "start", labelsMargin: 15, labelsDistance: 4, labelsProps: { fill: "#F80", "font-size": "11px", "font-weight": "bold" }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
},
|
60 |
features: {
|
96 |
if($when > 0 AND is_numeric($when) AND $until > 0 AND is_numeric($until)) {
|
97 |
$whenquery = " AND `thetime` >= '$when' AND `thetime` <= '$until' GROUP BY `ad` ASC";
|
98 |
} else if($when > 0 AND is_numeric($when) AND $until == 0) {
|
99 |
+
$until = $when + 86400;
|
100 |
+
$whenquery = " AND `thetime` >= '$when' AND `thetime` <= '$until'";
|
101 |
} else {
|
102 |
$whenquery = "";
|
103 |
}
|
113 |
} else {
|
114 |
$ad_query = '`ad` = '.$ad;
|
115 |
}
|
116 |
+
$stats = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE {$ad_query}{$whenquery};", ARRAY_A);
|
117 |
|
118 |
if(empty($stats['clicks'])) $stats['clicks'] = '0';
|
119 |
if(empty($stats['impressions'])) $stats['impressions'] = '0';
|
169 |
global $wpdb;
|
170 |
|
171 |
if($type == 'ads' OR $type == 'advertiser') {
|
172 |
+
$stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d AND `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
|
173 |
}
|
174 |
|
175 |
if($type == 'groups') {
|
176 |
+
$stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `group` = %d AND `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
|
177 |
}
|
178 |
|
179 |
if($type == 'global-report') {
|
180 |
+
$stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= %d AND `thetime` <= %d GROUP BY `thetime` ASC;", $start, $end), ARRAY_A);
|
181 |
}
|
182 |
|
183 |
if($type == 'advertiser-global') {
|
184 |
+
$stats = $wpdb->get_results($wpdb->prepare("SELECT `thetime`, SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `{$wpdb->prefix}adrotate_stats`.`ad` = `{$wpdb->prefix}adrotate_linkmeta`.`ad` AND `{$wpdb->prefix}adrotate_linkmeta`.`user` = %d AND (`{$wpdb->prefix}adrotate_stats`.`thetime` >= %d AND `{$wpdb->prefix}adrotate_stats`.`thetime` <= %d) GROUP BY `thetime` ASC;", $id, $start, $end), ARRAY_A);
|
185 |
}
|
186 |
|
187 |
if($stats) {
|
286 |
function adrotate_now() {
|
287 |
return time() + (get_option('gmt_offset') * HOUR_IN_SECONDS);
|
288 |
}
|
289 |
+
|
290 |
+
/*-------------------------------------------------------------
|
291 |
+
Name: adrotate_count_impression
|
292 |
+
|
293 |
+
Purpose: Count Impressions where needed
|
294 |
+
Receive: $ad, $group
|
295 |
+
Return: -None-
|
296 |
+
Since: 3.10.12
|
297 |
+
-------------------------------------------------------------*/
|
298 |
+
function adrotate_count_impression($ad, $group = 0, $blog_id = 0) {
|
299 |
+
global $wpdb, $adrotate_config, $adrotate_debug;
|
300 |
+
|
301 |
+
if(($adrotate_config['enable_loggedin_impressions'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
|
302 |
+
$now = adrotate_now();
|
303 |
+
$hour = adrotate_date_start('hour');
|
304 |
+
$remote_ip = adrotate_get_remote_ip();
|
305 |
+
|
306 |
+
if($adrotate_debug['timers'] == true) {
|
307 |
+
$impression_timer = $now;
|
308 |
+
} else {
|
309 |
+
$impression_timer = $now - $adrotate_config['impression_timer'];
|
310 |
+
}
|
311 |
+
|
312 |
+
$transientkey = "adrotate_impression_".md5($ad.$remote_ip);
|
313 |
+
$saved_timer = get_transient($transientkey);
|
314 |
+
if(false === $saved_timer) {
|
315 |
+
$saved_timer = 0;
|
316 |
+
}
|
317 |
+
|
318 |
+
if($saved_timer < $impression_timer AND adrotate_is_human()) {
|
319 |
+
$stats = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d AND `group` = %d AND `thetime` = {$hour};", $ad, $group));
|
320 |
+
if($stats > 0) {
|
321 |
+
$wpdb->query("UPDATE `{$wpdb->prefix}adrotate_stats` SET `impressions` = `impressions` + 1 WHERE `id` = {$stats};");
|
322 |
+
} else {
|
323 |
+
$wpdb->insert($wpdb->prefix.'adrotate_stats', array('ad' => $ad, 'group' => $group, 'thetime' => $hour, 'clicks' => 0, 'impressions' => 1));
|
324 |
+
}
|
325 |
+
|
326 |
+
set_transient($transientkey, $now, $adrotate_config['impression_timer']);
|
327 |
+
}
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
/*-------------------------------------------------------------
|
332 |
+
Name: adrotate_impression_callback
|
333 |
+
|
334 |
+
Purpose: Register a impression for dynamic groups
|
335 |
+
Receive: $_POST
|
336 |
+
Return: -None-
|
337 |
+
Since: 3.10.14
|
338 |
+
-------------------------------------------------------------*/
|
339 |
+
function adrotate_impression_callback() {
|
340 |
+
define('DONOTCACHEPAGE', true);
|
341 |
+
define('DONOTCACHEDB', true);
|
342 |
+
define('DONOTCACHCEOBJECT', true);
|
343 |
+
|
344 |
+
global $adrotate_debug;
|
345 |
+
|
346 |
+
$meta = $_POST['track'];
|
347 |
+
if($adrotate_debug['track'] != true) {
|
348 |
+
$meta = base64_decode($meta);
|
349 |
+
}
|
350 |
+
|
351 |
+
$meta = esc_attr($meta);
|
352 |
+
// Don't use $impression_timer - It's for impressions used in javascript
|
353 |
+
list($ad, $group, $blog_id, $impression_timer) = explode(",", $meta, 4);
|
354 |
+
adrotate_count_impression($ad, $group, $blog_id);
|
355 |
+
|
356 |
+
wp_die();
|
357 |
+
}
|
358 |
+
|
359 |
+
|
360 |
+
/*-------------------------------------------------------------
|
361 |
+
Name: adrotate_click_callback
|
362 |
+
|
363 |
+
Purpose: Register clicks for clicktracking
|
364 |
+
Receive: $_POST
|
365 |
+
Return: -None-
|
366 |
+
Since: 3.10.14
|
367 |
+
-------------------------------------------------------------*/
|
368 |
+
function adrotate_click_callback() {
|
369 |
+
define('DONOTCACHEPAGE', true);
|
370 |
+
define('DONOTCACHEDB', true);
|
371 |
+
define('DONOTCACHCEOBJECT', true);
|
372 |
+
|
373 |
+
global $wpdb, $adrotate_config, $adrotate_debug;
|
374 |
+
|
375 |
+
$meta = $_POST['track'];
|
376 |
+
|
377 |
+
if($adrotate_debug['track'] != true) {
|
378 |
+
$meta = base64_decode($meta);
|
379 |
+
}
|
380 |
+
|
381 |
+
$meta = esc_attr($meta);
|
382 |
+
// Don't use $impression_timer - It's for impressions used in javascript
|
383 |
+
list($ad, $group, $blog_id, $impression_timer) = explode(",", $meta, 4);
|
384 |
+
|
385 |
+
if(is_numeric($ad) AND is_numeric($group) AND is_numeric($blog_id)) {
|
386 |
+
if(($adrotate_config['enable_loggedin_clicks'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
|
387 |
+
$remote_ip = adrotate_get_remote_ip();
|
388 |
+
|
389 |
+
if(adrotate_is_human() AND $remote_ip != "unknown" AND !empty($remote_ip)) {
|
390 |
+
$now = adrotate_now();
|
391 |
+
$hour = adrotate_date_start('hour');
|
392 |
+
|
393 |
+
if($adrotate_debug['timers'] == true) {
|
394 |
+
$click_timer = $now;
|
395 |
+
} else {
|
396 |
+
$click_timer = $now - $adrotate_config['click_timer'];
|
397 |
+
}
|
398 |
+
|
399 |
+
$transientkey = "adrotate_click_".md5($ad.$remote_ip);
|
400 |
+
$saved_timer = get_transient($transientkey);
|
401 |
+
if(false === $saved_timer) {
|
402 |
+
$saved_timer = 0;
|
403 |
+
}
|
404 |
+
|
405 |
+
if($saved_timer < $click_timer) {
|
406 |
+
$stats = $wpdb->get_var($wpdb->prepare("SELECT `id` FROM `{$wpdb->prefix}adrotate_stats` WHERE `ad` = %d AND `group` = %d AND `thetime` = {$hour};", $ad, $group));
|
407 |
+
if($stats > 0) {
|
408 |
+
$wpdb->query("UPDATE `{$wpdb->prefix}adrotate_stats` SET `clicks` = `clicks` + 1 WHERE `id` = {$stats};");
|
409 |
+
} else {
|
410 |
+
$wpdb->insert($wpdb->prefix.'adrotate_stats', array('ad' => $ad, 'group' => $group, 'thetime' => $hour, 'clicks' => 1, 'impressions' => 1));
|
411 |
+
}
|
412 |
+
|
413 |
+
set_transient($transientkey, $now, $adrotate_config['click_timer']);
|
414 |
+
}
|
415 |
+
}
|
416 |
+
}
|
417 |
+
|
418 |
+
unset($remote_ip, $track, $meta, $ad, $group, $remote, $banner);
|
419 |
+
}
|
420 |
+
|
421 |
+
wp_die();
|
422 |
+
}
|
423 |
?>
|
adrotate.php
CHANGED
@@ -7,7 +7,7 @@ Author URI: http://ajdg.solutions/?utm_campaign=homepage&utm_medium=plugin-info&
|
|
7 |
Description: The popular choice for monetizing your website with adverts while keeping things simple. Start making money today!
|
8 |
Text Domain: adrotate
|
9 |
Domain Path: /languages/
|
10 |
-
Version: 3.
|
11 |
License: GPLv3
|
12 |
*/
|
13 |
|
@@ -22,9 +22,9 @@ License: GPLv3
|
|
22 |
------------------------------------------------------------------------------------ */
|
23 |
|
24 |
/*--- AdRotate values ---------------------------------------*/
|
25 |
-
define("ADROTATE_DISPLAY", '3.
|
26 |
-
define("ADROTATE_VERSION",
|
27 |
-
define("ADROTATE_DB_VERSION",
|
28 |
/*-----------------------------------------------------------*/
|
29 |
|
30 |
/*--- Load Files --------------------------------------------*/
|
@@ -50,7 +50,6 @@ $adrotate_debug = get_option("adrotate_debug");
|
|
50 |
register_activation_hook(__FILE__, 'adrotate_activate');
|
51 |
register_deactivation_hook(__FILE__, 'adrotate_deactivate');
|
52 |
register_uninstall_hook(__FILE__, 'adrotate_uninstall');
|
53 |
-
add_action('adrotate_clean_trackerdata', 'adrotate_clean_trackerdata');
|
54 |
add_action('adrotate_evaluate_ads', 'adrotate_evaluate_ads');
|
55 |
add_action('widgets_init', create_function('', 'return register_widget("adrotate_widgets");'));
|
56 |
/*-----------------------------------------------------------*/
|
@@ -400,7 +399,6 @@ function adrotate_options() {
|
|
400 |
|
401 |
$adevaluate = wp_next_scheduled('adrotate_evaluate_ads');
|
402 |
$adschedule = wp_next_scheduled('adrotate_notification');
|
403 |
-
$adtracker = wp_next_scheduled('adrotate_clean_trackerdata');
|
404 |
|
405 |
include("dashboard/settings/maintenance.php");
|
406 |
} elseif($active_tab == 'license') {
|
7 |
Description: The popular choice for monetizing your website with adverts while keeping things simple. Start making money today!
|
8 |
Text Domain: adrotate
|
9 |
Domain Path: /languages/
|
10 |
+
Version: 3.17
|
11 |
License: GPLv3
|
12 |
*/
|
13 |
|
22 |
------------------------------------------------------------------------------------ */
|
23 |
|
24 |
/*--- AdRotate values ---------------------------------------*/
|
25 |
+
define("ADROTATE_DISPLAY", '3.17');
|
26 |
+
define("ADROTATE_VERSION", 385);
|
27 |
+
define("ADROTATE_DB_VERSION", 60);
|
28 |
/*-----------------------------------------------------------*/
|
29 |
|
30 |
/*--- Load Files --------------------------------------------*/
|
50 |
register_activation_hook(__FILE__, 'adrotate_activate');
|
51 |
register_deactivation_hook(__FILE__, 'adrotate_deactivate');
|
52 |
register_uninstall_hook(__FILE__, 'adrotate_uninstall');
|
|
|
53 |
add_action('adrotate_evaluate_ads', 'adrotate_evaluate_ads');
|
54 |
add_action('widgets_init', create_function('', 'return register_widget("adrotate_widgets");'));
|
55 |
/*-----------------------------------------------------------*/
|
399 |
|
400 |
$adevaluate = wp_next_scheduled('adrotate_evaluate_ads');
|
401 |
$adschedule = wp_next_scheduled('adrotate_notification');
|
|
|
402 |
|
403 |
include("dashboard/settings/maintenance.php");
|
404 |
} elseif($active_tab == 'license') {
|
dashboard/publisher/adverts-edit.php
CHANGED
@@ -103,29 +103,33 @@ if($edit_banner->imagetype == "field") {
|
|
103 |
<h3><?php _e('Edit Advert', 'adrotate'); ?></h3>
|
104 |
<?php } ?>
|
105 |
|
106 |
-
<table class="widefat" style="margin-top: .5em">
|
107 |
<tbody>
|
108 |
<tr>
|
109 |
<th width="15%"><?php _e('Title', 'adrotate'); ?></th>
|
110 |
<td colspan="2">
|
111 |
-
<label for="adrotate_title"><input tabindex="1" name="adrotate_title" type="text" size="
|
112 |
</td>
|
113 |
</tr>
|
114 |
<tr>
|
115 |
<th valign="top"><?php _e('AdCode', 'adrotate'); ?></th>
|
116 |
<td>
|
117 |
-
<label for="adrotate_bannercode"><textarea tabindex="2" id="adrotate_bannercode" name="adrotate_bannercode" cols="
|
118 |
</td>
|
119 |
-
|
120 |
<p><strong><?php _e('Basic Examples:', 'adrotate'); ?></strong></p>
|
121 |
-
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','<a href="
|
122 |
-
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','<span class="ad-%id%"><a href="http://www.adrotateforwordpress.com">Text Link Ad!</a></span>');return false;"><span class="ad-%id%"><a href="http://www.adrotateforwordpress.com">Text Link Ad!</a></span></a></em></p>
|
123 |
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','<iframe src="%asset%" height="250" frameborder="0" style="border:none;"></iframe>');return false;"><iframe src="%asset%" height="250" frameborder="0" style="border:none;"></iframe></a></em></p>
|
|
|
|
|
|
|
|
|
|
|
124 |
</td>
|
125 |
-
|
126 |
<tr>
|
127 |
<th valign="top"><?php _e('Useful tags', 'adrotate'); ?></th>
|
128 |
-
<td
|
129 |
<p><em><a href="#" title="<?php _e('Insert the advert ID Number.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%id%');return false;">%id%</a>, <a href="#" title="<?php _e('Required when selecting a asset below.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%asset%');return false;">%asset%</a>, <a href="#" title="<?php _e('Insert the advert name.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%title%');return false;">%title%</a>, <a href="#" title="<?php _e('Insert a random seed. Useful for DFP/DoubleClick type adverts.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%random%');return false;">%random%</a>, <a href="#" title="<?php _e('Add inside the <a> tag to open advert in a new window.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','target="_blank"');return false;">target="_blank"</a>, <a href="#" title="<?php _e('Add inside the <a> tag to tell crawlers to ignore this link', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','rel="nofollow"');return false;">rel="nofollow"</a></em><br /><?php _e('Place the cursor in your AdCode where you want to add any of these tags and click to add it.', 'adrotate'); ?></p>
|
130 |
</td>
|
131 |
</tr>
|
103 |
<h3><?php _e('Edit Advert', 'adrotate'); ?></h3>
|
104 |
<?php } ?>
|
105 |
|
106 |
+
<table class="widefat" style="margin-top: .5em;">
|
107 |
<tbody>
|
108 |
<tr>
|
109 |
<th width="15%"><?php _e('Title', 'adrotate'); ?></th>
|
110 |
<td colspan="2">
|
111 |
+
<label for="adrotate_title"><input tabindex="1" name="adrotate_title" type="text" size="70" class="search-input" value="<?php echo stripslashes($edit_banner->title);?>" autocomplete="off" /></label>
|
112 |
</td>
|
113 |
</tr>
|
114 |
<tr>
|
115 |
<th valign="top"><?php _e('AdCode', 'adrotate'); ?></th>
|
116 |
<td>
|
117 |
+
<label for="adrotate_bannercode"><textarea tabindex="2" id="adrotate_bannercode" name="adrotate_bannercode" cols="70" rows="15"><?php echo stripslashes($edit_banner->bannercode); ?></textarea></label>
|
118 |
</td>
|
119 |
+
<td width="30%" rowspan="2">
|
120 |
<p><strong><?php _e('Basic Examples:', 'adrotate'); ?></strong></p>
|
121 |
+
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','<a href="https://ajdg.solutions/"><img src="%asset%" /></a>');return false;"><a href="https://ajdg.solutions/"><img src="%asset%" /></a></a></em></p>
|
|
|
122 |
<p><em><a href="#" onclick="textatcursor('adrotate_bannercode','<iframe src="%asset%" height="250" frameborder="0" style="border:none;"></iframe>');return false;"><iframe src="%asset%" height="250" frameborder="0" style="border:none;"></iframe></a></em></p>
|
123 |
+
|
124 |
+
<p><strong><?php _e('Get paid as a publisher:', 'adrotate'); ?></strong></p>
|
125 |
+
<p><a href="http://signup.clicksor.com/advertise_here.php?nid=1&srid=&ref=381832" target="_blank"><img alt="Clicksor" height="125" width="125" src="<?php echo plugins_url('../../images/clicksor.png', __FILE__); ?>"></a> <a href="https://www.viglink.com/?vgref=2984797&vgtag=banner">
|
126 |
+
<img alt="VigLink" height="125" width="125" src="<?php echo plugins_url('../../images/viglink.png', __FILE__); ?>" />
|
127 |
+
</a></p>
|
128 |
</td>
|
129 |
+
</tr>
|
130 |
<tr>
|
131 |
<th valign="top"><?php _e('Useful tags', 'adrotate'); ?></th>
|
132 |
+
<td>
|
133 |
<p><em><a href="#" title="<?php _e('Insert the advert ID Number.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%id%');return false;">%id%</a>, <a href="#" title="<?php _e('Required when selecting a asset below.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%asset%');return false;">%asset%</a>, <a href="#" title="<?php _e('Insert the advert name.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%title%');return false;">%title%</a>, <a href="#" title="<?php _e('Insert a random seed. Useful for DFP/DoubleClick type adverts.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%random%');return false;">%random%</a>, <a href="#" title="<?php _e('Add inside the <a> tag to open advert in a new window.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','target="_blank"');return false;">target="_blank"</a>, <a href="#" title="<?php _e('Add inside the <a> tag to tell crawlers to ignore this link', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','rel="nofollow"');return false;">rel="nofollow"</a></em><br /><?php _e('Place the cursor in your AdCode where you want to add any of these tags and click to add it.', 'adrotate'); ?></p>
|
134 |
</td>
|
135 |
</tr>
|
dashboard/publisher/adverts-main.php
CHANGED
@@ -87,9 +87,9 @@
|
|
87 |
<td><strong><a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=edit&ad='.$banner['id']);?>" title="<?php _e('Edit', 'adrotate'); ?>"><?php echo stripslashes(html_entity_decode($banner['title']));?></a></strong> <?php if($adrotate_config['stats'] == 1) { ?>- <a href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=report&ad='.$banner['id']);?>" title="<?php _e('Stats', 'adrotate'); ?>"><?php _e('Stats', 'adrotate'); ?></a><?php } ?><span style="color:#999;"><?php if(strlen($grouplist) > 0) echo '<br /><span style="font-weight:bold;">'.__('Groups:', 'adrotate').'</span> '.$grouplist; ?></span></td>
|
88 |
<td><center><?php echo $banner['weight']; ?></center></td>
|
89 |
<?php if($adrotate_config['stats'] == 1) { ?>
|
90 |
-
<?php if($banner['tracker'] == "Y") { ?>
|
91 |
<td><center><?php echo $stats['impressions']; ?></center></td>
|
92 |
<td><center><?php echo $stats_today['impressions']; ?></center></td>
|
|
|
93 |
<td><center><?php echo $stats['clicks']; ?></center></td>
|
94 |
<td><center><?php echo $stats_today['clicks']; ?></center></td>
|
95 |
<td><center><?php echo $ctr; ?> %</center></td>
|
@@ -97,8 +97,6 @@
|
|
97 |
<td><center>--</center></td>
|
98 |
<td><center>--</center></td>
|
99 |
<td><center>--</center></td>
|
100 |
-
<td><center>--</center></td>
|
101 |
-
<td><center>--</center></td>
|
102 |
<?php } ?>
|
103 |
<?php } ?>
|
104 |
</tr>
|
87 |
<td><strong><a class="row-title" href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=edit&ad='.$banner['id']);?>" title="<?php _e('Edit', 'adrotate'); ?>"><?php echo stripslashes(html_entity_decode($banner['title']));?></a></strong> <?php if($adrotate_config['stats'] == 1) { ?>- <a href="<?php echo admin_url('/admin.php?page=adrotate-ads&view=report&ad='.$banner['id']);?>" title="<?php _e('Stats', 'adrotate'); ?>"><?php _e('Stats', 'adrotate'); ?></a><?php } ?><span style="color:#999;"><?php if(strlen($grouplist) > 0) echo '<br /><span style="font-weight:bold;">'.__('Groups:', 'adrotate').'</span> '.$grouplist; ?></span></td>
|
88 |
<td><center><?php echo $banner['weight']; ?></center></td>
|
89 |
<?php if($adrotate_config['stats'] == 1) { ?>
|
|
|
90 |
<td><center><?php echo $stats['impressions']; ?></center></td>
|
91 |
<td><center><?php echo $stats_today['impressions']; ?></center></td>
|
92 |
+
<?php if($banner['tracker'] == "Y") { ?>
|
93 |
<td><center><?php echo $stats['clicks']; ?></center></td>
|
94 |
<td><center><?php echo $stats_today['clicks']; ?></center></td>
|
95 |
<td><center><?php echo $ctr; ?> %</center></td>
|
97 |
<td><center>--</center></td>
|
98 |
<td><center>--</center></td>
|
99 |
<td><center>--</center></td>
|
|
|
|
|
100 |
<?php } ?>
|
101 |
<?php } ?>
|
102 |
</tr>
|
dashboard/publisher/groups-edit.php
CHANGED
@@ -207,7 +207,7 @@ if(!is_array($meta_array)) $meta_array = array();
|
|
207 |
<label for="adrotate_cat_paragraph">
|
208 |
<select tabindex="13" name="adrotate_cat_paragraph">
|
209 |
<option value="0" <?php if($edit_group->cat_par == 0) { echo 'selected'; } ?>>...</option>
|
210 |
-
<option value="
|
211 |
<option value="1" <?php if($edit_group->cat_par == 1) { echo 'selected'; } ?>><?php _e('after the 1st paragraph', 'adrotate'); ?></option>
|
212 |
<option value="2" <?php if($edit_group->cat_par == 2) { echo 'selected'; } ?>><?php _e('after the 2nd paragraph', 'adrotate'); ?></option>
|
213 |
<option value="3" <?php if($edit_group->cat_par == 3) { echo 'selected'; } ?>><?php _e('after the 3rd paragraph', 'adrotate'); ?></option>
|
207 |
<label for="adrotate_cat_paragraph">
|
208 |
<select tabindex="13" name="adrotate_cat_paragraph">
|
209 |
<option value="0" <?php if($edit_group->cat_par == 0) { echo 'selected'; } ?>>...</option>
|
210 |
+
<option value="99" <?php if($edit_group->cat_par == 99) { echo 'selected'; } ?>><?php _e('after the middle paragraph', 'adrotate'); ?></option>
|
211 |
<option value="1" <?php if($edit_group->cat_par == 1) { echo 'selected'; } ?>><?php _e('after the 1st paragraph', 'adrotate'); ?></option>
|
212 |
<option value="2" <?php if($edit_group->cat_par == 2) { echo 'selected'; } ?>><?php _e('after the 2nd paragraph', 'adrotate'); ?></option>
|
213 |
<option value="3" <?php if($edit_group->cat_par == 3) { echo 'selected'; } ?>><?php _e('after the 3rd paragraph', 'adrotate'); ?></option>
|
dashboard/settings/maintenance.php
CHANGED
@@ -75,8 +75,8 @@
|
|
75 |
<tr>
|
76 |
<th width="15%"><?php _e('Advert evaluation', 'adrotate'); ?></th>
|
77 |
<td><?php if(!$adevaluate) '<span style="color:#CC2900;">'._e('Not scheduled! Re-activate the plugin from the plugins page.', 'adrotate-pro').'</span>'; else echo '<span style="color:#009900;">'.date_i18n(get_option('date_format')." H:i", $adevaluate).'</span>'; ?></td>
|
78 |
-
<th width="15%"
|
79 |
-
<td
|
80 |
</tr>
|
81 |
</table>
|
82 |
|
75 |
<tr>
|
76 |
<th width="15%"><?php _e('Advert evaluation', 'adrotate'); ?></th>
|
77 |
<td><?php if(!$adevaluate) '<span style="color:#CC2900;">'._e('Not scheduled! Re-activate the plugin from the plugins page.', 'adrotate-pro').'</span>'; else echo '<span style="color:#009900;">'.date_i18n(get_option('date_format')." H:i", $adevaluate).'</span>'; ?></td>
|
78 |
+
<th width="15%"> </th>
|
79 |
+
<td> </td>
|
80 |
</tr>
|
81 |
</table>
|
82 |
|
images/clicksor.png
ADDED
Binary file
|
images/viglink.png
ADDED
Binary file
|
library/elycharts.min.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
/*!*********************************************************************
|
2 |
-
* ELYCHARTS v2.1.
|
3 |
* A Javascript library to generate interactive charts with vectorial graphics.
|
4 |
*
|
5 |
* Copyright (c) 2010-2014 Void Labs s.n.c. (http://void.it)
|
6 |
* Licensed under the MIT (http://creativecommons.org/licenses/MIT/) license.
|
7 |
**********************************************************************/
|
8 |
-
(function(a){if(!a.elycharts){a.elycharts={}}a.elycharts.templates={common:{margins:[10,10,10,10],interactive:true,defaultSeries:{visible:true,tooltip:{active:true,width:100,height:50,roundedCorners:5,padding:[6,6],offset:[20,0],frameProps:{fill:"white","stroke-width":2},contentStyle:{"font-family":"Arial","font-size":"12px","line-height":"16px",color:"black"}},highlight:{scaleSpeed:100,scaleEasing:"",moveSpeed:100,moveEasing:"",restoreSpeed:0,restoreEasing:""},anchor:{},startAnimation:{type:"simple",speed:600,delay:0,propsFrom:{},propsTo:{},easing:""},label:{active:false,html:false,props:{fill:"black",stroke:"none","font-family":"Arial","font-size":"16px"},style:{cursor:"default"}}},series:{empty:{label:{active:false},tooltip:{active:false}}},features:{tooltip:{fadeDelay:100,moveDelay:300},mousearea:{type:"single",indexCenter:"auto",areaMoveDelay:500,syncTag:false,onMouseEnter:false,onMouseExit:false,onMouseChanged:false,onMouseOver:false,onMouseOut:false},highlight:{indexHighlightProps:{opacity:1}},animation:{startAnimation:{speed:600,delay:0,easing:""},stepAnimation:{speed:600,delay:0,easing:""}},frameAnimation:{active:false,cssFrom:{opacity:0},cssTo:{opacity:1},speed:"slow",easing:"linear"},pixelWorkAround:{active:Raphael.svg},label:{},shadows:{active:false,offset:[2,2],props:{"stroke-width":0,"stroke-opacity":0,fill:"black","fill-opacity":0.3}},balloons:{active:false,style:{},padding:[5,5],left:10,line:[[0,0],[0,0]],lineProps:{}},legend:{horizontal:false,x:"auto",y:10,width:"auto",height:20,itemWidth:"fixed",margins:[0,0,0,0],dotMargins:[10,5],borderProps:{fill:"white",stroke:"black","stroke-width":1},dotType:"rect",dotWidth:10,dotHeight:10,dotR:4,dotProps:{type:"rect",width:10,height:10},textProps:{font:"12px Arial",fill:"#000"}},debug:{active:false}},enableInternalCaching:true,nop:0},line:{template:"common",barMargins:0,barOverlapPerc:0,avgOverNulls:true,defaultAxis:{normalize:2,min:0,labels:false,labelsDistance:8,labelsRotate:0,labelsProps:{font:"10px Arial",fill:"#000"},titleDistance:25,titleDistanceIE:0.75,titleProps:{font:"12px Arial",fill:"#000","font-weight":"bold"}},axis:{x:{titleDistanceIE:1.2}},defaultSeries:{type:"line",axis:"l",cumulative:false,rounded:1,lineCenter:"auto",plotProps:{"stroke-width":1,"stroke-linejoin":"round"},barWidthPerc:100,fill:false,fillProps:{stroke:"none","stroke-width":0,"stroke-opacity":0,opacity:0.3},dot:false,dotProps:{size:4,stroke:"#000",zindex:5},dotShowOnNull:false,mouseareaShowOnNull:false,startAnimation:{plotPropsFrom:false,fillPropsFrom:false,dotPropsFrom:false,shadowPropsFrom:false}},features:{grid:{nx:"auto",ny:4,draw:false,forceBorder:false,props:{stroke:"#e0e0e0","stroke-width":1},extra:[0,0,0,0],labelsCenter:"auto",evenVProps:false,oddVProps:false,evenHProps:false,oddHProps:false,ticks:{active:[false,false,false],size:[10,10],props:{stroke:"#e0e0e0","stroke-width":1}}}},nop:0},pie:{template:"common",startAngle:0,clockwise:false,valueThresold:0.006,margins:[0,0,0,0],defaultSeries:{}},funnel:{template:"common",rh:0,method:"width",topSector:0,topSectorProps:{fill:"#d0d0d0"},bottomSector:0.1,bottomSectorProps:{fill:"#d0d0d0"},edgeProps:{fill:"#c0c0c0","stroke-width":1,opacity:1},nop:0},barline:{template:"common",direction:"ltr"}}})(jQuery);(function(c){if(!c.elycharts){c.elycharts={}}c.elycharts.lastId=0;c.fn.chart=function(j){if(!this.length){return this}var n=this.data("elycharts_env");if(typeof j=="string"){if(j.toLowerCase()=="config"){return n?n.opt:false}if(j.toLowerCase()=="clear"){if(n){if(c.elycharts.featuresmanager){c.elycharts.featuresmanager.clear(n)}n.paper.clear();n.cache=false;if(n.autoresize){c(window).unbind("resize",n.autoresize)}this.html("");this.data("elycharts_env",false)}}return this}if(!n){if(j){j=d(j)}if(!j||!j.type||!c.elycharts.templates[j.type]){alert("ElyCharts ERROR: chart type is not specified");return false}n=i(this,j);this.data("elycharts_env",n)}else{if(!j){j={}}j=b(j,n.opt);n.oldopt=f._clone(n.opt);n.opt=c.extend(true,n.opt,j);n.newopt=j;n.oldwidth=n.width;n.oldheight=n.height}n.cache=j.enableInternalCaching?{}:false;e(n,j);if(n.opt.autoresize){if(!n.autoresize){var m=this;n.autoresize=h(function(){m.chart()});c(window).bind("resize",n.autoresize)}}else{if(n.autoresize){c(window).unbind("resize",n.autoresize);n.autoresize=false}}var l=c.elycharts[n.opt.type].draw(n);if(n.pieces){l=g(n,n.pieces,l)}f._show(n,l);n.pieces=l;return this};function g(t,m,l,u,r,q){var o=[],s;var n=0;for(var p=0;p<m.length;p++){if(l&&(n>=l.length||!f.samePiecePath(m[p],l[n]))){if(!q){m[p].show=false;o.push(m[p])}else{s={path:false,attr:false};s.show=true;s.animation={element:m[p].element?m[p].element:false,speed:0,easing:"",delay:0};o.push(s)}}else{s=l?l[n]:{path:false,attr:false};s.show=true;if(typeof m[p].paths=="undefined"){s.animation={element:m[p].element?m[p].element:false,speed:0,easing:"",delay:0}}else{s.paths=g(t,m[p].paths,l[n].paths,m[p].section,m[p].serie,true)}o.push(s);n++}}if(l){for(;n<l.length;n++){o.push(l[n])}}return o}function h(n,j,l){var o;return function m(){var r=this,q=arguments;function p(){if(!l){n.apply(r,q)}o=null}if(o){clearTimeout(o)}else{if(l){n.apply(r,q)}}o=setTimeout(p,j||100)}}function i(m,j){var l={id:c.elycharts.lastId++,paper:f._RaphaelInstance(m.get()[0],0,0),container:m,plots:[],opt:j};l.paper.rect(0,0,1,1).attr({opacity:0});c.elycharts[j.type].init(l);return l}function e(l,j){if(j.style){l.container.css(j.style)}l.width=j.width?j.width:l.container.width();l.height=j.height?j.height:l.container.height();l.paper.setSize(l.width,l.height)}function d(j){var l;if(c.elysia_charts){if(c.elysia_charts.default_options){for(l in c.elysia_charts.default_options){c.elycharts.templates[l]=c.elysia_charts.default_options[l]}}if(c.elysia_charts.templates){for(l in c.elysia_charts.templates){c.elycharts.templates[l]=c.elysia_charts.templates[l]}}}while(j.template){var m=j.template;delete j.template;j=c.extend(true,{},c.elycharts.templates[m],j)}if(!j.template&&j.type){j.template=j.type;while(j.template){m=j.template;delete j.template;j=c.extend(true,{},c.elycharts.templates[m],j)}}return b(j,j)}function b(j,l){if(j.type=="pie"||j.type=="funnel"){if(j.values&&c.isArray(j.values)&&!c.isArray(j.values[0])){j.values={root:j.values}}if(j.tooltips&&c.isArray(j.tooltips)&&!c.isArray(j.tooltips[0])){j.tooltips={root:j.tooltips}}if(j.anchors&&c.isArray(j.anchors)&&!c.isArray(j.anchors[0])){j.anchors={root:j.anchors}}if(j.balloons&&c.isArray(j.balloons)&&!c.isArray(j.balloons[0])){j.balloons={root:j.balloons}}if(j.legend&&c.isArray(j.legend)&&!c.isArray(j.legend[0])){j.legend={root:j.legend}}}if(j.defaultSeries){var o=j.defaultSeries.type?j.defaultSeries.type:(l.defaultSeries.type?l.defaultSeries.type:l.type);a(j.defaultSeries,l.type,o,l)}if(j.series){for(var n in j.series){var p=j.series[n].type?j.series[n].type:(l.series[n].type?l.series[n].type:(o?o:l.type));a(j.series[n],l.type,p,l)}}if(j.type=="line"){if(!j.features){j.features={}}if(!j.features.grid){j.features.grid={}}if(typeof j.gridNX!="undefined"){j.features.grid.nx=j.gridNX;delete j.gridNX}if(typeof j.gridNY!="undefined"){j.features.grid.ny=j.gridNY;delete j.gridNY}if(typeof j.gridProps!="undefined"){j.features.grid.props=j.gridProps;delete j.gridProps}if(typeof j.gridExtra!="undefined"){j.features.grid.extra=j.gridExtra;delete j.gridExtra}if(typeof j.gridForceBorder!="undefined"){j.features.grid.forceBorder=j.gridForceBorder;delete j.gridForceBorder}if(j.defaultAxis&&j.defaultAxis.normalize&&(j.defaultAxis.normalize=="auto"||j.defaultAxis.normalize=="autony")){j.defaultAxis.normalize=2}if(j.axis){for(var m in j.axis){if(j.axis[m]&&j.axis[m].normalize&&(j.axis[m].normalize=="auto"||j.axis[m].normalize=="autony")){j.axis[m].normalize=2}}}}return j}function a(n,j,l,m){if(n.stackedWith){n.stacked=n.stackedWith;delete n.stackedWith}}c.elycharts.common={_RaphaelInstance:function(n,j,l){var m=Raphael(n,j,l);m.customAttributes.slice=function(o,v,s,q,u,t){a1=360-t;a2=360-u;var p=(a2-a1)>180;a1=(a1%360)*Math.PI/180;a2=(a2%360)*Math.PI/180;if(a1==a2&&u!=t){a2+=359.99*Math.PI/180}return{path:q?[["M",o+s*Math.cos(a1),v+s*Math.sin(a1)],["A",s,s,0,+p,1,o+s*Math.cos(a2),v+s*Math.sin(a2)],["L",o+q*Math.cos(a2),v+q*Math.sin(a2)],["A",q,q,0,+p,0,o+q*Math.cos(a1),v+q*Math.sin(a1)],["z"]]:[["M",o,v],["l",s*Math.cos(a1),s*Math.sin(a1)],["A",s,s,0,+p,1,o+s*Math.cos(a2),v+s*Math.sin(a2)],["z"]]}};return m},_clone:function(m){if(m==null||typeof(m)!="object"){return m}if(m.constructor==Array){return[].concat(m)}var j=new m.constructor();for(var l in m){j[l]=this._clone(m[l])}return j},compactUnits:function(n,l){for(var m=l.length-1;m>=0;m--){var j=n/Math.pow(1000,m+1);if(j>=1&&j*10%10==0){return j+l[m]}}return n},getElementOriginalAttrs:function(l){var j=c(l.node).data("original-attr");if(!j){j=l.attr();c(l.node).data("original-attr",j)}return j},findInPieces:function(n,p,m,j,o){for(var l=0;l<n.length;l++){if((typeof p==undefined||p==-1||p==false||n[l].section==p)&&(typeof m==undefined||m==-1||m==false||n[l].serie==m)&&(typeof j==undefined||j==-1||j==false||n[l].index==j)&&(typeof o==undefined||o==-1||o==false||n[l].subSection==o)){return n[l]}}return false},samePiecePath:function(l,j){return(((typeof l.section==undefined||l.section==-1||l.section==false)&&(typeof j.section==undefined||j.section==-1||j.section==false))||l.section==j.section)&&(((typeof l.serie==undefined||l.serie==-1||l.serie==false)&&(typeof j.serie==undefined||j.serie==-1||j.serie==false))||l.serie==j.serie)&&(((typeof l.index==undefined||l.index==-1||l.index==false)&&(typeof j.index==undefined||j.index==-1||j.index==false))||l.index==j.index)&&(((typeof l.subSection==undefined||l.subSection==-1||l.subSection==false)&&(typeof j.subSection==undefined||j.subSection==-1||j.subSection==false))||l.subSection==j.subSection)},executeIfChanged:function(o,n){if(!o.newopt){return true}for(var m=0;m<n.length;m++){if(n[m][n[m].length-1]=="*"){for(var l in o.newopt){if(l.substring(0,n[m].length-1)+"*"==n[m]){return true}}}else{if(n[m]=="series"&&(o.newopt.series||o.newopt.defaultSeries)){return true}else{if(n[m]=="axis"&&(o.newopt.axis||o.newopt.defaultAxis)){return true}else{if(n[m]=="width"&&(o.oldwidth!=o.width)){return true}else{if(n[m]=="height"&&(o.oldheight!=o.height)){return true}else{if(n[m].substring(0,9)=="features."){n[m]=n[m].substring(9);if(o.newopt.features&&o.newopt.features[n[m]]){return true}}else{if(typeof o.newopt[n[m]]!="undefined"){return true}}}}}}}}return false},getItemColor:function(n,o,l){var m=this.areaProps(n,"Series",o,l);if(m.color){return m.color}if(l!==false&&m.valuesPalette){return m.valuesPalette[l%m.valuesPalette.length]}if(n.opt.seriesPalette){var j=0;for(seriekey in n.opt.values){if(o==seriekey){return n.opt.seriesPalette[j%n.opt.seriesPalette.length]}else{j++}}}},colorize:function(o,n,l,j){if(j){for(k in l){var q=n;var m=0;for(m=0;m<l[k].length-1;m++){if(!q[l[k][m]]){q[l[k][m]]={}}q=q[l[k][m]]}if(!q[l[k][l[k].length-1]]){q[l[k][l[k].length-1]]=j}}}},areaProps:function(m,r,l,n,j){var q;var s=m.opt[r.toLowerCase()];if(!j){if(typeof l=="undefined"||!l){q=s}else{var o=r+"/"+l+"/"+n;if(m.cache&&m.cache.areaPropsCache&&m.cache.areaPropsCache[o]){q=m.cache.areaPropsCache[o]}else{q=this._clone(m.opt["default"+r]);if(s&&s[l]){q=c.extend(true,q,s[l])}if((typeof n!="undefined")&&n>=0&&q.values&&q.values[n]){q=c.extend(true,q,q.values[n])}if(m.cache){if(!m.cache.areaPropsCache){m.cache.areaPropsCache={}}m.cache.areaPropsCache[o]=q}}}}else{var p=j.toLowerCase();q=this._clone(m.opt[p]);if(typeof l=="undefined"||!l){if(s&&s[p]){q=c.extend(true,q,s[p])}}else{if(m.opt["default"+r]&&m.opt["default"+r][p]){q=c.extend(true,q,m.opt["default"+r][p])}if(s&&s[l]&&s[l][p]){q=c.extend(true,q,s[l][p])}if((typeof n!="undefined")&&n>0&&q.values&&q.values[n]){q=c.extend(true,q,q.values[n])}}}return q},_absrectpath:function(l,o,j,n,p){if(p){var m=[["M",l,o+p],["a",p,p,0,0,1,p,-p],["L",j-p,o],["a",p,p,0,0,1,p,p],["L",j,n-p],["a",p,p,0,0,1,-p,p],["L",l+p,n],["a",p,p,0,0,1,-p,-p],["z"]];return m}else{return[["M",l,o],["L",l,n],["L",j,n],["L",j,o],["z"]]}},_linepathAnchors:function(m,l,x,v,s,r,o){var j=1;if(o&&o.length){j=o[1];o=o[0]}if(!o){o=1}var p=(x-m)/2,n=(s-x)/2,y=Math.atan(Math.abs(x-m)/Math.abs(v-l)),w=Math.atan(Math.abs(s-x)/Math.abs(v-r));y=(l<v&&x>m)||(l>v&&x<m)?Math.PI-y:y;w=(r<v&&s>x)||(r>v&&s<x)?Math.PI-w:w;if(j==2){if((y-Math.PI/2)*(w-Math.PI/2)>0){y=0;w=0}else{if(Math.abs(y-Math.PI/2)<Math.abs(w-Math.PI/2)){w=Math.PI-y}else{y=Math.PI-w}}}var q=Math.PI/2-((y+w)%(Math.PI*2))/2,A=p*Math.sin(q+y)/2/o,u=p*Math.cos(q+y)/2/o,z=n*Math.sin(q+w)/2/o,t=n*Math.cos(q+w)/2/o;return{x1:x-A,y1:v+u,x2:x+z,y2:v+t}},_linepath:function(v,n){var w=[];if(n){var q=false;for(var o=0,r=v.length;o<r;o++){var u=v[o][0],s=v[o][1];if(u!=null&&s!=null){if(q){if(o+1!=r&&v[o+1][0]!=null&&v[o+1][1]!=null){var t=this._linepathAnchors(v[o-1][0],v[o-1][1],v[o][0],v[o][1],v[o+1][0],v[o+1][1],n);w.push(["C",q[0],q[1],t.x1,t.y1,v[o][0],v[o][1]]);q=[t.x2,t.y2]}else{w.push(["C",q[0],q[1],v[o][0],v[o][1],v[o][0],v[o][1]]);q=[v[o][0],v[o][1]]}}else{w.push(["M",v[o][0],v[o][1]]);q=[v[o][0],v[o][1]]}}else{q=false}}}else{var m=null;var l=null;for(var p=0;p<v.length;p++){var u=v[p][0],s=v[p][1];if(u!=null&&s!=null){w.push([m==null||l==null?"M":"L",u,s])}m=u;l=s}}return w},_lineareapath:function(t,r,l){var s=this._linepath(t,l);var q=this._linepath(r.reverse(),l);var p=[];var o=null;for(var n=0;n<=s.length;n++){if(n==s.length||s[n][0]=="M"){if(o!=null){for(var m=s.length-n;m<=s.length-o;m++){if(q[m][0]=="M"){p.push(["L",q[m][1],q[m][2]])}else{p.push(q[m])}}p.push(["z"]);o=null}if(n!=s.length){p.push(s[n])}}else{p.push(s[n]);if(o==null){o=n}}}return p},getX:function(j,l){switch(j[0]){case"CIRCLE":return j[1];case"RECT":return j[!l?1:3];case"SLICE":return j[1];default:return j[j.length-2]}},getY:function(j,l){switch(j[0]){case"CIRCLE":return j[2];case"RECT":return j[!l?2:4];case"SLICE":return j[2];default:return j[j.length-1]}},getCenter:function(n,o){if(!n.path){return false}if(n.path.length==0){return false}if(!o){o=[0,0]}if(n.center){return[n.center[0]+o[0],n.center[1]+o[1]]}var m=n.path[0];switch(m[0]){case"CIRCLE":return[m[1]+o[0],m[2]+o[1]];case"RECT":return[(m[1]+m[2])/2+o[0],(m[3]+m[4])/2+o[1]];case"SLICE":var l=m[5]+(m[6]-m[5])/2;var j=Math.PI/180;return[m[1]+(m[4]+((m[3]-m[4])/2)+o[0])*Math.cos(-l*j)+o[1]*Math.cos((-l-90)*j),m[2]+(m[4]+((m[3]-m[4])/2)+o[0])*Math.sin(-l*j)+o[1]*Math.sin((-l-90)*j)]}alert("ElyCharts: getCenter with complex path not supported");return false},movePath:function(w,D,u,s,l){var m=[],v;if(D.length==1&&D[0][0]=="RECT"){return[[D[0][0],this._movePathX(w,D[0][1],u[0],s),this._movePathY(w,D[0][2],u[1],s),this._movePathX(w,D[0][3],u[0],s),this._movePathY(w,D[0][4],u[1],s),D[0][5]]]}if(D.length==1&&D[0][0]=="SLICE"){if(!l){var C=D[0][5]+(D[0][6]-D[0][5])/2;var z=Math.PI/180;var B=D[0][1]+u[0]*Math.cos(-C*z)+u[1]*Math.cos((-C-90)*z);var A=D[0][2]+u[0]*Math.sin(-C*z)+u[1]*Math.cos((-C-90)*z);return[[D[0][0],B,A,D[0][3],D[0][4],D[0][5],D[0][6]]]}else{return[[D[0][0],D[0][1]+u[0],D[0][2]+u[1],D[0][3],D[0][4],D[0][5],D[0][6]]]}}if(D.length==1&&D[0][0]=="CIRCLE"){return[[D[0][0],D[0][1]+u[0],D[0][2]+u[1],D[0][3]]]}if(D.length==1&&D[0][0]=="TEXT"){return[[D[0][0],D[0][1],D[0][2]+u[0],D[0][3]+u[1]]]}if(D.length==1&&D[0][0]=="LINE"){for(v=0;v<D[0][1].length;v++){m.push([this._movePathX(w,D[0][1][v][0],u[0],s),this._movePathY(w,D[0][1][v][1],u[1],s)])}return[[D[0][0],m,D[0][2]]]}if(D.length==1&&D[0][0]=="LINEAREA"){for(v=0;v<D[0][1].length;v++){m.push([this._movePathX(w,D[0][1][v][0],u[0],s),this._movePathY(w,D[0][1][v][1],u[1],s)])}var q=[];for(v=0;v<D[0][2].length;v++){q.push([this._movePathX(w,D[0][2][v][0],u[0],s),this._movePathY(w,D[0][2][v][1],u[1],s)])}return[[D[0][0],m,q,D[0][3]]]}var r=[];for(var t=0;t<D.length;t++){var n=D[t];switch(n[0]){case"M":case"m":case"L":case"l":case"T":case"t":r.push([n[0],this._movePathX(w,n[1],u[0],s),this._movePathY(w,n[2],u[1],s)]);break;case"A":case"a":r.push([n[0],n[1],n[2],n[3],n[4],n[5],this._movePathX(w,n[6],u[0],s),this._movePathY(w,n[7],u[1],s)]);break;case"C":case"c":r.push([n[0],this._movePathX(w,n[1],u[0],s),this._movePathY(w,n[2],u[1],s),this._movePathX(w,n[3],u[0],s),this._movePathY(w,n[4],u[1],s),this._movePathX(w,n[5],u[0],s),this._movePathY(w,n[6],u[1],s)]);break;case"S":case"s":case"Q":case"q":r.push([n[0],this._movePathX(w,n[1],u[0],s),this._movePathY(w,n[2],u[1],s),this._movePathX(w,n[3],u[0],s),this._movePathY(w,n[4],u[1],s)]);break;case"z":case"Z":r.push([n[0]]);break}}return r},_movePathX:function(m,j,l,n){if(j==null){return null}if(!n){return j+l}j=j+l;return l>0&&j>m.width-m.opt.margins[1]?m.width-m.opt.margins[1]:(l<0&&j<m.opt.margins[3]?m.opt.margins[3]:j)},_movePathY:function(l,n,j,m){if(n==null){return null}if(!m){return n+j}n=n+j;return j>0&&n>l.height-l.opt.margins[2]?l.height-l.opt.margins[2]:(j<0&&n<l.opt.margins[0]?l.opt.margins[0]:n)},getSVGProps:function(n,q,j){var p=this._preparePathShow(n,q);var m=j?j:{};var l="path",o;if(p.length==1&&p[0][0]=="RECT"){o=f._absrectpath(p[0][1],p[0][2],p[0][3],p[0][4],p[0][5])}else{if(p.length==1&&p[0][0]=="SLICE"){l="slice";o=[p[0][1],p[0][2],p[0][3],p[0][4],p[0][5],p[0][6]]}else{if(p.length==1&&p[0][0]=="LINE"){o=f._linepath(p[0][1],p[0][2])}else{if(p.length==1&&p[0][0]=="LINEAREA"){o=f._lineareapath(p[0][1],p[0][2],p[0][3])}else{if(p.length==1&&(p[0][0]=="CIRCLE"||p[0][0]=="TEXT"||p[0][0]=="DOMELEMENT"||p[0][0]=="RELEMENT")){return j?j:false}else{o=p}}}}}if(l!="path"||(o&&o.length>0)){m[l]=o}else{if(!j){return false}}return m},showPath:function(n,o,p){if(!p){p=n.paper}if(o.length==1&&o[0][0]=="CIRCLE"){o=this._preparePathShow(n,o);return p.circle(o[0][1],o[0][2],o[0][3])}if(o.length==1&&o[0][0]=="TEXT"){o=this._preparePathShow(n,o);return p.text(o[0][2],o[0][3],o[0][1])}var m=this.getSVGProps(n,o);var l=false;for(var j in m){l=true;break}return m&&l?p.path().attr(m):false},_preparePathShow:function(j,l){return j.opt.features.pixelWorkAround.active?this.movePath(j,this._clone(l),[0.5,0.5],false,true):l},getPieceFullAttr:function(l,j){if(!j.fullattr){j.fullattr=this._clone(j.attr);if(j.path){switch(j.path[0][0]){case"CIRCLE":var m=this._preparePathShow(l,j.path);j.fullattr.cx=m[0][1];j.fullattr.cy=m[0][2];j.fullattr.r=m[0][3];break;case"TEXT":case"DOMELEMENT":case"RELEMENT":break;default:j.fullattr=this.getSVGProps(l,j.path,j.fullattr)}}if(typeof j.fullattr.opacity=="undefined"){j.fullattr.opacity=1}}return j.fullattr},_show:function(o,m){if(c.elycharts.featuresmanager){c.elycharts.featuresmanager.beforeShow(o,m)}pieces=this._getSortedPathData(m);this._animationStackStart(o);var j=false;for(var l=0;l<pieces.length;l++){var n=pieces[l];if((typeof n.show=="undefined"||n.show)&&(typeof n.parent=="undefined"||typeof n.parent.show=="undefined"||n.parent.show)){n.element=n.animation&&n.animation.element?n.animation.element:false;n.hide=false;if(!n.path){n.hide=true}else{if(n.path.length==1&&n.path[0][0]=="TEXT"){if(n.element){f.animationStackPush(o,n,n.element,false,n.animation.speed,n.animation.easing,n.animation.delay,true);n.animation.element=false}n.element=this.showPath(o,n.path);if(n.element&&o.newopt&&j){n.element.insertAfter(j)}}else{if(n.path.length==1&&n.path[0][0]=="DOMELEMENT"){}else{if(n.path.length==1&&n.path[0][0]=="RELEMENT"){if(n.element){f.animationStackPush(o,n,n.element,false,n.animation.speed,n.animation.easing,n.animation.delay,true);n.animation.element=false}n.element=n.path[0][1];if(n.element&&j){n.element.insertAfter(j)}n.attr=false}else{if(!n.element){if(n.animation&&n.animation.startPath&&n.animation.startPath.length){n.element=this.showPath(o,n.animation.startPath)}else{n.element=this.showPath(o,n.path)}if(n.element&&o.newopt&&j){n.element.insertAfter(j)}}}}}}if(n.element){if(n.attr){if(!n.animation){if(typeof n.attr.opacity=="undefined"){n.attr.opacity=1}n.element.attr(n.attr)}else{if(!n.animation.element){n.element.attr(n.animation.startAttr?n.animation.startAttr:n.attr)}f.animationStackPush(o,n,n.element,this.getPieceFullAttr(o,n),n.animation.speed,n.animation.easing,n.animation.delay)}}else{if(n.hide){f.animationStackPush(o,n,n.element,false,n.animation.speed,n.animation.easing,n.animation.delay)}}j=n.element}}}this._animationStackEnd(o);if(c.elycharts.featuresmanager){c.elycharts.featuresmanager.afterShow(o,m)}},_getSortedPathData:function(o){res=[];for(var m=0;m<o.length;m++){var n=o[m];if(n.paths){for(var l=0;l<n.paths.length;l++){n.paths[l].pos=res.length;n.paths[l].parent=n;res.push(n.paths[l])}}else{n.pos=res.length;n.parent=false;res.push(n)}}return res.sort(function(p,j){var r=typeof p.attr=="undefined"||typeof p.attr.zindex=="undefined"?(!p.parent||typeof p.parent.attr=="undefined"||typeof p.parent.attr.zindex=="undefined"?0:p.parent.attr.zindex):p.attr.zindex;var q=typeof j.attr=="undefined"||typeof j.attr.zindex=="undefined"?(!j.parent||typeof j.parent.attr=="undefined"||typeof j.parent.attr.zindex=="undefined"?0:j.parent.attr.zindex):j.attr.zindex;return r<q?-1:(r>q?1:(p.pos<j.pos?-1:(p.pos>j.pos?1:0)))})},_animationStackStart:function(j){if(!j.animationStackDepth||j.animationStackDepth==0){j.animationStackDepth=0;j.animationStack={}}j.animationStackDepth++},_animationStackEnd:function(l){l.animationStackDepth--;if(l.animationStackDepth==0){for(var j in l.animationStack){this._animationStackAnimate(l.animationStack[j],j);delete l.animationStack[j]}l.animationStack={}}},animationStackPush:function(o,n,m,j,q,r,l,p){if(typeof l=="undefined"){l=0}if(!o.animationStackDepth||o.animationStackDepth==0){this._animationStackAnimate([{piece:n,object:m,props:j,speed:q,easing:r,force:p}],l)}else{if(!o.animationStack[l]){o.animationStack[l]=[]}o.animationStack[l].push({piece:n,object:m,props:j,speed:q,easing:r,force:p})}},_animationStackAnimate:function(j,m){var l=this;var n=function(){var p=j.pop();var q=l._animationStackAnimateElement(p);while(j.length>0){var o=j.pop();l._animationStackAnimateElement(o,p,q)}};if(m>0){setTimeout(n,m)}else{n()}},_animationStackAnimateElement:function(j,o,n){if(j.force||!j.piece.animationInProgress){j.object.stop();if(!j.props){j.props={opacity:0}}if(!j.speed||j.speed<=0){j.object.attr(j.props);j.piece.animationInProgress=false;return}j.piece.animationInProgress=true;var l=function(){j.piece.animationInProgress=false};if(Raphael.animation){var m=Raphael.animation(j.props,j.speed,j.easing?j.easing:"linear",l);if(o){j.object.animateWith(o,n,m)}else{j.object.animate(m)}return m}else{if(o){j.object.animateWith(o,j.props,j.speed,j.easing?j.easing:"linear",l)}else{j.object.animate(j.props,j.speed,j.easing?j.easing:"linear",l)}return null}}return null}};var f=c.elycharts.common;c.elycharts.featuresmanager={managers:[],initialized:false,register:function(l,j){c.elycharts.featuresmanager.managers.push([j,l]);c.elycharts.featuresmanager.initialized=false},init:function(){c.elycharts.featuresmanager.managers.sort(function(l,j){return l[0]<j[0]?-1:(l[0]==j[0]?0:1)});c.elycharts.featuresmanager.initialized=true},clear:function(l){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var j=c.elycharts.featuresmanager.managers.length-1;j>=0;j--){if(c.elycharts.featuresmanager.managers[j][1].clear){c.elycharts.featuresmanager.managers[j][1].clear(l)}}},beforeShow:function(l,m){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var j=0;j<c.elycharts.featuresmanager.managers.length;j++){if(c.elycharts.featuresmanager.managers[j][1].beforeShow){c.elycharts.featuresmanager.managers[j][1].beforeShow(l,m)}}},afterShow:function(l,m){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var j=0;j<c.elycharts.featuresmanager.managers.length;j++){if(c.elycharts.featuresmanager.managers[j][1].afterShow){c.elycharts.featuresmanager.managers[j][1].afterShow(l,m)}}},onMouseOver:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseOver){c.elycharts.featuresmanager.managers[m][1].onMouseOver(n,o,l,j)}}},onMouseOut:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseOut){c.elycharts.featuresmanager.managers[m][1].onMouseOut(n,o,l,j)}}},onMouseEnter:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseEnter){c.elycharts.featuresmanager.managers[m][1].onMouseEnter(n,o,l,j)}}},onMouseChanged:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseChanged){c.elycharts.featuresmanager.managers[m][1].onMouseChanged(n,o,l,j)}}},onMouseExit:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseExit){c.elycharts.featuresmanager.managers[m][1].onMouseExit(n,o,l,j)}}}}})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.anchormanager={afterShow:function(e,g){if(!e.opt.anchors){return}if(!e.anchorBinds){e.anchorBinds=[]}while(e.anchorBinds.length){var c=e.anchorBinds.pop();b(c[0]).unbind(c[1],c[2])}for(var d=0;d<e.mouseAreas.length;d++){var f=e.mouseAreas[d].piece?e.mouseAreas[d].piece.serie:false;var h;if(f){h=e.opt.anchors[f][e.mouseAreas[d].index]}else{h=e.opt.anchors[e.mouseAreas[d].index]}if(h&&e.mouseAreas[d].props.anchor&&e.mouseAreas[d].props.anchor.highlight){(function(m,j,n,l){var i=function(){l.anchorMouseOver(m,j)};var o=function(){l.anchorMouseOut(m,j)};if(!m.mouseAreas[d].props.anchor.useMouseEnter){m.anchorBinds.push([n,"mouseover",i]);m.anchorBinds.push([n,"mouseout",o]);b(n).mouseover(i);b(n).mouseout(o)}else{m.anchorBinds.push([n,"mouseenter",i]);m.anchorBinds.push([n,"mouseleave",o]);b(n).mouseenter(i);b(n).mouseleave(o)}})(e,e.mouseAreas[d],h,this)}}e.onAnchors=[]},anchorMouseOver:function(d,c){b.elycharts.highlightmanager.onMouseOver(d,c.piece?c.piece.serie:false,c.index,c)},anchorMouseOut:function(d,c){b.elycharts.highlightmanager.onMouseOut(d,c.piece?c.piece.serie:false,c.index,c)},onMouseOver:function(e,f,d,c){if(!e.opt.anchors){return}if(c.props.anchor&&c.props.anchor.addClass){var g;if(f){g=e.opt.anchors[f][c.index]}else{g=e.opt.anchors[c.index]}if(g){b(g).addClass(c.props.anchor.addClass);e.onAnchors.push([g,c.props.anchor.addClass])}}},onMouseOut:function(e,f,d,c){if(!e.opt.anchors){return}while(e.onAnchors.length>0){var g=e.onAnchors.pop();b(g[0]).removeClass(g[1])}}};b.elycharts.featuresmanager.register(b.elycharts.anchormanager,30)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.animationmanager={beforeShow:function(c,d){if(!c.newopt){this.startAnimation(c,d)}else{this.stepAnimation(c,d)}},stepAnimation:function(c,d){d=this._stepAnimationInt(c,d)},_stepAnimationInt:function(e,h,j,g,c){for(var d=0;d<h.length;d++){var f=a.areaProps(e,j?j:h[d].section,g?g:h[d].serie);if(f&&f.stepAnimation){f=f.stepAnimation}else{f=e.opt.features.animation.stepAnimation}if(typeof h[d].paths=="undefined"){if(f&&f.active&&h[d].animation){h[d].animation.speed=f&&f.speed?f.speed:300;h[d].animation.easing=f&&f.easing?f.easing:"";h[d].animation.delay=f&&f.delay?f.delay:0;if(!h[d].animation.element){h[d].animation.startAttr={opacity:0}}}}else{this._stepAnimationInt(e,h[d].paths,h[d].section,h[d].serie,true)}}},startAnimation:function(e,f){for(var c=0;c<f.length;c++){if(f[c].paths||f[c].path){var d=a.areaProps(e,f[c].section,f[c].serie);if(d&&d.startAnimation){d=d.startAnimation}else{d=e.opt.features.animation.startAnimation}if(d&&d.active){if(d.type=="simple"||f[c].section!="Series"){this.animationSimple(e,d,f[c])}if(d.type=="grow"){this.animationGrow(e,d,f[c])}if(d.type=="avg"){this.animationAvg(e,d,f[c])}if(d.type=="reg"){this.animationReg(e,d,f[c])}}}}},_animationPiece:function(d,f,e){if(d.paths){for(var c=0;c<d.paths.length;c++){this._animationPiece(d.paths[c],f,e)}}else{if(d.path){d.animation={speed:f.speed,easing:f.easing,delay:f.delay,startPath:[],startAttr:a._clone(d.attr)};if(f.propsTo){d.attr=b.extend(true,d.attr,f.propsTo)}if(f.propsFrom){d.animation.startAttr=b.extend(true,d.animation.startAttr,f.propsFrom)}if(e&&f[e.toLowerCase()+"PropsFrom"]){d.animation.startAttr=b.extend(true,d.animation.startAttr,f[e.toLowerCase()+"PropsFrom"])}if(typeof d.animation.startAttr.opacity!="undefined"&&typeof d.attr.opacity=="undefined"){d.attr.opacity=1}}}},animationSimple:function(e,d,c){this._animationPiece(c,d,c.subSection)},animationGrow:function(g,f,e){this._animationPiece(e,f,e.subSection);var d,h,j;switch(g.opt.type){case"line":j=g.height-g.opt.margins[2];switch(e.subSection){case"Plot":if(!e.paths){h=["LINE",[],e.path[0][2]];for(d=0;d<e.path[0][1].length;d++){h[1].push([e.path[0][1][d][0],j])}e.animation.startPath.push(h)}else{for(d=0;d<e.paths.length;d++){if(e.paths[d].path){e.paths[d].animation.startPath.push(["RECT",e.paths[d].path[0][1],j,e.paths[d].path[0][3],j])}}}break;case"Fill":h=["LINEAREA",[],[],e.path[0][3]];for(d=0;d<e.path[0][1].length;d++){h[1].push([e.path[0][1][d][0],j]);h[2].push([e.path[0][2][d][0],j])}e.animation.startPath.push(h);break;case"Dot":for(d=0;d<e.paths.length;d++){if(e.paths[d].path){e.paths[d].animation.startPath.push(["CIRCLE",e.paths[d].path[0][1],j,e.paths[d].path[0][3]])}}break}break;case"pie":if(e.subSection=="Plot"){for(d=0;d<e.paths.length;d++){if(e.paths[d].path&&e.paths[d].path[0][0]=="SLICE"){e.paths[d].animation.startPath.push(["SLICE",e.paths[d].path[0][1],e.paths[d].path[0][2],e.paths[d].path[0][4]+e.paths[d].path[0][3]*0.1,e.paths[d].path[0][4],e.paths[d].path[0][5],e.paths[d].path[0][6]])}}}break;case"funnel":alert("Unsupported animation GROW for funnel");break;case"barline":var c;if(e.section=="Series"&&e.subSection=="Plot"){if(!f.subType){c=g.opt.direction!="rtl"?g.opt.margins[3]:g.width-g.opt.margins[1]}else{if(f.subType==1){c=g.opt.direction!="rtl"?g.width-g.opt.margins[1]:g.opt.margins[3]}}for(d=0;d<e.paths.length;d++){if(e.paths[d].path){if(!f.subType||f.subType==1){e.paths[d].animation.startPath.push(["RECT",c,e.paths[d].path[0][2],c,e.paths[d].path[0][4],e.paths[d].path[0][5]])}else{j=(e.paths[d].path[0][2]+e.paths[d].path[0][4])/2;e.paths[d].animation.startPath.push(["RECT",e.paths[d].path[0][1],j,e.paths[d].path[0][3],j,e.paths[d].path[0][5]])}}}}break}},_animationAvgXYArray:function(c){var e=[],f=0,d;for(d=0;d<c.length;d++){f+=c[d][1]}f=f/c.length;for(d=0;d<c.length;d++){e.push([c[d][0],f])}return e},animationAvg:function(g,f,e){this._animationPiece(e,f,e.subSection);var h=0,d,c;switch(g.opt.type){case"line":switch(e.subSection){case"Plot":if(!e.paths){e.animation.startPath.push(["LINE",this._animationAvgXYArray(e.path[0][1]),e.path[0][2]])}else{c=0;for(d=0;d<e.paths.length;d++){if(e.paths[d].path){c++;h+=e.paths[d].path[0][2]}}h=h/c;for(d=0;d<e.paths.length;d++){if(e.paths[d].path){e.paths[d].animation.startPath.push(["RECT",e.paths[d].path[0][1],h,e.paths[d].path[0][3],e.paths[d].path[0][4]])}}}break;case"Fill":e.animation.startPath.push(["LINEAREA",this._animationAvgXYArray(e.path[0][1]),this._animationAvgXYArray(e.path[0][2]),e.path[0][3]]);break;case"Dot":c=0;for(d=0;d<e.paths.length;d++){if(e.paths[d].path){c++;h+=e.paths[d].path[0][2]}}h=h/c;for(d=0;d<e.paths.length;d++){if(e.paths[d].path){e.paths[d].animation.startPath.push(["CIRCLE",e.paths[d].path[0][1],h,e.paths[d].path[0][3]])}}break}break;case"pie":var j=360/e.paths.length;if(e.subSection=="Plot"){for(d=0;d<e.paths.length;d++){if(e.paths[d].path&&e.paths[d].path[0][0]=="SLICE"){e.paths[d].animation.startPath.push(["SLICE",e.paths[d].path[0][1],e.paths[d].path[0][2],e.paths[d].path[0][3],e.paths[d].path[0][4],d*j,(d+1)*j])}}}break;case"funnel":alert("Unsupported animation AVG for funnel");break;case"barline":alert("Unsupported animation AVG for barline");break}},_animationRegXYArray:function(d){var g=[];var j=d.length;var h=d[0][1];var f=d[j-1][1];for(var e=0;e<d.length;e++){g.push([d[e][0],h+(f-h)/(j-1)*e])}return g},animationReg:function(j,h,g){this._animationPiece(g,h,g.subSection);var e,l,f,d;switch(j.opt.type){case"line":switch(g.subSection){case"Plot":if(!g.paths){g.animation.startPath.push(["LINE",this._animationRegXYArray(g.path[0][1]),g.path[0][2]])}else{l=g.paths.length;if(l>1){for(e=0;!g.paths[e].path&&e<g.paths.length;e++){}f=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=g.paths.length-1;!g.paths[e].path&&e>=0;e--){}d=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=0;e<g.paths.length;e++){if(g.paths[e].path){g.paths[e].animation.startPath.push(["RECT",g.paths[e].path[0][1],f+(d-f)/(l-1)*e,g.paths[e].path[0][3],g.paths[e].path[0][4]])}}}}break;case"Fill":g.animation.startPath.push(["LINEAREA",this._animationRegXYArray(g.path[0][1]),this._animationRegXYArray(g.path[0][2]),g.path[0][3]]);break;case"Dot":l=g.paths.length;if(l>1){for(e=0;!g.paths[e].path&&e<g.paths.length;e++){}f=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=g.paths.length-1;!g.paths[e].path&&e>=0;e--){}d=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=0;e<g.paths.length;e++){if(g.paths[e].path){g.paths[e].animation.startPath.push(["CIRCLE",g.paths[e].path[0][1],f+(d-f)/(l-1)*e,g.paths[e].path[0][3]])}}}break}break;case"pie":alert("Unsupported animation REG for pie");break;case"funnel":alert("Unsupported animation REG for funnel");break;case"barline":alert("Unsupported animation REG for barline");break}}};b.elycharts.featuresmanager.register(b.elycharts.animationmanager,10);b.elycharts.frameanimationmanager={beforeShow:function(c,d){if(c.opt.features.frameAnimation.active){b(c.container.get(0)).css(c.opt.features.frameAnimation.cssFrom)}},afterShow:function(c,d){if(c.opt.features.frameAnimation.active){c.container.animate(c.opt.features.frameAnimation.cssTo,c.opt.features.frameAnimation.speed,c.opt.features.frameAnimation.easing)}}};b.elycharts.featuresmanager.register(b.elycharts.frameanimationmanager,90)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.highlightmanager={removeHighlighted:function(d,c){if(d.highlighted){while(d.highlighted.length>0){var e=d.highlighted.pop();if(e.piece){if(c){a.animationStackPush(d,e.piece,e.piece.element,a.getPieceFullAttr(d,e.piece),e.cfg.restoreSpeed,e.cfg.restoreEasing,0,true)}}else{e.element.remove()}}}},afterShow:function(c,d){if(c.highlighted&&c.highlighted.length>0){this.removeHighlighted(c,false)}c.highlighted=[]},onMouseOver:function(D,u,j,H){var s,c;for(var B=0;B<H.pieces.length;B++){if(H.pieces[B].section=="Series"&&H.pieces[B].paths&&(!u||H.pieces[B].serie==u)&&H.pieces[B].paths[j]&&H.pieces[B].paths[j].element){var e=H.pieces[B].paths[j];c=e.element;s=e.path;var v=a.getElementOriginalAttrs(c);var F=false;var f=u?H.props:a.areaProps(D,H.pieces[B].section,H.pieces[B].serie);var r,G,y;if(s&&f.highlight){if(f.highlight.scale){var J=f.highlight.scale;if(typeof J=="number"){J=[J,J]}if(s[0][0]=="RECT"){var o=s[0][3]-s[0][1];var C=s[0][4]-s[0][2];s=[["RECT",s[0][1],s[0][2]-C*(J[1]-1),s[0][3]+o*(J[0]-1),s[0][4]]];a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.scaleSpeed,f.highlight.scaleEasing)}else{if(s[0][0]=="CIRCLE"){F={r:s[0][3]*J[0]};a.animationStackPush(D,e,c,F,f.highlight.scaleSpeed,f.highlight.scaleEasing)}else{if(s[0][0]=="SLICE"){var E=(s[0][6]-s[0][5])*(J[1]-1)/2;if(E>90){E=90}s=[["SLICE",s[0][1],s[0][2],s[0][3]*J[0],s[0][4],s[0][5]-E,s[0][6]+E]];a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.scaleSpeed,f.highlight.scaleEasing)}else{if(D.opt.type=="funnel"){var p=(e.rect[2]-e.rect[0])*(J[0]-1)/2;var n=(e.rect[3]-e.rect[1])*(J[1]-1)/2;s=[a.movePath(D,[s[0]],[-p,-n])[0],a.movePath(D,[s[1]],[+p,-n])[0],a.movePath(D,[s[2]],[+p,+n])[0],a.movePath(D,[s[3]],[-p,+n])[0],s[4]];a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.scaleSpeed,f.highlight.scaleEasing,0,true);r=false;if(j>0){G=H.pieces[B].paths[j-1];r=G.element;y=G.path}else{G=a.findInPieces(H.pieces,"Sector","top");if(G){r=G.element;y=G.path}}if(r){y=[y[0],y[1],a.movePath(D,[y[2]],[+p,-n])[0],a.movePath(D,[y[3]],[-p,-n])[0],y[4]];a.animationStackPush(D,G,r,a.getSVGProps(D,y),f.highlight.scaleSpeed,f.highlight.scaleEasing,0,true);D.highlighted.push({piece:G,cfg:f.highlight})}r=false;if(j<H.pieces[B].paths.length-1){G=H.pieces[B].paths[j+1];r=G.element;y=G.path}else{G=a.findInPieces(H.pieces,"Sector","bottom");if(G){r=G.element;y=G.path}}if(r){y=[a.movePath(D,[y[0]],[-p,+n])[0],a.movePath(D,[y[1]],[+p,+n])[0],y[2],y[3],y[4]];a.animationStackPush(D,G,r,a.getSVGProps(D,y),f.highlight.scaleSpeed,f.highlight.scaleEasing,0,true);D.highlighted.push({piece:G,cfg:f.highlight})}}}}}}if(f.highlight.newProps){for(var I in f.highlight.newProps){if(typeof v[I]=="undefined"){v[I]=false}}a.animationStackPush(D,e,c,f.highlight.newProps)}if(f.highlight.move){var g=b.isArray(f.highlight.move)?f.highlight.move:[f.highlight.move,0];s=a.movePath(D,s,g);a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.moveSpeed,f.highlight.moveEasing)}D.highlighted.push({piece:e,cfg:f.highlight});if(f.highlight.overlayProps){c=a.showPath(D,s);if(F){c.attr(F)}c.attr(f.highlight.overlayProps);v=false;D.highlighted.push({element:c,attr:v,cfg:f.highlight})}}}}if(D.opt.features.highlight.indexHighlight&&D.opt.type=="line"){var q=D.opt.features.highlight.indexHighlight;if(q=="auto"){q=(D.indexCenter=="bar"?"bar":"line")}var A=(D.width-D.opt.margins[3]-D.opt.margins[1])/(D.opt.labels.length>0?D.opt.labels.length:1);var z=(D.width-D.opt.margins[3]-D.opt.margins[1])/(D.opt.labels.length>1?D.opt.labels.length-1:1);var m=true;switch(q){case"bar":s=[["RECT",D.opt.margins[3]+j*A,D.opt.margins[0],D.opt.margins[3]+(j+1)*A,D.height-D.opt.margins[2]]];break;case"line":m=false;case"barline":var l=Math.round((m?A/2:0)+D.opt.margins[3]+j*(m?A:z));s=[["M",l,D.opt.margins[0]],["L",l,D.height-D.opt.margins[2]]]}if(s){c=a.showPath(D,s).attr(D.opt.features.highlight.indexHighlightProps);D.highlighted.push({element:c,attr:false,cfg:D.opt.features.highlight})}}},onMouseOut:function(e,f,d,c){this.removeHighlighted(e,true)}};b.elycharts.featuresmanager.register(b.elycharts.highlightmanager,21)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.labelmanager={beforeShow:function(f,g){if(!a.executeIfChanged(f,["labels","values","series"])){return}if(f.opt.labels&&(f.opt.type=="pie"||f.opt.type=="funnel")){var j=false;var h;for(var d=0;d<g.length;d++){if(g[d].section=="Series"&&g[d].subSection=="Plot"){var e=a.areaProps(f,"Series",g[d].serie);if(f.emptySeries&&f.opt.series.empty){e.label=b.extend(true,e.label,f.opt.series.empty.label)}if(e&&e.label&&e.label.active){h=[];for(var c=0;c<g[d].paths.length;c++){if(g[d].paths[c].path){j=c;h.push(this.showLabel(f,g[d],g[d].paths[c],g[d].serie,c,g))}else{h.push({path:false,attr:false})}}g.push({section:g[d].section,serie:g[d].serie,subSection:"Label",paths:h})}}else{if(g[d].section=="Sector"&&g[d].serie=="bottom"&&!g[d].subSection&&j<f.opt.labels.length-1){h=[];h.push(this.showLabel(f,g[d],g[d],"Series",f.opt.labels.length-1,g));g.push({section:g[d].section,serie:g[d].serie,subSection:"Label",paths:h})}}}}},showLabel:function(o,u,t,m,q,l){var j=a.areaProps(o,"Series",m,q);if(o.opt.labels[q]||j.label.label){var h=t;var s=j.label.label?j.label.label:o.opt.labels[q];var d=a.getCenter(h,j.label.offset);if(!j.label.html){var r=j.label.props;if(j.label.frameAnchor){r=a._clone(j.label.props);r["text-anchor"]=j.label.frameAnchor[0];r["alignment-baseline"]=j.label.frameAnchor[1]}return{path:[["TEXT",s,d[0],d[1]]],attr:r}}else{var n=1;var g=a._clone(j.label.style);var f=(typeof g.opacity!="undefined");if(f){n=g.opacity;g.opacity=0}g.position="absolute";g["z-index"]=25;var i;if(typeof s=="string"){i=b("<div>"+s+"</div>").css(g).prependTo(o.container)}else{i=b(s).css(g).prependTo(o.container)}if(o.opt.features.debug.active&&i.height()==0){alert("DEBUG: Al gestore label e' stata passata una label ancora senza dimensioni, quindi ancora non disegnata. Per questo motivo il posizionamento potrebbe non essere correto.")}var e=d[0];var c=d[1];if(!j.label.frameAnchor||j.label.frameAnchor[0]=="middle"){e-=i.width()/2}else{if(j.label.frameAnchor&&j.label.frameAnchor[0]=="end"){e-=i.width()}}if(!j.label.frameAnchor||j.label.frameAnchor[1]=="middle"){c-=i.height()/2}else{if(j.label.frameAnchor&&j.label.frameAnchor[1]=="top"){c-=i.height()}}if(f){i.css({margin:c+"px 0 0 "+e+"px",opacity:n})}else{i.css({margin:c+"px 0 0 "+e+"px"})}return{path:[["DOMELEMENT",i]],attr:false}}}return false}};b.elycharts.featuresmanager.register(b.elycharts.labelmanager,5)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.legendmanager={afterShow:function(L,l){if(L.legenditems){for(item in L.legenditems){L.legenditems[item].remove()}L.legenditems=false}if(!L.opt.legend||L.opt.legend.length==0){return}var d=L.opt.features.legend;if(d===false){return}var e=d.x;if(e=="auto"){var D=1;e=0}var c=d.width;if(c=="auto"){var o=1;c=L.width}var H=0;var A=[];var f=0;var B,M,K,r,q,p,G;for(B in L.opt.legend){if(L.opt.type!="pie"){f++}else{f+=L.opt.legend[B].length}}var J=0;for(B in L.opt.legend){if(L.opt.type!="pie"){M=[L.opt.legend[B]]}else{M=L.opt.legend[B]}for(var I=0;I<M.length;I++){var m=a.areaProps(L,"Series",B,L.opt.type=="pie"?I:false);var C=b.extend(true,{},d);if(m.legend){C=b.extend(true,C,m.legend)}var F=a.getItemColor(L,B,L.opt.type=="pie"?I:false);if(F){a.colorize(L,C,[["dotProps","fill"]],F)}if(!C.dotProps.fill&&L.opt.type=="pie"){if(m.plotProps&&m.plotProps.fill){C.dotProps.fill=m.plotProps.fill}}var g=d.margins?d.margins[0]+d.margins[2]:0;var n=d.margins?d.margins[1]+d.margins[3]:0;var N=d.margins?d.margins[0]:0;var z=d.margins?d.margins[3]:0;if(!d.horizontal){K=(d.height-g)/f;r=c-n;q=Math.floor(e+z);p=Math.floor(d.y+N+K*J)}else{K=d.height-g;if(!d.itemWidth||d.itemWidth=="fixed"){r=(c-n)/f;q=Math.floor(e+z+r*J)}else{r=(c-n)-H;q=e+z+H}p=Math.floor(d.y+N)}if(C.dotType=="rect"){A.push(a.showPath(L,[["RECT",d.dotMargins[0]+q,p+Math.floor((K-C.dotHeight)/2),d.dotMargins[0]+q+C.dotWidth,p+Math.floor((K-C.dotHeight)/2)+C.dotHeight,C.dotR]]).attr(C.dotProps));G=d.dotMargins[0]+C.dotWidth+d.dotMargins[1]}else{if(C.dotType=="circle"){A.push(a.showPath(L,[["CIRCLE",d.dotMargins[0]+q+C.dotR,p+(K/2),C.dotR]]).attr(C.dotProps));G=d.dotMargins[0]+C.dotR*2+d.dotMargins[1]}}var v=M[I];var u=a.showPath(L,[["TEXT",v,q+G,p+Math.ceil(K/2)+(Raphael.VML?2:0)]]).attr({"text-anchor":"start"}).attr(C.textProps);A.push(u);while(u.getBBox().width>(r-G)&&u.getBBox().width>10){v=v.substring(0,v.length-1);u.attr({text:v})}u.show();if(d.horizontal&&d.itemWidth=="auto"){H+=G+u.getBBox().width+4}else{if(!d.horizontal&&o){H=u.getBBox().width+G>H?u.getBBox().width+G:H}else{H+=r}}J++}}if(o){c=H+d.margins[3]+d.margins[1]-1}if(D){e=Math.floor((L.width-c)/2);for(J in A){if(A[J].attrs.x){A[J].attr("x",A[J].attrs.x+e)}else{A[J].attr("path",a.movePath(L,A[J].attrs.path,[e,0]))}}}var s=[["RECT",e,d.y,e+c,d.y+d.height,d.r]];var E=a.showPath(L,s).attr(d.borderProps);for(J in A){A[J].toFront()}A.unshift(E);L.legenditems=A}};b.elycharts.featuresmanager.register(b.elycharts.legendmanager,90)})(jQuery);(function(c){var a=c.elycharts.featuresmanager;var b=c.elycharts.common;c.elycharts.mousemanager={clear:function(d){if(d.mouseLayer){d.mouseLayer.remove();d.mouseLayer=null;d.mousePaper.clear();d.mousePaper.remove();d.mousePaper=null;d.mouseTimer=null;d.mouseAreas=null}},afterShow:function(n,g){if(!n.opt.interactive){return}this.clear(n);n.mouseLayer=c("<div></div>").css({position:"absolute","z-index":20,opacity:1}).prependTo(n.container);n.mousePaper=b._RaphaelInstance(n.mouseLayer.get(0),n.width,n.height);var f=n.mousePaper;if(n.opt.features.debug.active&&typeof DP_Debug!="undefined"){n.paper.text(n.width,n.height-5,"DEBUG").attr({"text-anchor":"end",stroke:"red",opacity:0.1});f.text(n.width,n.height-5,"DEBUG").attr({"text-anchor":"end",stroke:"red",opacity:0.1}).click(function(){DP_Debug.dump(n.opt,"",false,4)})}var l,h;n.mouseAreas=[];if(n.opt.features.mousearea.type=="single"){for(l=0;l<g.length;l++){if(g[l].mousearea){if(!g[l].paths){if(g[l].path.length>=1&&(g[l].path[0][0]=="LINE"||g[l].path[0][0]=="LINEAREA")){for(h=0;h<g[l].path[0][1].length;h++){var o=b.areaProps(n,g[l].section,g[l].serie);if(o.mouseareaShowOnNull||g[l].section!="Series"||n.opt.values[g[l].serie][h]!=null){n.mouseAreas.push({path:[["CIRCLE",g[l].path[0][1][h][0],g[l].path[0][1][h][1],10]],piece:g[l],pieces:g,index:h,props:o})}}}else{for(h=0;h<g[l].path.length;h++){n.mouseAreas.push({path:[["CIRCLE",b.getX(g[l].path[h]),b.getY(g[l].path[h]),10]],piece:g[l],pieces:g,index:h,props:b.areaProps(n,g[l].section,g[l].serie)})}}}else{if(g[l].paths){for(h=0;h<g[l].paths.length;h++){if(g[l].paths[h].path){n.mouseAreas.push({path:g[l].paths[h].path,piece:g[l],pieces:g,index:h,props:b.areaProps(n,g[l].section,g[l].serie)})}}}}}}}else{var d=n.opt.features.mousearea.indexCenter;if(d=="auto"){d=n.indexCenter}var e,r;if(d=="bar"){r=(n.width-n.opt.margins[3]-n.opt.margins[1])/(n.opt.labels.length>0?n.opt.labels.length:1);e=n.opt.margins[3]}else{r=(n.width-n.opt.margins[3]-n.opt.margins[1])/(n.opt.labels.length>1?n.opt.labels.length-1:1);e=n.opt.margins[3]-r/2}for(var q in n.opt.labels){var m=parseInt(q);n.mouseAreas.push({path:[["RECT",e+m*r,n.height-n.opt.margins[2],e+(m+1)*r,n.opt.margins[0]]],piece:false,pieces:g,index:parseInt(m),props:n.opt.defaultSeries})}}var p=false;if(!n.opt.features.mousearea.syncTag){n.mouseareaenv={chartEnv:false,mouseObj:false,caller:false,inArea:-1,timer:false};p=n.mouseareaenv}else{if(!c.elycharts.mouseareaenv){c.elycharts.mouseareaenv={}}if(!c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]){c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]={chartEnv:false,mouseObj:false,caller:false,inArea:-1,timer:false}}p=c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]}for(l=0;l<n.mouseAreas.length;l++){n.mouseAreas[l].area=b.showPath(n,n.mouseAreas[l].path,f).attr({stroke:"#000",fill:"#fff",opacity:0});(function(u,w,v,s,j){var t=w.piece;var i=w.index;w.mouseover=function(x){w.event=x;clearTimeout(j.timer);s.onMouseOverArea(u,t,i,w);if(j.chartEnv&&j.chartEnv.id!=u.id){j.caller.onMouseExitArea(j.chartEnv,j.mouseObj.piece,j.mouseObj.index,j.mouseObj);s.onMouseEnterArea(u,t,i,w)}else{if(j.inArea!=v){if(j.inArea<0){s.onMouseEnterArea(u,t,i,w)}else{s.onMouseChangedArea(u,t,i,w)}}}j.chartEnv=u;j.mouseObj=w;j.caller=s;j.inArea=v};w.mouseout=function(x){w.event=x;clearTimeout(j.timer);s.onMouseOutArea(u,t,i,w);j.timer=setTimeout(function(){j.timer=false;s.onMouseExitArea(u,t,i,w);j.chartEnv=false;j.inArea=-1},u.opt.features.mousearea.areaMoveDelay)};c(w.area.node).mouseover(w.mouseover);c(w.area.node).mouseout(w.mouseout)})(n,n.mouseAreas[l],l,this,p)}},onMouseOverArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseOver){g.opt.features.mousearea.onMouseOver(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseOver(g,d.piece?d.piece.serie:false,d.index,d)},onMouseOutArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseOut){g.opt.features.mousearea.onMouseOut(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseOut(g,d.piece?d.piece.serie:false,d.index,d)},onMouseEnterArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseEnter){g.opt.features.mousearea.onMouseEnter(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseEnter(g,d.piece?d.piece.serie:false,d.index,d)},onMouseChangedArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseChanged){g.opt.features.mousearea.onMouseChanged(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseChanged(g,d.piece?d.piece.serie:false,d.index,d)},onMouseExitArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseExit){g.opt.features.mousearea.onMouseExit(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseExit(g,d.piece?d.piece.serie:false,d.index,d)}};c.elycharts.featuresmanager.register(c.elycharts.mousemanager,0)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.tooltipmanager={clear:function(c){if(c.tooltipContainer){c.tooltipFrame.clear();c.tooltipFrame.remove();c.tooltipFrame=null;c.tooltipFrameElement=null;c.tooltipContent.remove();c.tooltipContent=null;c.tooltipContainer.remove();c.tooltipContainer=null}},afterShow:function(c,d){this.clear(c);if(!b.elycharts.tooltipid){b.elycharts.tooltipid=0}b.elycharts.tooltipid++;c.tooltipContainer=b('<div id="elycharts_tooltip_'+b.elycharts.tooltipid+'" style="position: absolute; top: 100; left: 100; z-index: 10; overflow: hidden; white-space: nowrap; display: none"><div id="elycharts_tooltip_'+b.elycharts.tooltipid+'_frame" style="position: absolute; top: 0; left: 0; z-index: -1"></div><div id="elycharts_tooltip_'+b.elycharts.tooltipid+'_content" style="cursor: default"></div></div>').appendTo(document.body);c.tooltipFrame=a._RaphaelInstance("elycharts_tooltip_"+b.elycharts.tooltipid+"_frame",500,500);c.tooltipContent=b("#elycharts_tooltip_"+b.elycharts.tooltipid+"_content")},_prepareShow:function(e,d,c,g){if(d.width&&d.width!="auto"&&d.height&&d.height!="auto"){var j=d.frameProps&&d.frameProps["stroke-width"]?d.frameProps["stroke-width"]:0;e.tooltipContainer.width(d.width+j+1).height(d.height+j+1);if(!e.tooltipFrameElement&&d.frameProps){var f=[["RECT",j/2,j/2,d.width,d.height,d.roundedCorners]];e.tooltipFrameElement=a.showPath(e,f,e.tooltipFrame).attr(d.frameProps)}}if(e.tooltipFrameElement){e.tooltipFrameElement.attr(d.frameProps)}if(d.padding){e.tooltipContent.css({padding:d.padding[0]+"px "+d.padding[1]+"px"})}e.tooltipContent.css(d.contentStyle);e.tooltipContent.html(g);var h=b(e.container).offset();if(e.opt.features.tooltip.fixedPos){h.top+=e.opt.features.tooltip.fixedPos[1];h.left+=e.opt.features.tooltip.fixedPos[0]}else{var i=this.getXY(e,d,c);if(!i[2]){h.left+=i[0];while(h.top+i[1]<0){i[1]+=20}h.top+=i[1]}else{h.left=i[0];h.top=i[1]}}return{top:h.top,left:h.left}},getXY:function(e,i,c){var m=0,l=0;if(c.path[0][0]=="RECT"){m=a.getX(c.path[0])-i.offset[1];l=a.getY(c.path[0])-i.height-i.offset[0]}else{if(c.path[0][0]=="CIRCLE"){m=a.getX(c.path[0])-i.offset[1];l=a.getY(c.path[0])-i.height-i.offset[0]}else{if(c.path[0][0]=="SLICE"){var p=c.path[0];var n=i.width&&i.width!="auto"?i.width:100;var d=i.height&&i.height!="auto"?i.height:100;var f=Math.sqrt(Math.pow(n,2)+Math.pow(d,2))/2;if(f>e.opt.r){f=e.opt.r}var o=p[5]+(p[6]-p[5])/2+180;var g=Math.PI/180;m=p[1]+f*Math.cos(-o*g)-n/2;l=p[2]+f*Math.sin(-o*g)-d/2}else{if(c.piece&&c.piece.paths&&c.index>=0&&c.piece.paths[c.index]&&c.piece.paths[c.index].rect){var j=c.piece.paths[c.index].rect;m=j[0]-i.offset[1];l=j[1]-i.height-i.offset[0]}}}}if(e.opt.features.tooltip.positionHandler){return e.opt.features.tooltip.positionHandler(e,i,c,m,l)}else{return[m,l]}},getTip:function(d,e,c){var f=false;if(d.opt.tooltips){if(typeof d.opt.tooltips=="function"){f=d.opt.tooltips(d,e,c,e&&d.opt.values[e]&&d.opt.values[e][c]?d.opt.values[e][c]:false,d.opt.labels&&d.opt.labels[c]?d.opt.labels[c]:false)}else{if(e&&d.opt.tooltips[e]&&d.opt.tooltips[e][c]){f=d.opt.tooltips[e][c]}else{if(!e&&d.opt.tooltips[c]){f=d.opt.tooltips[c]}}}}return f},_getProps:function(g,h,e,d){var f=d.props.tooltip;if(g.emptySeries&&g.opt.series.empty){f=b.extend(true,f,g.opt.series.empty.tooltip)}if(!f||!f.active){return false}if(f.frameProps){var c=a.getItemColor(g,h,e);if(c){f=a._clone(f);a.colorize(g,f,[["frameProps","stroke"]],c)}}return f},_fadeOut:function(c){c.tooltipContainer.fadeOut(c.opt.features.tooltip.fadeDelay)},onMouseEnter:function(f,g,d,c){var e=this._getProps(f,g,d,c);if(!e){return false}var h=this.getTip(f,g,d);if(!h){this._fadeOut(f);return true}f.tooltipContainer.css(this._prepareShow(f,e,c,h)).fadeIn(f.opt.features.tooltip.fadeDelay);return true},onMouseChanged:function(f,g,d,c){var e=this._getProps(f,g,d,c);if(!e){return false}var h=this.getTip(f,g,d);if(!h){this._fadeOut(f);return true}f.tooltipContainer.clearQueue();f.tooltipContainer.fadeIn(f.opt.features.tooltip.fadeDelay);f.tooltipContainer.animate(this._prepareShow(f,e,c,h),f.opt.features.tooltip.moveDelay,"linear");return true},onMouseExit:function(f,g,d,c){var e=this._getProps(f,g,d,c);if(!e){return false}this._fadeOut(f);return true}};b.elycharts.featuresmanager.register(b.elycharts.tooltipmanager,20)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.line={init:function(c){},_getColorizationKey:function(c){if(c=="line"){return[["plotProps","stroke"],["dotProps","fill"],["fillProps","fill"]]}else{return[["plotProps","stroke"],["plotProps","fill"]]}},draw:function(n){if(a.executeIfChanged(n,["values","series"])){n.plots={};n.axis={x:{}};n.barno=0;n.indexCenter="line"}var z=n.opt;var N=n.plots;var A=n.axis;var f=n.paper;var X=n.opt.values;var q=n.opt.labels;var S,o,E,B,e,m;if(a.executeIfChanged(n,["values","series"])){var V=0;var O=false;for(B in X){e={index:V,type:false,visible:false};N[B]=e;if(X[B]){E=a.areaProps(n,"Series",B);e.type=E.type;if(E.type=="bar"){n.indexCenter="bar"}if(E.visible){e.visible=true;if(!m||m<X[B].length){m=X[B].length}var I=[];for(S=0;S<X[B].length;S++){var F=X[B][S];if(E.avgOverNulls&&F==null){if(E.type=="bar"){F=0}else{for(var R=S+1;R<X[B].length&&X[B][R]==null;R++){}var h=R<X[B].length?X[B][R]:null;for(var Q=S-1;Q>=0&&X[B][Q]==null;Q--){}var H=Q>=0?X[B][Q]:null;F=h!=null?(H!=null?(h*(S-Q)+H*(R-S))/(R-Q):h):H}}I.push(F)}if(E.stacked&&!(typeof E.stacked=="string")){E.stacked=O}if(typeof E.stacked=="undefined"||E.stacked==B||E.stacked<0||!N[E.stacked]||!N[E.stacked].visible||N[E.stacked].type!=e.type){e.ref=B;if(E.type=="bar"){e.barno=n.barno++}e.from=[];if(!E.cumulative){e.to=I}else{e.to=[];o=0;for(S=0;S<I.length;S++){e.to.push(o+=I[S]!=null?I[S]:0)}}for(S=0;S<I.length;S++){e.from.push(e.to[S]!=null?0:null)}}else{e.ref=E.stacked;if(E.type=="bar"){e.barno=N[E.stacked].barno}e.from=N[E.stacked].stack;e.to=[];o=0;if(!E.cumulative){for(S=0;S<I.length;S++){e.to.push(e.from[S]+(I[S]!=null?I[S]:0))}}else{for(S=0;S<I.length;S++){e.to.push(e.from[S]+(o+=(I[S]!=null?I[S]:0)))}}N[E.stacked].stack=e.to}e.stack=e.to;e.max=Math.max.apply(Math,e.from.concat(e.to));e.min=Math.min.apply(Math,e.from.concat(e.to));if(E.axis){if(!A[E.axis]){A[E.axis]={plots:[]}}A[E.axis].plots.push(B);if(typeof A[E.axis].max=="undefined"){A[E.axis].max=e.max}else{A[E.axis].max=Math.max(A[E.axis].max,e.max)}if(typeof A[E.axis].min=="undefined"){A[E.axis].min=e.min}else{A[E.axis].min=Math.min(A[E.axis].min,e.min)}}O=B}}}}if(!q){q=[]}while(m>q.length){q.push(null)}m=q.length;n.opt.labels=q;if(a.executeIfChanged(n,["values","series","axis"])){for(var s in A){E=a.areaProps(n,"Axis",s);A[s].props=E;if(typeof E.max!="undefined"){A[s].max=E.max}if(typeof E.min!="undefined"){A[s].min=E.min}if(A[s].min==A[s].max){A[s].max=A[s].min+1}if(E.normalize&&E.normalize>0){var M=Math.abs(A[s].max);if(A[s].min&&Math.abs(A[s].min)>M){M=Math.abs(A[s].min)}if(M){var C=Math.floor(Math.log(M)/Math.LN10)-(E.normalize-1);C=C>=0?Math.pow(10,C):1/Math.pow(10,-C);M=Math.ceil(M/C/(z.features.grid.ny?z.features.grid.ny:1))*C*(z.features.grid.ny?z.features.grid.ny:1);M=Math.round(M/C)*C;A[s].normalizationBase=C;if(A[s].max){A[s].max=Math.ceil(A[s].max/M)*M}if(A[s].min){A[s].min=Math.floor(A[s].min/M)*M}}}if(A[s].plots){for(var J=0;J<A[s].plots.length;J++){N[A[s].plots[J]].max=A[s].max;N[A[s].plots[J]].min=A[s].min}}}}var T=[];this.grid(n,T);var t=(n.width-z.margins[3]-z.margins[1])/(q.length>1?q.length-1:1);var P=(n.width-z.margins[3]-z.margins[1])/(q.length>0?q.length:1);for(B in X){E=a.areaProps(n,"Series",B);e=N[B];a.colorize(n,E,this._getColorizationKey(E.type),a.getItemColor(n,B));if(E.lineCenter&&E.lineCenter=="auto"){E.lineCenter=(n.indexCenter=="bar")}else{if(E.lineCenter&&n.indexCenter=="line"){n.indexCenter="bar"}}if(X[B]&&E.visible){var r=(n.height-z.margins[2]-z.margins[0])/(e.max-e.min);if(E.type=="line"){var D=["LINE",[],E.rounded];var g=["LINEAREA",[],[],E.rounded];var W=[];for(S=0,J=q.length;S<J;S++){if(e.to.length>S){var Y=a.areaProps(n,"Series",B,S);a.colorize(n,Y,this._getColorizationKey(E.type),a.getItemColor(n,B,S));var L=Math.round((E.lineCenter?P/2:0)+z.margins[3]+S*(E.lineCenter?P:t));var K=null;if(e.to[S]!=null){var U=e.to[S]>e.max?e.max:(e.to[S]<e.min?e.min:e.to[S]);K=Math.round(n.height-z.margins[2]-r*(U-e.min))}var p=null;if(e.from[S]!=null){var u=e.from[S]>e.max?e.max:(e.from[S]<e.min?e.min:e.from[S]);p=Math.round(n.height-z.margins[2]-r*(u-e.min))+(Raphael.VML?1:0)}D[1].push([L,K]);if(E.fill){g[1].push([L,K]);g[2].push([L,p])}if(Y.dot){if(X[B][S]==null&&!Y.dotShowOnNull){W.push({path:false,attr:false})}else{W.push({path:[["CIRCLE",L,K,Y.dotProps.size]],attr:Y.dotProps})}}}}if(E.fill){T.push({section:"Series",serie:B,subSection:"Fill",path:[g],attr:E.fillProps})}else{T.push({section:"Series",serie:B,subSection:"Fill",path:false,attr:false})}T.push({section:"Series",serie:B,subSection:"Plot",path:[D],attr:E.plotProps,mousearea:"pathsteps"});if(W.length){T.push({section:"Series",serie:B,subSection:"Dot",paths:W})}else{T.push({section:"Series",serie:B,subSection:"Dot",path:false,attr:false})}}else{pieceBar=[];for(S=0,J=q.length;S<J;S++){if(e.to.length>S){if(e.from[S]!=e.to[S]){var Y=a.areaProps(n,"Series",B,S);a.colorize(n,Y,this._getColorizationKey(E.type),a.getItemColor(n,B,S));var l=Math.floor((P-z.barMargins)/(1+(n.barno-1)*(100-z.barOverlapPerc)/100));var G=l*(100-E.barWidthPerc)/200;var c=z.barMargins/2+e.barno*(l*(100-z.barOverlapPerc)/100);var w=Math.floor(z.margins[3]+S*P+c+G);var aa=Math.round(n.height-z.margins[2]-r*(e.to[S]-e.min));var Z=Math.round(n.height-z.margins[2]-r*(e.from[S]-e.min));pieceBar.push({path:[["RECT",w,aa,w+l-G*2,Z]],attr:Y.plotProps})}else{pieceBar.push({path:false,attr:false})}}}if(pieceBar.length){T.push({section:"Series",serie:B,subSection:"Plot",paths:pieceBar,mousearea:"paths"})}else{T.push({section:"Series",serie:B,subSection:"Plot",path:false,attr:false,mousearea:"paths"})}}}else{if(E.type=="line"){T.push({section:"Series",serie:B,subSection:"Fill",path:false,attr:false})}T.push({section:"Series",serie:B,subSection:"Plot",path:false,attr:false,mousearea:"paths"});if(E.type=="line"){T.push({section:"Series",serie:B,subSection:"Dot",path:false,attr:false})}}}return T},grid:function(l,ab){if(a.executeIfChanged(l,["values","series","axis","labels","margins","width","height","features.grid"])){var C=l.opt;var I=l.opt.features.grid;var c=l.paper;var E=l.axis;var r=l.opt.labels;var w=(l.width-C.margins[3]-C.margins[1])/(r.length>1?r.length-1:1);var W=(l.width-C.margins[3]-C.margins[1])/(r.length>0?r.length:1);var aa,Z,R,Q,G,X,V,e,J,o;var M=[];var m=I.labelsCenter;if(m=="auto"){m=(l.indexCenter=="bar")}if(E.x&&E.x.props.labels){var H=false;var u=E.x.props.labelsAnchor||"auto";if(u=="auto"){u=E.x.props.labelsRotate>0?"start":(E.x.props.labelsRotate==0?"middle":"end")}var ac=E.x.props.labelsPos||"auto";if(ac=="auto"){ac=m?(E.x.props.labelsRotate==0?u:"middle"):"start"}for(aa=0;aa<r.length;aa++){if((typeof r[aa]!="boolean"&&r[aa]!=null)||r[aa]){if(!E.x.props.labelsSkip||aa>=E.x.props.labelsSkip){J=r[aa];if(E.x.props.labelsFormatHandler){J=E.x.props.labelsFormatHandler(J)}o=(E.x.props.prefix?E.x.props.prefix:"")+J+(E.x.props.suffix?E.x.props.suffix:"");X=C.margins[3]+aa*(m?W:w)+(E.x.props.labelsMargin?E.x.props.labelsMargin:0);if(ac=="middle"){X+=(m?W:w)/2}if(ac=="end"){X+=(m?W:w)}V=l.height-C.margins[2]+E.x.props.labelsDistance;e=c.text(X,V,o).attr(E.x.props.labelsProps).toBack();e.attr({"text-anchor":u});var g=false;var D=e.getBBox();var ae={x:D.x,y:D.y};var ad={x:D.x+D.width,y:D.y+D.height};var q={x:X,y:V};rotate=function(j,i){var y=j.x*Math.cos(i)-j.y*Math.sin(i),x=j.x*Math.sin(i)+j.y*Math.cos(i);return{x:y,y:x}};collide=function(j,i,ah){xor=function(aj,ai){return(aj||ai)&&!(aj&&ai)};if(j.alpha!=i.alpha){throw"collide doens't support rects with different rotations"}var af=rotate({x:j.p1.x-ah,y:j.p1.y-ah},-j.alpha);var ag=rotate({x:j.p2.x+ah,y:j.p2.y+ah},-j.alpha);var x=rotate({x:i.p1.x-ah,y:i.p1.y-ah},-i.alpha);var y=rotate({x:i.p2.x+ah,y:i.p2.y+ah},-i.alpha);return !xor(Math.min(af.x,ag.x)>Math.max(x.x,y.x),Math.max(af.x,ag.x)<Math.min(x.x,y.x))&&!xor(Math.min(af.y,ag.y)>Math.max(x.y,y.y),Math.max(af.y,ag.y)<Math.min(x.y,y.y))};rotated=function(x,i,af){translate=function(ah,ag){return{x:ah.x+ag.x,y:ah.y+ag.y}};negate=function(ag){return{x:-ag.x,y:-ag.y}};var y=translate(rotate(translate(x.p1,negate(i)),af),i);var j=translate(rotate(translate(x.p2,negate(i)),af),i);return{p1:y,p2:j,alpha:x.alpha+af}};D=function(y){if(y.alpha==0){return{x:y.p1.x,y:y.p1.y,width:y.p2.x-y.p1.x,height:y.p2.y-y.p1.y}}else{var j=[];j.push({x:0,y:0});j.push({x:y.p2.x-y.p1.x,y:0});j.push({x:0,y:y.p2.y-y.p1.y});j.push({x:y.p2.x-y.p1.x,y:y.p2.y-y.p1.y});var ai=[];ai.left=0;ai.right=0;ai.top=0;ai.bottom=0;for(_px=0;_px<j.length;_px++){var ag=j[_px];var ah=parseInt((ag.x*Math.cos(y.alpha))+(ag.y*Math.sin(y.alpha)));var af=parseInt((ag.x*Math.sin(y.alpha))+(ag.y*Math.cos(y.alpha)));ai.left=Math.min(ai.left,ah);ai.right=Math.max(ai.right,ah);ai.top=Math.min(ai.top,af);ai.bottom=Math.max(ai.bottom,af)}var x=parseInt(Math.abs(ai.right-ai.left));var i=parseInt(Math.abs(ai.bottom-ai.top));var ah=((y.p1.x+y.p2.x)/2)-x/2;var af=((y.p1.y+y.p2.y)/2)-i/2;return{x:ah,y:af,width:x,height:i}}};var Y=Raphael.rad(E.x.props.labelsRotate);var K=rotated({p1:ae,p2:ad,alpha:0},q,Y);var h=E.x.props.labelsMarginRight?E.x.props.labelsMarginRight/2:0;if(E.x.props.labelsHideCovered&&H&&collide(K,H,h)){e.hide()}else{g=D(K);if(I.nx=="auto"&&(g.x<0||g.x+g.width>l.width)){e.hide()}else{H=K}}if(E.x.props.labelsRotate){if(Raphael.animation){e.transform(Raphael.format("r{0},{1},{2}",E.x.props.labelsRotate,X,V)).toBack()}else{e.rotate(E.x.props.labelsRotate,X,V).toBack()}}M.push({path:[["RELEMENT",e]],attr:false})}}}}ab.push({section:"Axis",serie:"x",subSection:"Label",paths:M});if(E.x&&E.x.props.title){R=C.margins[3]+Math.floor((l.width-C.margins[1]-C.margins[3])/2);Q=l.height-C.margins[2]+E.x.props.titleDistance*(Raphael.VML?E.x.props.titleDistanceIE:1);ab.push({section:"Axis",serie:"x",subSection:"Title",path:[["TEXT",E.x.props.title,R,Q]],attr:E.x.props.titleProps})}else{ab.push({section:"Axis",serie:"x",subSection:"Title",path:false,attr:false})}for(var z in ["l","r"]){Z=["l","r"][z];if(E[Z]&&E[Z].props.labels&&I.ny){M=[];for(aa=E[Z].props.labelsSkip?E[Z].props.labelsSkip:0;aa<=I.ny;aa++){var t=(l.height-C.margins[2]-C.margins[0])/I.ny;if(Z=="r"){X=l.width-C.margins[1]+E[Z].props.labelsDistance;if(!E[Z].props.labelsProps["text-anchor"]){E[Z].props.labelsProps["text-anchor"]="start"}}else{X=C.margins[3]-E[Z].props.labelsDistance;if(!E[Z].props.labelsProps["text-anchor"]){E[Z].props.labelsProps["text-anchor"]="end"}}if(E[Z].props.labelsAnchor&&E[Z].props.labelsAnchor!="auto"){E[Z].props.labelsProps["text-anchor"]=E[Z].props.labelsAnchor}J=(E[Z].min+(aa*((E[Z].max-E[Z].min)/I.ny)));if(E[Z].normalizationBase){J=Math.round(J/E[Z].normalizationBase)/(1/E[Z].normalizationBase)}if(E[Z].props.labelsFormatHandler){J=E[Z].props.labelsFormatHandler(J)}if(E[Z].props.labelsCompactUnits){J=a.compactUnits(J,E[Z].props.labelsCompactUnits)}o=(E[Z].props.prefix?E[Z].props.prefix:"")+J+(E[Z].props.suffix?E[Z].props.suffix:"");V=l.height-C.margins[2]-aa*t;M.push({path:[["TEXT",o,X,V+(E[Z].props.labelsMargin?E[Z].props.labelsMargin:0)]],attr:E[Z].props.labelsProps})}ab.push({section:"Axis",serie:Z,subSection:"Label",paths:M})}else{ab.push({section:"Axis",serie:Z,subSection:"Label",paths:[]})}if(E[Z]&&E[Z].props.title){if(Z=="r"){R=l.width-C.margins[1]+E[Z].props.titleDistance*(Raphael.VML?E[Z].props.titleDistanceIE:1)}else{R=C.margins[3]-E[Z].props.titleDistance*(Raphael.VML?E[Z].props.titleDistanceIE:1)}var B=a._clone(E[Z].props.titleProps);var L=Z=="l"?270:90;var Q=C.margins[0]+Math.floor((l.height-C.margins[0]-C.margins[2])/2);if(Raphael.animation){var e=c.text(R,Q,E[Z].props.title).attr(B).transform(Raphael.format("r{0}",L)).toBack();ab.push({section:"Axis",serie:Z,subSection:"Title",path:[["RELEMENT",e]],attr:false})}else{B.rotation=L;ab.push({section:"Axis",serie:Z,subSection:"Title",path:[["TEXT",E[Z].props.title,R,Q]],attr:B})}}else{ab.push({section:"Axis",serie:Z,subSection:"Title",path:false,attr:false})}}if(I.nx||I.ny){var S=[],A=[],n=[],U=I.nx=="auto"?(m?r.length:r.length-1):I.nx,T=I.ny,f=(l.height-C.margins[2]-C.margins[0])/(T?T:1),p=(l.width-C.margins[1]-C.margins[3])/(U?U:1),P=typeof I.forceBorder=="object"?I.forceBorder[3]:I.forceBorder,O=typeof I.forceBorder=="object"?I.forceBorder[1]:I.forceBorder,v=typeof I.forceBorder=="object"?I.forceBorder[0]:I.forceBorder,s=typeof I.forceBorder=="object"?I.forceBorder[2]:I.forceBorder,N=T>0?(typeof I.draw=="object"?I.draw[0]:I.draw):false,F=U>0?typeof I.draw=="object"?I.draw[1]:I.draw:false;if(T>0){for(aa=0;aa<T+1;aa++){if(v&&aa==0||s&&aa==T||N&&aa>0&&aa<T){S.push(["M",C.margins[3]-I.extra[3],C.margins[0]+Math.round(aa*f)]);S.push(["L",l.width-C.margins[1]+I.extra[1],C.margins[0]+Math.round(aa*f)])}if(aa<T){if(aa%2==0&&I.evenHProps||aa%2==1&&I.oddHProps){A.push({path:[["RECT",C.margins[3]-I.extra[3],C.margins[0]+Math.round(aa*f),l.width-C.margins[1]+I.extra[1],C.margins[0]+Math.round((aa+1)*f)]],attr:aa%2==0?I.evenHProps:I.oddHProps})}else{A.push({path:false,attr:false})}}}}for(aa=0;aa<U+1;aa++){if(P&&aa==0||O&&aa==U||F&&((I.nx!="auto"&&aa>0&&aa<U)||(I.nx=="auto"&&(typeof r[aa]!="boolean"||r[aa])))){S.push(["M",C.margins[3]+Math.round(aa*p),C.margins[0]-I.extra[0]]);S.push(["L",C.margins[3]+Math.round(aa*p),l.height-C.margins[2]+I.extra[2]])}if(aa<U){if(aa%2==0&&I.evenVProps||aa%2==1&&I.oddVProps){n.push({path:[["RECT",C.margins[3]+Math.round(aa*p),C.margins[0]-I.extra[0],C.margins[3]+Math.round((aa+1)*p),l.height-C.margins[2]+I.extra[2],]],attr:aa%2==0?I.evenVProps:I.oddVProps})}else{n.push({path:false,attr:false})}}}ab.push({section:"Grid",path:S.length?S:false,attr:S.length?I.props:false});ab.push({section:"GridBandH",paths:A});ab.push({section:"GridBandV",paths:n});var d=[];if(I.ticks.active&&(typeof I.ticks.active!="object"||I.ticks.active[0])){for(aa=0;aa<U+1;aa++){if(I.nx!="auto"||typeof r[aa]!="boolean"||r[aa]){d.push(["M",C.margins[3]+Math.round(aa*p),l.height-C.margins[2]-I.ticks.size[1]]);d.push(["L",C.margins[3]+Math.round(aa*p),l.height-C.margins[2]+I.ticks.size[0]])}}}if(I.ticks.active&&(typeof I.ticks.active!="object"||I.ticks.active[1])){for(aa=0;aa<T+1;aa++){d.push(["M",C.margins[3]-I.ticks.size[0],C.margins[0]+Math.round(aa*f)]);d.push(["L",C.margins[3]+I.ticks.size[1],C.margins[0]+Math.round(aa*f)])}}if(I.ticks.active&&(typeof I.ticks.active!="object"||I.ticks.active[2])){for(aa=0;aa<T+1;aa++){d.push(["M",l.width-C.margins[1]-I.ticks.size[1],C.margins[0]+Math.round(aa*f)]);d.push(["L",l.width-C.margins[1]+I.ticks.size[0],C.margins[0]+Math.round(aa*f)])}}ab.push({section:"Ticks",path:d.length?d:false,attr:d.length?I.ticks.props:false})}}}}})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.pie={init:function(c){},draw:function(E){var d=E.opt;var p=E.width-E.opt.margins[1]-E.opt.margins[3];var C=E.height-E.opt.margins[0]-E.opt.margins[2];var t=E.opt.r?E.opt.r:Math.floor((p<C?p:C)/2*(E.opt.rPerc?E.opt.rPerc/100:0.8));var f=(E.opt.cx?E.opt.cx:Math.floor(p/2))+E.opt.margins[3];var e=(E.opt.cy?E.opt.cy:Math.floor(C/2))+E.opt.margins[0];var A=0,B,s,v,z,g;for(v in d.values){z={visible:false,total:0,values:[]};E.plots[v]=z;var c=a.areaProps(E,"Series",v);a.colorize(E,c,[["plotProps","stroke"],["plotProps","fill"]],a.getItemColor(E,v));if(c.visible){z.visible=true;A++;z.values=d.values[v];for(B=0,s=z.values.length;B<s;B++){if(z.values[B]>0){g=a.areaProps(E,"Series",v,B);a.colorize(E,g,[["plotProps","stroke"],["plotProps","fill"]],a.getItemColor(E,v,B));if(typeof g.inside=="undefined"||g.inside<0){z.total+=z.values[B]}}}for(B=0;B<s;B++){if(z.values[B]<z.total*d.valueThresold){z.total=z.total-z.values[B];z.values[B]=0}}}}var u=t/A;var m=-u,j=0;var n=[];for(v in d.values){z=E.plots[v];var y=[];if(z.visible){m+=u;j+=u;var F=E.opt.startAngle,D=0,l=0;if(z.total==0){E.emptySeries=true;g=a.areaProps(E,"Series","empty");a.colorize(E,g,[["plotProps","stroke"],["plotProps","fill"]],a.getItemColor(E,v));y.push({path:[["CIRCLE",f,e,t]],attr:g.plotProps})}else{E.emptySeries=false;for(B=0,s=z.values.length;B<s;B++){var x=z.values[B];if(x>0){g=a.areaProps(E,"Series",v,B);a.colorize(E,g,[["plotProps","stroke"],["plotProps","fill"]],a.getItemColor(E,v,B));if(typeof g.inside=="undefined"||g.inside<0){F+=l;D=360*x/z.total;l=D}else{D=360*values[g.inside]/z.total*x/values[g.inside]}var o=m,q=j;if(g.r){if(g.r>0){if(g.r<=1){q=m+u*g.r}else{q=m+g.r}}else{if(g.r>=-1){o=m+u*(-g.r)}else{o=m-g.r}}}if(!E.opt.clockwise){y.push({path:[["SLICE",f,e,q,o,F,F+D]],attr:g.plotProps})}else{y.push({path:[["SLICE",f,e,q,o,-F-D,-F]],attr:g.plotProps})}}else{y.push({path:false,attr:false})}}}}else{if(d.values[v]&&d.values[v].length){for(B=0,s=d.values[v].length;B<s;B++){y.push({path:false,attr:false})}}}n.push({section:"Series",serie:v,subSection:"Plot",paths:y,mousearea:"paths"})}return n}}})(jQuery);
|
1 |
/*!*********************************************************************
|
2 |
+
* ELYCHARTS v2.1.6-SNAPSHOT $Id: elycharts.min.js 101 2014-02-19 10:52:26Z stefano.bagnara@gmail.com $
|
3 |
* A Javascript library to generate interactive charts with vectorial graphics.
|
4 |
*
|
5 |
* Copyright (c) 2010-2014 Void Labs s.n.c. (http://void.it)
|
6 |
* Licensed under the MIT (http://creativecommons.org/licenses/MIT/) license.
|
7 |
**********************************************************************/
|
8 |
+
(function(a){if(!a.elycharts){a.elycharts={}}a.elycharts.templates={common:{margins:[10,10,10,10],interactive:true,defaultSeries:{visible:true,tooltip:{active:true,width:100,height:50,roundedCorners:5,padding:[6,6],offset:[20,0],frameProps:{fill:"white","stroke-width":2},contentStyle:{"font-family":"Arial","font-size":"12px","line-height":"16px",color:"black"}},highlight:{scaleSpeed:100,scaleEasing:"",moveSpeed:100,moveEasing:"",restoreSpeed:0,restoreEasing:""},anchor:{},startAnimation:{type:"simple",speed:600,delay:0,propsFrom:{},propsTo:{},easing:""},label:{active:false,html:false,props:{fill:"black",stroke:"none","font-family":"Arial","font-size":"16px"},style:{cursor:"default"}}},series:{empty:{label:{active:false},tooltip:{active:false}}},features:{tooltip:{fadeDelay:100,moveDelay:300},mousearea:{type:"single",indexCenter:"auto",areaMoveDelay:500,syncTag:false,onMouseEnter:false,onMouseExit:false,onMouseChanged:false,onMouseOver:false,onMouseOut:false},highlight:{indexHighlightProps:{opacity:1}},animation:{startAnimation:{speed:600,delay:0,easing:""},stepAnimation:{speed:600,delay:0,easing:""}},frameAnimation:{active:false,cssFrom:{opacity:0},cssTo:{opacity:1},speed:"slow",easing:"linear"},pixelWorkAround:{active:Raphael.svg},label:{},shadows:{active:false,offset:[2,2],props:{"stroke-width":0,"stroke-opacity":0,fill:"black","fill-opacity":0.3}},balloons:{active:false,style:{},padding:[5,5],left:10,line:[[0,0],[0,0]],lineProps:{}},legend:{horizontal:false,x:"auto",y:10,width:"auto",height:20,itemWidth:"fixed",margins:[0,0,0,0],dotMargins:[10,5],borderProps:{fill:"white",stroke:"black","stroke-width":1},dotType:"rect",dotWidth:10,dotHeight:10,dotR:0,dotProps:{type:"rect",width:10,height:10},textProps:{font:"12px Arial",fill:"#000"}},debug:{active:false}},enableInternalCaching:true,nop:0},line:{template:"common",barMargins:0,barOverlapPerc:0,avgOverNulls:true,defaultAxis:{normalize:2,min:0,labels:false,labelsDistance:8,labelsRotate:0,labelsProps:{font:"10px Arial",fill:"#000"},titleDistance:25,titleDistanceIE:0.75,titleProps:{font:"12px Arial",fill:"#000","font-weight":"bold"}},axis:{x:{titleDistanceIE:1.2}},defaultSeries:{type:"line",axis:"l",cumulative:false,rounded:1,lineCenter:"auto",plotProps:{"stroke-width":1,"stroke-linejoin":"round"},barWidthPerc:100,fill:false,fillProps:{stroke:"none","stroke-width":0,"stroke-opacity":0,opacity:0.3},dot:false,dotProps:{size:4,stroke:"#000",zindex:5},dotShowOnNull:false,mouseareaShowOnNull:false,startAnimation:{plotPropsFrom:false,fillPropsFrom:false,dotPropsFrom:false,shadowPropsFrom:false}},features:{grid:{nx:"auto",ny:4,draw:false,forceBorder:false,props:{stroke:"#e0e0e0","stroke-width":1},extra:[0,0,0,0],labelsCenter:"auto",evenVProps:false,oddVProps:false,evenHProps:false,oddHProps:false,ticks:{active:[false,false,false],size:[10,10],props:{stroke:"#e0e0e0","stroke-width":1}}}},nop:0},pie:{template:"common",startAngle:0,clockwise:false,valueThresold:0.006,margins:[0,0,0,0],defaultSeries:{}},funnel:{template:"common",rh:0,method:"width",topSector:0,topSectorProps:{fill:"#d0d0d0"},bottomSector:0.1,bottomSectorProps:{fill:"#d0d0d0"},edgeProps:{fill:"#c0c0c0","stroke-width":1,opacity:1},nop:0},barline:{template:"common",direction:"ltr"}}})(jQuery);(function(c){if(!c.elycharts){c.elycharts={}}c.elycharts.lastId=0;c.fn.chart=function(j){if(!this.length){return this}var n=this.data("elycharts_env");if(typeof j=="string"){if(j.toLowerCase()=="config"){return n?n.opt:false}if(j.toLowerCase()=="clear"){if(n){if(c.elycharts.featuresmanager){c.elycharts.featuresmanager.clear(n)}n.paper.clear();n.cache=false;if(n.autoresize){c(window).unbind("resize",n.autoresize)}this.html("");this.data("elycharts_env",false)}}return this}if(!n){if(j){j=d(j)}if(!j||!j.type||!c.elycharts.templates[j.type]){alert("ElyCharts ERROR: chart type is not specified");return false}n=i(this,j);this.data("elycharts_env",n)}else{if(!j){j={}}j=b(j,n.opt);n.oldopt=f._clone(n.opt);n.opt=c.extend(true,n.opt,j);n.newopt=j;n.oldwidth=n.width;n.oldheight=n.height}n.cache=j.enableInternalCaching?{}:false;e(n,j);if(n.opt.autoresize){if(!n.autoresize){var m=this;n.autoresize=h(function(){m.chart()});c(window).bind("resize",n.autoresize)}}else{if(n.autoresize){c(window).unbind("resize",n.autoresize);n.autoresize=false}}var l=c.elycharts[n.opt.type].draw(n);if(n.pieces){l=g(n,n.pieces,l)}f._show(n,l);n.pieces=l;return this};function g(t,m,l,u,r,q){var o=[],s;var n=0;for(var p=0;p<m.length;p++){if(l&&(n>=l.length||!f.samePiecePath(m[p],l[n]))){if(!q){m[p].show=false;o.push(m[p])}else{s={path:false,attr:false};s.show=true;s.animation={element:m[p].element?m[p].element:false,speed:0,easing:"",delay:0};o.push(s)}}else{s=l?l[n]:{path:false,attr:false};s.show=true;if(typeof m[p].paths=="undefined"){s.animation={element:m[p].element?m[p].element:false,speed:0,easing:"",delay:0}}else{s.paths=g(t,m[p].paths,l[n].paths,m[p].section,m[p].serie,true)}o.push(s);n++}}if(l){for(;n<l.length;n++){o.push(l[n])}}return o}function h(n,j,l){var o;return function m(){var r=this,q=arguments;function p(){if(!l){n.apply(r,q)}o=null}if(o){clearTimeout(o)}else{if(l){n.apply(r,q)}}o=setTimeout(p,j||100)}}function i(m,j){var l={id:c.elycharts.lastId++,paper:f._RaphaelInstance(m.get()[0],0,0),container:m,plots:[],opt:j};l.paper.rect(0,0,1,1).attr({opacity:0});c.elycharts[j.type].init(l);return l}function e(l,j){if(j.style){l.container.css(j.style)}l.width=j.width?j.width:l.container.width();l.height=j.height?j.height:l.container.height();l.paper.setSize(l.width,l.height)}function d(j){var l;if(c.elysia_charts){if(c.elysia_charts.default_options){for(l in c.elysia_charts.default_options){c.elycharts.templates[l]=c.elysia_charts.default_options[l]}}if(c.elysia_charts.templates){for(l in c.elysia_charts.templates){c.elycharts.templates[l]=c.elysia_charts.templates[l]}}}while(j.template){var m=j.template;delete j.template;j=c.extend(true,{},c.elycharts.templates[m],j)}if(!j.template&&j.type){j.template=j.type;while(j.template){m=j.template;delete j.template;j=c.extend(true,{},c.elycharts.templates[m],j)}}return b(j,j)}function b(j,l){if(j.type=="pie"||j.type=="funnel"){if(j.values&&c.isArray(j.values)&&!c.isArray(j.values[0])){j.values={root:j.values}}if(j.tooltips&&c.isArray(j.tooltips)&&!c.isArray(j.tooltips[0])){j.tooltips={root:j.tooltips}}if(j.anchors&&c.isArray(j.anchors)&&!c.isArray(j.anchors[0])){j.anchors={root:j.anchors}}if(j.balloons&&c.isArray(j.balloons)&&!c.isArray(j.balloons[0])){j.balloons={root:j.balloons}}if(j.legend&&c.isArray(j.legend)&&!c.isArray(j.legend[0])){j.legend={root:j.legend}}}if(j.defaultSeries){var o=j.defaultSeries.type?j.defaultSeries.type:(l.defaultSeries.type?l.defaultSeries.type:l.type);a(j.defaultSeries,l.type,o,l)}if(j.series){for(var n in j.series){var p=j.series[n].type?j.series[n].type:(l.series[n].type?l.series[n].type:(o?o:l.type));a(j.series[n],l.type,p,l)}}if(j.type=="line"){if(!j.features){j.features={}}if(!j.features.grid){j.features.grid={}}if(typeof j.gridNX!="undefined"){j.features.grid.nx=j.gridNX;delete j.gridNX}if(typeof j.gridNY!="undefined"){j.features.grid.ny=j.gridNY;delete j.gridNY}if(typeof j.gridProps!="undefined"){j.features.grid.props=j.gridProps;delete j.gridProps}if(typeof j.gridExtra!="undefined"){j.features.grid.extra=j.gridExtra;delete j.gridExtra}if(typeof j.gridForceBorder!="undefined"){j.features.grid.forceBorder=j.gridForceBorder;delete j.gridForceBorder}if(j.defaultAxis&&j.defaultAxis.normalize&&(j.defaultAxis.normalize=="auto"||j.defaultAxis.normalize=="autony")){j.defaultAxis.normalize=2}if(j.axis){for(var m in j.axis){if(j.axis[m]&&j.axis[m].normalize&&(j.axis[m].normalize=="auto"||j.axis[m].normalize=="autony")){j.axis[m].normalize=2}}}}return j}function a(n,j,l,m){if(n.stackedWith){n.stacked=n.stackedWith;delete n.stackedWith}}c.elycharts.common={_RaphaelInstance:function(n,j,l){var m=Raphael(n,j,l);m.customAttributes.slice=function(o,v,s,q,u,t){a1=360-t;a2=360-u;var p=(a2-a1)>180;a1=(a1%360)*Math.PI/180;a2=(a2%360)*Math.PI/180;if(a1==a2&&u!=t){a2+=359.99*Math.PI/180}return{path:q?[["M",o+s*Math.cos(a1),v+s*Math.sin(a1)],["A",s,s,0,+p,1,o+s*Math.cos(a2),v+s*Math.sin(a2)],["L",o+q*Math.cos(a2),v+q*Math.sin(a2)],["A",q,q,0,+p,0,o+q*Math.cos(a1),v+q*Math.sin(a1)],["z"]]:[["M",o,v],["l",s*Math.cos(a1),s*Math.sin(a1)],["A",s,s,0,+p,1,o+s*Math.cos(a2),v+s*Math.sin(a2)],["z"]]}};return m},_clone:function(m){if(m==null||typeof(m)!="object"){return m}if(m.constructor==Array){return[].concat(m)}var j=new m.constructor();for(var l in m){j[l]=this._clone(m[l])}return j},compactUnits:function(n,l){for(var m=l.length-1;m>=0;m--){var j=n/Math.pow(1000,m+1);if(j>=1&&j*10%10==0){return j+l[m]}}return n},getElementOriginalAttrs:function(l){var j=c(l.node).data("original-attr");if(!j){j=l.attr();c(l.node).data("original-attr",j)}return j},findInPieces:function(n,p,m,j,o){for(var l=0;l<n.length;l++){if((typeof p==undefined||p==-1||p==false||n[l].section==p)&&(typeof m==undefined||m==-1||m==false||n[l].serie==m)&&(typeof j==undefined||j==-1||j==false||n[l].index==j)&&(typeof o==undefined||o==-1||o==false||n[l].subSection==o)){return n[l]}}return false},samePiecePath:function(l,j){return(((typeof l.section==undefined||l.section==-1||l.section==false)&&(typeof j.section==undefined||j.section==-1||j.section==false))||l.section==j.section)&&(((typeof l.serie==undefined||l.serie==-1||l.serie==false)&&(typeof j.serie==undefined||j.serie==-1||j.serie==false))||l.serie==j.serie)&&(((typeof l.index==undefined||l.index==-1||l.index==false)&&(typeof j.index==undefined||j.index==-1||j.index==false))||l.index==j.index)&&(((typeof l.subSection==undefined||l.subSection==-1||l.subSection==false)&&(typeof j.subSection==undefined||j.subSection==-1||j.subSection==false))||l.subSection==j.subSection)},executeIfChanged:function(o,n){if(!o.newopt){return true}for(var m=0;m<n.length;m++){if(n[m][n[m].length-1]=="*"){for(var l in o.newopt){if(l.substring(0,n[m].length-1)+"*"==n[m]){return true}}}else{if(n[m]=="series"&&(o.newopt.series||o.newopt.defaultSeries)){return true}else{if(n[m]=="axis"&&(o.newopt.axis||o.newopt.defaultAxis)){return true}else{if(n[m]=="width"&&(o.oldwidth!=o.width)){return true}else{if(n[m]=="height"&&(o.oldheight!=o.height)){return true}else{if(n[m].substring(0,9)=="features."){n[m]=n[m].substring(9);if(o.newopt.features&&o.newopt.features[n[m]]){return true}}else{if(typeof o.newopt[n[m]]!="undefined"){return true}}}}}}}}return false},getItemColor:function(n,o,l){var m=this.areaProps(n,"Series",o,l);if(m.color){return m.color}if(l!==false&&m.valuesPalette){return m.valuesPalette[l%m.valuesPalette.length]}if(n.opt.seriesPalette){var j=0;for(seriekey in n.opt.values){if(o==seriekey){return n.opt.seriesPalette[j%n.opt.seriesPalette.length]}else{j++}}}},colorize:function(o,n,l,j){if(j){for(k in l){var q=n;var m=0;for(m=0;m<l[k].length-1;m++){if(!q[l[k][m]]){q[l[k][m]]={}}q=q[l[k][m]]}if(!q[l[k][l[k].length-1]]){q[l[k][l[k].length-1]]=j}}}},areaProps:function(m,r,l,n,j){var q;var s=m.opt[r.toLowerCase()];if(!j){if(typeof l=="undefined"||!l){q=s}else{var o=r+"/"+l+"/"+n;if(m.cache&&m.cache.areaPropsCache&&m.cache.areaPropsCache[o]){q=m.cache.areaPropsCache[o]}else{q=this._clone(m.opt["default"+r]);if(s&&s[l]){q=c.extend(true,q,s[l])}if((typeof n!="undefined")&&n>=0&&q.values&&q.values[n]){q=c.extend(true,q,q.values[n])}if(m.cache){if(!m.cache.areaPropsCache){m.cache.areaPropsCache={}}m.cache.areaPropsCache[o]=q}}}}else{var p=j.toLowerCase();q=this._clone(m.opt[p]);if(typeof l=="undefined"||!l){if(s&&s[p]){q=c.extend(true,q,s[p])}}else{if(m.opt["default"+r]&&m.opt["default"+r][p]){q=c.extend(true,q,m.opt["default"+r][p])}if(s&&s[l]&&s[l][p]){q=c.extend(true,q,s[l][p])}if((typeof n!="undefined")&&n>0&&q.values&&q.values[n]){q=c.extend(true,q,q.values[n])}}}return q},_absrectpath:function(l,o,j,n,p){if(p){var m=[["M",l,o+p],["a",p,p,0,0,1,p,-p],["L",j-p,o],["a",p,p,0,0,1,p,p],["L",j,n-p],["a",p,p,0,0,1,-p,p],["L",l+p,n],["a",p,p,0,0,1,-p,-p],["z"]];return m}else{return[["M",l,o],["L",l,n],["L",j,n],["L",j,o],["z"]]}},_linepathAnchors:function(m,l,x,v,s,r,o){var j=1;if(o&&o.length){j=o[1];o=o[0]}if(!o){o=1}var p=(x-m)/2,n=(s-x)/2,y=Math.atan(Math.abs(x-m)/Math.abs(v-l)),w=Math.atan(Math.abs(s-x)/Math.abs(v-r));y=(l<v&&x>m)||(l>v&&x<m)?Math.PI-y:y;w=(r<v&&s>x)||(r>v&&s<x)?Math.PI-w:w;if(j==2){if((y-Math.PI/2)*(w-Math.PI/2)>0){y=0;w=0}else{if(Math.abs(y-Math.PI/2)<Math.abs(w-Math.PI/2)){w=Math.PI-y}else{y=Math.PI-w}}}var q=Math.PI/2-((y+w)%(Math.PI*2))/2,A=p*Math.sin(q+y)/2/o,u=p*Math.cos(q+y)/2/o,z=n*Math.sin(q+w)/2/o,t=n*Math.cos(q+w)/2/o;return{x1:x-A,y1:v+u,x2:x+z,y2:v+t}},_linepath:function(v,n){var w=[];if(n){var q=false;for(var o=0,r=v.length;o<r;o++){var u=v[o][0],s=v[o][1];if(u!=null&&s!=null){if(q){if(o+1!=r&&v[o+1][0]!=null&&v[o+1][1]!=null){var t=this._linepathAnchors(v[o-1][0],v[o-1][1],v[o][0],v[o][1],v[o+1][0],v[o+1][1],n);w.push(["C",q[0],q[1],t.x1,t.y1,v[o][0],v[o][1]]);q=[t.x2,t.y2]}else{w.push(["C",q[0],q[1],v[o][0],v[o][1],v[o][0],v[o][1]]);q=[v[o][0],v[o][1]]}}else{w.push(["M",v[o][0],v[o][1]]);q=[v[o][0],v[o][1]]}}else{q=false}}}else{var m=null;var l=null;for(var p=0;p<v.length;p++){var u=v[p][0],s=v[p][1];if(u!=null&&s!=null){w.push([m==null||l==null?"M":"L",u,s])}m=u;l=s}}return w},_lineareapath:function(t,r,l){var s=this._linepath(t,l);var q=this._linepath(r.reverse(),l);var p=[];var o=null;for(var n=0;n<=s.length;n++){if(n==s.length||s[n][0]=="M"){if(o!=null){for(var m=s.length-n;m<=s.length-o;m++){if(q[m][0]=="M"){p.push(["L",q[m][1],q[m][2]])}else{p.push(q[m])}}p.push(["z"]);o=null}if(n!=s.length){p.push(s[n])}}else{p.push(s[n]);if(o==null){o=n}}}return p},getX:function(j,l){switch(j[0]){case"CIRCLE":return j[1];case"RECT":return j[!l?1:3];case"SLICE":return j[1];default:return j[j.length-2]}},getY:function(j,l){switch(j[0]){case"CIRCLE":return j[2];case"RECT":return j[!l?2:4];case"SLICE":return j[2];default:return j[j.length-1]}},getCenter:function(n,o){if(!n.path){return false}if(n.path.length==0){return false}if(!o){o=[0,0]}if(n.center){return[n.center[0]+o[0],n.center[1]+o[1]]}var m=n.path[0];switch(m[0]){case"CIRCLE":return[m[1]+o[0],m[2]+o[1]];case"RECT":return[(m[1]+m[2])/2+o[0],(m[3]+m[4])/2+o[1]];case"SLICE":var l=m[5]+(m[6]-m[5])/2;var j=Math.PI/180;return[m[1]+(m[4]+((m[3]-m[4])/2)+o[0])*Math.cos(-l*j)+o[1]*Math.cos((-l-90)*j),m[2]+(m[4]+((m[3]-m[4])/2)+o[0])*Math.sin(-l*j)+o[1]*Math.sin((-l-90)*j)]}alert("ElyCharts: getCenter with complex path not supported");return false},movePath:function(w,D,u,s,l){var m=[],v;if(D.length==1&&D[0][0]=="RECT"){return[[D[0][0],this._movePathX(w,D[0][1],u[0],s),this._movePathY(w,D[0][2],u[1],s),this._movePathX(w,D[0][3],u[0],s),this._movePathY(w,D[0][4],u[1],s),D[0][5]]]}if(D.length==1&&D[0][0]=="SLICE"){if(!l){var C=D[0][5]+(D[0][6]-D[0][5])/2;var z=Math.PI/180;var B=D[0][1]+u[0]*Math.cos(-C*z)+u[1]*Math.cos((-C-90)*z);var A=D[0][2]+u[0]*Math.sin(-C*z)+u[1]*Math.cos((-C-90)*z);return[[D[0][0],B,A,D[0][3],D[0][4],D[0][5],D[0][6]]]}else{return[[D[0][0],D[0][1]+u[0],D[0][2]+u[1],D[0][3],D[0][4],D[0][5],D[0][6]]]}}if(D.length==1&&D[0][0]=="CIRCLE"){return[[D[0][0],D[0][1]+u[0],D[0][2]+u[1],D[0][3]]]}if(D.length==1&&D[0][0]=="TEXT"){return[[D[0][0],D[0][1],D[0][2]+u[0],D[0][3]+u[1]]]}if(D.length==1&&D[0][0]=="LINE"){for(v=0;v<D[0][1].length;v++){m.push([this._movePathX(w,D[0][1][v][0],u[0],s),this._movePathY(w,D[0][1][v][1],u[1],s)])}return[[D[0][0],m,D[0][2]]]}if(D.length==1&&D[0][0]=="LINEAREA"){for(v=0;v<D[0][1].length;v++){m.push([this._movePathX(w,D[0][1][v][0],u[0],s),this._movePathY(w,D[0][1][v][1],u[1],s)])}var q=[];for(v=0;v<D[0][2].length;v++){q.push([this._movePathX(w,D[0][2][v][0],u[0],s),this._movePathY(w,D[0][2][v][1],u[1],s)])}return[[D[0][0],m,q,D[0][3]]]}var r=[];for(var t=0;t<D.length;t++){var n=D[t];switch(n[0]){case"M":case"m":case"L":case"l":case"T":case"t":r.push([n[0],this._movePathX(w,n[1],u[0],s),this._movePathY(w,n[2],u[1],s)]);break;case"A":case"a":r.push([n[0],n[1],n[2],n[3],n[4],n[5],this._movePathX(w,n[6],u[0],s),this._movePathY(w,n[7],u[1],s)]);break;case"C":case"c":r.push([n[0],this._movePathX(w,n[1],u[0],s),this._movePathY(w,n[2],u[1],s),this._movePathX(w,n[3],u[0],s),this._movePathY(w,n[4],u[1],s),this._movePathX(w,n[5],u[0],s),this._movePathY(w,n[6],u[1],s)]);break;case"S":case"s":case"Q":case"q":r.push([n[0],this._movePathX(w,n[1],u[0],s),this._movePathY(w,n[2],u[1],s),this._movePathX(w,n[3],u[0],s),this._movePathY(w,n[4],u[1],s)]);break;case"z":case"Z":r.push([n[0]]);break}}return r},_movePathX:function(m,j,l,n){if(j==null){return null}if(!n){return j+l}j=j+l;return l>0&&j>m.width-m.opt.margins[1]?m.width-m.opt.margins[1]:(l<0&&j<m.opt.margins[3]?m.opt.margins[3]:j)},_movePathY:function(l,n,j,m){if(n==null){return null}if(!m){return n+j}n=n+j;return j>0&&n>l.height-l.opt.margins[2]?l.height-l.opt.margins[2]:(j<0&&n<l.opt.margins[0]?l.opt.margins[0]:n)},getSVGProps:function(n,q,j){var p=this._preparePathShow(n,q);var m=j?j:{};var l="path",o;if(p.length==1&&p[0][0]=="RECT"){o=f._absrectpath(p[0][1],p[0][2],p[0][3],p[0][4],p[0][5])}else{if(p.length==1&&p[0][0]=="SLICE"){l="slice";o=[p[0][1],p[0][2],p[0][3],p[0][4],p[0][5],p[0][6]]}else{if(p.length==1&&p[0][0]=="LINE"){o=f._linepath(p[0][1],p[0][2])}else{if(p.length==1&&p[0][0]=="LINEAREA"){o=f._lineareapath(p[0][1],p[0][2],p[0][3])}else{if(p.length==1&&(p[0][0]=="CIRCLE"||p[0][0]=="TEXT"||p[0][0]=="DOMELEMENT"||p[0][0]=="RELEMENT")){return j?j:false}else{o=p}}}}}if(l!="path"||(o&&o.length>0)){m[l]=o}else{if(!j){return false}}return m},showPath:function(n,o,p){if(!p){p=n.paper}if(o.length==1&&o[0][0]=="CIRCLE"){o=this._preparePathShow(n,o);return p.circle(o[0][1],o[0][2],o[0][3])}if(o.length==1&&o[0][0]=="TEXT"){o=this._preparePathShow(n,o);return p.text(o[0][2],o[0][3],o[0][1])}var m=this.getSVGProps(n,o);var l=false;for(var j in m){l=true;break}return m&&l?p.path().attr(m):false},_preparePathShow:function(j,l){return j.opt.features.pixelWorkAround.active?this.movePath(j,this._clone(l),[0.5,0.5],false,true):l},getPieceFullAttr:function(l,j){if(!j.fullattr){j.fullattr=this._clone(j.attr);if(j.path){switch(j.path[0][0]){case"CIRCLE":var m=this._preparePathShow(l,j.path);j.fullattr.cx=m[0][1];j.fullattr.cy=m[0][2];j.fullattr.r=m[0][3];break;case"TEXT":case"DOMELEMENT":case"RELEMENT":break;default:j.fullattr=this.getSVGProps(l,j.path,j.fullattr)}}if(typeof j.fullattr.opacity=="undefined"){j.fullattr.opacity=1}}return j.fullattr},_show:function(o,m){if(c.elycharts.featuresmanager){c.elycharts.featuresmanager.beforeShow(o,m)}pieces=this._getSortedPathData(m);this._animationStackStart(o);var j=false;for(var l=0;l<pieces.length;l++){var n=pieces[l];if((typeof n.show=="undefined"||n.show)&&(typeof n.parent=="undefined"||typeof n.parent.show=="undefined"||n.parent.show)){n.element=n.animation&&n.animation.element?n.animation.element:false;n.hide=false;if(!n.path){n.hide=true}else{if(n.path.length==1&&n.path[0][0]=="TEXT"){if(n.element){f.animationStackPush(o,n,n.element,false,n.animation.speed,n.animation.easing,n.animation.delay,true);n.animation.element=false}n.element=this.showPath(o,n.path);if(n.element&&o.newopt&&j){n.element.insertAfter(j)}}else{if(n.path.length==1&&n.path[0][0]=="DOMELEMENT"){}else{if(n.path.length==1&&n.path[0][0]=="RELEMENT"){if(n.element){f.animationStackPush(o,n,n.element,false,n.animation.speed,n.animation.easing,n.animation.delay,true);n.animation.element=false}n.element=n.path[0][1];if(n.element&&j){n.element.insertAfter(j)}n.attr=false}else{if(!n.element){if(n.animation&&n.animation.startPath&&n.animation.startPath.length){n.element=this.showPath(o,n.animation.startPath)}else{n.element=this.showPath(o,n.path)}if(n.element&&o.newopt&&j){n.element.insertAfter(j)}}}}}}if(n.element){if(n.attr){if(!n.animation){if(typeof n.attr.opacity=="undefined"){n.attr.opacity=1}n.element.attr(n.attr)}else{if(!n.animation.element){n.element.attr(n.animation.startAttr?n.animation.startAttr:n.attr)}f.animationStackPush(o,n,n.element,this.getPieceFullAttr(o,n),n.animation.speed,n.animation.easing,n.animation.delay)}}else{if(n.hide){f.animationStackPush(o,n,n.element,false,n.animation.speed,n.animation.easing,n.animation.delay)}}j=n.element}}}this._animationStackEnd(o);if(c.elycharts.featuresmanager){c.elycharts.featuresmanager.afterShow(o,m)}},_getSortedPathData:function(o){res=[];for(var m=0;m<o.length;m++){var n=o[m];if(n.paths){for(var l=0;l<n.paths.length;l++){n.paths[l].pos=res.length;n.paths[l].parent=n;res.push(n.paths[l])}}else{n.pos=res.length;n.parent=false;res.push(n)}}return res.sort(function(p,j){var r=typeof p.attr=="undefined"||typeof p.attr.zindex=="undefined"?(!p.parent||typeof p.parent.attr=="undefined"||typeof p.parent.attr.zindex=="undefined"?0:p.parent.attr.zindex):p.attr.zindex;var q=typeof j.attr=="undefined"||typeof j.attr.zindex=="undefined"?(!j.parent||typeof j.parent.attr=="undefined"||typeof j.parent.attr.zindex=="undefined"?0:j.parent.attr.zindex):j.attr.zindex;return r<q?-1:(r>q?1:(p.pos<j.pos?-1:(p.pos>j.pos?1:0)))})},_animationStackStart:function(j){if(!j.animationStackDepth||j.animationStackDepth==0){j.animationStackDepth=0;j.animationStack={}}j.animationStackDepth++},_animationStackEnd:function(l){l.animationStackDepth--;if(l.animationStackDepth==0){for(var j in l.animationStack){this._animationStackAnimate(l.animationStack[j],j);delete l.animationStack[j]}l.animationStack={}}},animationStackPush:function(o,n,m,j,q,r,l,p){if(typeof l=="undefined"){l=0}if(!o.animationStackDepth||o.animationStackDepth==0){this._animationStackAnimate([{piece:n,object:m,props:j,speed:q,easing:r,force:p}],l)}else{if(!o.animationStack[l]){o.animationStack[l]=[]}o.animationStack[l].push({piece:n,object:m,props:j,speed:q,easing:r,force:p})}},_animationStackAnimate:function(j,m){var l=this;var n=function(){var p=j.pop();var q=l._animationStackAnimateElement(p);while(j.length>0){var o=j.pop();l._animationStackAnimateElement(o,p,q)}};if(m>0){setTimeout(n,m)}else{n()}},_animationStackAnimateElement:function(j,o,n){if(j.force||!j.piece.animationInProgress){j.object.stop();if(!j.props){j.props={opacity:0}}if(!j.speed||j.speed<=0){j.object.attr(j.props);j.piece.animationInProgress=false;return}j.piece.animationInProgress=true;var l=function(){j.piece.animationInProgress=false};if(Raphael.animation){var m=Raphael.animation(j.props,j.speed,j.easing?j.easing:"linear",l);if(o){j.object.animateWith(o,n,m)}else{j.object.animate(m)}return m}else{if(o){j.object.animateWith(o,j.props,j.speed,j.easing?j.easing:"linear",l)}else{j.object.animate(j.props,j.speed,j.easing?j.easing:"linear",l)}return null}}return null}};var f=c.elycharts.common;c.elycharts.featuresmanager={managers:[],initialized:false,register:function(l,j){c.elycharts.featuresmanager.managers.push([j,l]);c.elycharts.featuresmanager.initialized=false},init:function(){c.elycharts.featuresmanager.managers.sort(function(l,j){return l[0]<j[0]?-1:(l[0]==j[0]?0:1)});c.elycharts.featuresmanager.initialized=true},clear:function(l){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var j=c.elycharts.featuresmanager.managers.length-1;j>=0;j--){if(c.elycharts.featuresmanager.managers[j][1].clear){c.elycharts.featuresmanager.managers[j][1].clear(l)}}},beforeShow:function(l,m){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var j=0;j<c.elycharts.featuresmanager.managers.length;j++){if(c.elycharts.featuresmanager.managers[j][1].beforeShow){c.elycharts.featuresmanager.managers[j][1].beforeShow(l,m)}}},afterShow:function(l,m){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var j=0;j<c.elycharts.featuresmanager.managers.length;j++){if(c.elycharts.featuresmanager.managers[j][1].afterShow){c.elycharts.featuresmanager.managers[j][1].afterShow(l,m)}}},onMouseOver:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseOver){c.elycharts.featuresmanager.managers[m][1].onMouseOver(n,o,l,j)}}},onMouseOut:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseOut){c.elycharts.featuresmanager.managers[m][1].onMouseOut(n,o,l,j)}}},onMouseEnter:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseEnter){c.elycharts.featuresmanager.managers[m][1].onMouseEnter(n,o,l,j)}}},onMouseChanged:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseChanged){c.elycharts.featuresmanager.managers[m][1].onMouseChanged(n,o,l,j)}}},onMouseExit:function(n,o,l,j){if(!c.elycharts.featuresmanager.initialized){this.init()}for(var m=0;m<c.elycharts.featuresmanager.managers.length;m++){if(c.elycharts.featuresmanager.managers[m][1].onMouseExit){c.elycharts.featuresmanager.managers[m][1].onMouseExit(n,o,l,j)}}}}})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.anchormanager={afterShow:function(e,g){if(!e.opt.anchors){return}if(!e.anchorBinds){e.anchorBinds=[]}while(e.anchorBinds.length){var c=e.anchorBinds.pop();b(c[0]).unbind(c[1],c[2])}for(var d=0;d<e.mouseAreas.length;d++){var f=e.mouseAreas[d].piece?e.mouseAreas[d].piece.serie:false;var h;if(f){h=e.opt.anchors[f][e.mouseAreas[d].index]}else{h=e.opt.anchors[e.mouseAreas[d].index]}if(h&&e.mouseAreas[d].props.anchor&&e.mouseAreas[d].props.anchor.highlight){(function(m,j,n,l){var i=function(){l.anchorMouseOver(m,j)};var o=function(){l.anchorMouseOut(m,j)};if(!m.mouseAreas[d].props.anchor.useMouseEnter){m.anchorBinds.push([n,"mouseover",i]);m.anchorBinds.push([n,"mouseout",o]);b(n).mouseover(i);b(n).mouseout(o)}else{m.anchorBinds.push([n,"mouseenter",i]);m.anchorBinds.push([n,"mouseleave",o]);b(n).mouseenter(i);b(n).mouseleave(o)}})(e,e.mouseAreas[d],h,this)}}e.onAnchors=[]},anchorMouseOver:function(d,c){b.elycharts.highlightmanager.onMouseOver(d,c.piece?c.piece.serie:false,c.index,c)},anchorMouseOut:function(d,c){b.elycharts.highlightmanager.onMouseOut(d,c.piece?c.piece.serie:false,c.index,c)},onMouseOver:function(e,f,d,c){if(!e.opt.anchors){return}if(c.props.anchor&&c.props.anchor.addClass){var g;if(f){g=e.opt.anchors[f][c.index]}else{g=e.opt.anchors[c.index]}if(g){b(g).addClass(c.props.anchor.addClass);e.onAnchors.push([g,c.props.anchor.addClass])}}},onMouseOut:function(e,f,d,c){if(!e.opt.anchors){return}while(e.onAnchors.length>0){var g=e.onAnchors.pop();b(g[0]).removeClass(g[1])}}};b.elycharts.featuresmanager.register(b.elycharts.anchormanager,30)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.animationmanager={beforeShow:function(c,d){if(!c.newopt){this.startAnimation(c,d)}else{this.stepAnimation(c,d)}},stepAnimation:function(c,d){d=this._stepAnimationInt(c,d)},_stepAnimationInt:function(e,h,j,g,c){for(var d=0;d<h.length;d++){var f=a.areaProps(e,j?j:h[d].section,g?g:h[d].serie);if(f&&f.stepAnimation){f=f.stepAnimation}else{f=e.opt.features.animation.stepAnimation}if(typeof h[d].paths=="undefined"){if(f&&f.active&&h[d].animation){h[d].animation.speed=f&&f.speed?f.speed:300;h[d].animation.easing=f&&f.easing?f.easing:"";h[d].animation.delay=f&&f.delay?f.delay:0;if(!h[d].animation.element){h[d].animation.startAttr={opacity:0}}}}else{this._stepAnimationInt(e,h[d].paths,h[d].section,h[d].serie,true)}}},startAnimation:function(e,f){for(var c=0;c<f.length;c++){if(f[c].paths||f[c].path){var d=a.areaProps(e,f[c].section,f[c].serie);if(d&&d.startAnimation){d=d.startAnimation}else{d=e.opt.features.animation.startAnimation}if(d&&d.active){if(d.type=="simple"||f[c].section!="Series"){this.animationSimple(e,d,f[c])}if(d.type=="grow"){this.animationGrow(e,d,f[c])}if(d.type=="avg"){this.animationAvg(e,d,f[c])}if(d.type=="reg"){this.animationReg(e,d,f[c])}}}}},_animationPiece:function(d,f,e){if(d.paths){for(var c=0;c<d.paths.length;c++){this._animationPiece(d.paths[c],f,e)}}else{if(d.path){d.animation={speed:f.speed,easing:f.easing,delay:f.delay,startPath:[],startAttr:a._clone(d.attr)};if(f.propsTo){d.attr=b.extend(true,d.attr,f.propsTo)}if(f.propsFrom){d.animation.startAttr=b.extend(true,d.animation.startAttr,f.propsFrom)}if(e&&f[e.toLowerCase()+"PropsFrom"]){d.animation.startAttr=b.extend(true,d.animation.startAttr,f[e.toLowerCase()+"PropsFrom"])}if(typeof d.animation.startAttr.opacity!="undefined"&&typeof d.attr.opacity=="undefined"){d.attr.opacity=1}}}},animationSimple:function(e,d,c){this._animationPiece(c,d,c.subSection)},animationGrow:function(g,f,e){this._animationPiece(e,f,e.subSection);var d,h,j;switch(g.opt.type){case"line":j=g.height-g.opt.margins[2];switch(e.subSection){case"Plot":if(!e.paths){h=["LINE",[],e.path[0][2]];for(d=0;d<e.path[0][1].length;d++){h[1].push([e.path[0][1][d][0],e.path[0][1][d][1]==null?null:j])}e.animation.startPath.push(h)}else{for(d=0;d<e.paths.length;d++){if(e.paths[d].path){e.paths[d].animation.startPath.push(["RECT",e.paths[d].path[0][1],j,e.paths[d].path[0][3],j])}}}break;case"Fill":h=["LINEAREA",[],[],e.path[0][3]];for(d=0;d<e.path[0][1].length;d++){h[1].push([e.path[0][1][d][0],e.path[0][1][d][1]==null?null:j]);h[2].push([e.path[0][2][d][0],e.path[0][2][d][1]==null?null:j])}e.animation.startPath.push(h);break;case"Dot":for(d=0;d<e.paths.length;d++){if(e.paths[d].path){e.paths[d].animation.startPath.push(["CIRCLE",e.paths[d].path[0][1],j,e.paths[d].path[0][3]])}}break}break;case"pie":if(e.subSection=="Plot"){for(d=0;d<e.paths.length;d++){if(e.paths[d].path&&e.paths[d].path[0][0]=="SLICE"){e.paths[d].animation.startPath.push(["SLICE",e.paths[d].path[0][1],e.paths[d].path[0][2],e.paths[d].path[0][4]+e.paths[d].path[0][3]*0.1,e.paths[d].path[0][4],e.paths[d].path[0][5],e.paths[d].path[0][6]])}}}break;case"funnel":alert("Unsupported animation GROW for funnel");break;case"barline":var c;if(e.section=="Series"&&e.subSection=="Plot"){if(!f.subType){c=g.opt.direction!="rtl"?g.opt.margins[3]:g.width-g.opt.margins[1]}else{if(f.subType==1){c=g.opt.direction!="rtl"?g.width-g.opt.margins[1]:g.opt.margins[3]}}for(d=0;d<e.paths.length;d++){if(e.paths[d].path){if(!f.subType||f.subType==1){e.paths[d].animation.startPath.push(["RECT",c,e.paths[d].path[0][2],c,e.paths[d].path[0][4],e.paths[d].path[0][5]])}else{j=(e.paths[d].path[0][2]+e.paths[d].path[0][4])/2;e.paths[d].animation.startPath.push(["RECT",e.paths[d].path[0][1],j,e.paths[d].path[0][3],j,e.paths[d].path[0][5]])}}}}break}},_animationAvgXYArray:function(c){var e=[],g=0,d;var f=0;for(d=0;d<c.length;d++){if(c[d][1]!=null){g+=c[d][1];f++}}g=g/f;for(d=0;d<c.length;d++){e.push([c[d][0],c[d][1]==null?null:g])}return e},animationAvg:function(g,f,e){this._animationPiece(e,f,e.subSection);var h=0,d,c;switch(g.opt.type){case"line":switch(e.subSection){case"Plot":if(!e.paths){e.animation.startPath.push(["LINE",this._animationAvgXYArray(e.path[0][1]),e.path[0][2]])}else{c=0;for(d=0;d<e.paths.length;d++){if(e.paths[d].path){c++;h+=e.paths[d].path[0][2]}}h=h/c;for(d=0;d<e.paths.length;d++){if(e.paths[d].path){e.paths[d].animation.startPath.push(["RECT",e.paths[d].path[0][1],h,e.paths[d].path[0][3],e.paths[d].path[0][4]])}}}break;case"Fill":e.animation.startPath.push(["LINEAREA",this._animationAvgXYArray(e.path[0][1]),this._animationAvgXYArray(e.path[0][2]),e.path[0][3]]);break;case"Dot":c=0;for(d=0;d<e.paths.length;d++){if(e.paths[d].path){c++;h+=e.paths[d].path[0][2]}}h=h/c;for(d=0;d<e.paths.length;d++){if(e.paths[d].path){e.paths[d].animation.startPath.push(["CIRCLE",e.paths[d].path[0][1],h,e.paths[d].path[0][3]])}}break}break;case"pie":var j=360/e.paths.length;if(e.subSection=="Plot"){for(d=0;d<e.paths.length;d++){if(e.paths[d].path&&e.paths[d].path[0][0]=="SLICE"){e.paths[d].animation.startPath.push(["SLICE",e.paths[d].path[0][1],e.paths[d].path[0][2],e.paths[d].path[0][3],e.paths[d].path[0][4],d*j,(d+1)*j])}}}break;case"funnel":alert("Unsupported animation AVG for funnel");break;case"barline":alert("Unsupported animation AVG for barline");break}},_animationRegXYArray:function(d){var h=[];var m=d.length;var l=0;var e=m-1;while(d[l][1]==null){l++}while(d[e][1]==null){e--}var j=d[0][1];var g=d[m-1][1];for(var f=0;f<d.length;f++){if(d[f][1]==null){h.push([d[f][0],null])}else{h.push([d[f][0],d[l][1]+(d[e][1]-d[l][1])/(e-l)*(f-l)])}}return h},animationReg:function(j,h,g){this._animationPiece(g,h,g.subSection);var e,l,f,d;switch(j.opt.type){case"line":switch(g.subSection){case"Plot":if(!g.paths){g.animation.startPath.push(["LINE",this._animationRegXYArray(g.path[0][1]),g.path[0][2]])}else{l=g.paths.length;if(l>1){for(e=0;!g.paths[e].path&&e<g.paths.length;e++){}f=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=g.paths.length-1;!g.paths[e].path&&e>=0;e--){}d=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=0;e<g.paths.length;e++){if(g.paths[e].path){g.paths[e].animation.startPath.push(["RECT",g.paths[e].path[0][1],f+(d-f)/(l-1)*e,g.paths[e].path[0][3],g.paths[e].path[0][4]])}}}}break;case"Fill":g.animation.startPath.push(["LINEAREA",this._animationRegXYArray(g.path[0][1]),this._animationRegXYArray(g.path[0][2]),g.path[0][3]]);break;case"Dot":l=g.paths.length;if(l>1){for(e=0;!g.paths[e].path&&e<g.paths.length;e++){}f=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=g.paths.length-1;!g.paths[e].path&&e>=0;e--){}d=g.paths[e].path?a.getY(g.paths[e].path[0]):0;for(e=0;e<g.paths.length;e++){if(g.paths[e].path){g.paths[e].animation.startPath.push(["CIRCLE",g.paths[e].path[0][1],f+(d-f)/(l-1)*e,g.paths[e].path[0][3]])}}}break}break;case"pie":alert("Unsupported animation REG for pie");break;case"funnel":alert("Unsupported animation REG for funnel");break;case"barline":alert("Unsupported animation REG for barline");break}}};b.elycharts.featuresmanager.register(b.elycharts.animationmanager,10);b.elycharts.frameanimationmanager={beforeShow:function(c,d){if(c.opt.features.frameAnimation.active){b(c.container.get(0)).css(c.opt.features.frameAnimation.cssFrom)}},afterShow:function(c,d){if(c.opt.features.frameAnimation.active){c.container.animate(c.opt.features.frameAnimation.cssTo,c.opt.features.frameAnimation.speed,c.opt.features.frameAnimation.easing)}}};b.elycharts.featuresmanager.register(b.elycharts.frameanimationmanager,90)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.highlightmanager={removeHighlighted:function(d,c){if(d.highlighted){while(d.highlighted.length>0){var e=d.highlighted.pop();if(e.piece){if(c){a.animationStackPush(d,e.piece,e.piece.element,a.getPieceFullAttr(d,e.piece),e.cfg.restoreSpeed,e.cfg.restoreEasing,0,true)}}else{e.element.remove()}}}},afterShow:function(c,d){if(c.highlighted&&c.highlighted.length>0){this.removeHighlighted(c,false)}c.highlighted=[]},onMouseOver:function(D,u,j,H){var s,c;for(var B=0;B<H.pieces.length;B++){if(H.pieces[B].section=="Series"&&H.pieces[B].paths&&(!u||H.pieces[B].serie==u)&&H.pieces[B].paths[j]&&H.pieces[B].paths[j].element){var e=H.pieces[B].paths[j];c=e.element;s=e.path;var v=a.getElementOriginalAttrs(c);var F=false;var f=u?H.props:a.areaProps(D,H.pieces[B].section,H.pieces[B].serie);var r,G,y;if(s&&f.highlight){if(f.highlight.scale){var J=f.highlight.scale;if(typeof J=="number"){J=[J,J]}if(s[0][0]=="RECT"){var o=s[0][3]-s[0][1];var C=s[0][4]-s[0][2];s=[["RECT",s[0][1],s[0][2]-C*(J[1]-1),s[0][3]+o*(J[0]-1),s[0][4]]];a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.scaleSpeed,f.highlight.scaleEasing)}else{if(s[0][0]=="CIRCLE"){F={r:s[0][3]*J[0]};a.animationStackPush(D,e,c,F,f.highlight.scaleSpeed,f.highlight.scaleEasing)}else{if(s[0][0]=="SLICE"){var E=(s[0][6]-s[0][5])*(J[1]-1)/2;if(E>90){E=90}s=[["SLICE",s[0][1],s[0][2],s[0][3]*J[0],s[0][4],s[0][5]-E,s[0][6]+E]];a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.scaleSpeed,f.highlight.scaleEasing)}else{if(D.opt.type=="funnel"){var p=(e.rect[2]-e.rect[0])*(J[0]-1)/2;var n=(e.rect[3]-e.rect[1])*(J[1]-1)/2;s=[a.movePath(D,[s[0]],[-p,-n])[0],a.movePath(D,[s[1]],[+p,-n])[0],a.movePath(D,[s[2]],[+p,+n])[0],a.movePath(D,[s[3]],[-p,+n])[0],s[4]];a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.scaleSpeed,f.highlight.scaleEasing,0,true);r=false;if(j>0){G=H.pieces[B].paths[j-1];r=G.element;y=G.path}else{G=a.findInPieces(H.pieces,"Sector","top");if(G){r=G.element;y=G.path}}if(r){y=[y[0],y[1],a.movePath(D,[y[2]],[+p,-n])[0],a.movePath(D,[y[3]],[-p,-n])[0],y[4]];a.animationStackPush(D,G,r,a.getSVGProps(D,y),f.highlight.scaleSpeed,f.highlight.scaleEasing,0,true);D.highlighted.push({piece:G,cfg:f.highlight})}r=false;if(j<H.pieces[B].paths.length-1){G=H.pieces[B].paths[j+1];r=G.element;y=G.path}else{G=a.findInPieces(H.pieces,"Sector","bottom");if(G){r=G.element;y=G.path}}if(r){y=[a.movePath(D,[y[0]],[-p,+n])[0],a.movePath(D,[y[1]],[+p,+n])[0],y[2],y[3],y[4]];a.animationStackPush(D,G,r,a.getSVGProps(D,y),f.highlight.scaleSpeed,f.highlight.scaleEasing,0,true);D.highlighted.push({piece:G,cfg:f.highlight})}}}}}}if(f.highlight.newProps){for(var I in f.highlight.newProps){if(typeof v[I]=="undefined"){v[I]=false}}a.animationStackPush(D,e,c,f.highlight.newProps)}if(f.highlight.move){var g=b.isArray(f.highlight.move)?f.highlight.move:[f.highlight.move,0];s=a.movePath(D,s,g);a.animationStackPush(D,e,c,a.getSVGProps(D,s),f.highlight.moveSpeed,f.highlight.moveEasing)}D.highlighted.push({piece:e,cfg:f.highlight});if(f.highlight.overlayProps){c=a.showPath(D,s);if(F){c.attr(F)}c.attr(f.highlight.overlayProps);v=false;D.highlighted.push({element:c,attr:v,cfg:f.highlight})}}}}if(D.opt.features.highlight.indexHighlight&&D.opt.type=="line"){var q=D.opt.features.highlight.indexHighlight;if(q=="auto"){q=(D.indexCenter=="bar"?"bar":"line")}var A=(D.width-D.opt.margins[3]-D.opt.margins[1])/(D.opt.labels.length>0?D.opt.labels.length:1);var z=(D.width-D.opt.margins[3]-D.opt.margins[1])/(D.opt.labels.length>1?D.opt.labels.length-1:1);var m=true;switch(q){case"bar":s=[["RECT",D.opt.margins[3]+j*A,D.opt.margins[0],D.opt.margins[3]+(j+1)*A,D.height-D.opt.margins[2]]];break;case"line":m=false;case"barline":var l=Math.round((m?A/2:0)+D.opt.margins[3]+j*(m?A:z));s=[["M",l,D.opt.margins[0]],["L",l,D.height-D.opt.margins[2]]]}if(s){c=a.showPath(D,s).attr(D.opt.features.highlight.indexHighlightProps);D.highlighted.push({element:c,attr:false,cfg:D.opt.features.highlight})}}},onMouseOut:function(e,f,d,c){this.removeHighlighted(e,true)}};b.elycharts.featuresmanager.register(b.elycharts.highlightmanager,21)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.labelmanager={beforeShow:function(f,g){if(!a.executeIfChanged(f,["labels","values","series"])){return}if(f.opt.labels&&(f.opt.type=="pie"||f.opt.type=="funnel")){var j=false;var h;for(var d=0;d<g.length;d++){if(g[d].section=="Series"&&g[d].subSection=="Plot"){var e=a.areaProps(f,"Series",g[d].serie);if(f.emptySeries&&f.opt.series.empty){e.label=b.extend(true,e.label,f.opt.series.empty.label)}if(e&&e.label&&e.label.active){h=[];for(var c=0;c<g[d].paths.length;c++){if(g[d].paths[c].path){j=c;h.push(this.showLabel(f,g[d],g[d].paths[c],g[d].serie,c,g))}else{h.push({path:false,attr:false})}}g.push({section:g[d].section,serie:g[d].serie,subSection:"Label",paths:h})}}else{if(g[d].section=="Sector"&&g[d].serie=="bottom"&&!g[d].subSection&&j<f.opt.labels.length-1){h=[];h.push(this.showLabel(f,g[d],g[d],"Series",f.opt.labels.length-1,g));g.push({section:g[d].section,serie:g[d].serie,subSection:"Label",paths:h})}}}}},showLabel:function(o,u,t,m,q,l){var j=a.areaProps(o,"Series",m,q);if(o.opt.labels[q]||j.label.label){var h=t;var s=j.label.label?j.label.label:o.opt.labels[q];var d=a.getCenter(h,j.label.offset);if(!j.label.html){var r=j.label.props;if(j.label.frameAnchor){r=a._clone(j.label.props);r["text-anchor"]=j.label.frameAnchor[0];r["alignment-baseline"]=j.label.frameAnchor[1]}return{path:[["TEXT",s,d[0],d[1]]],attr:r}}else{var n=1;var g=a._clone(j.label.style);var f=(typeof g.opacity!="undefined");if(f){n=g.opacity;g.opacity=0}g.position="absolute";g["z-index"]=25;var i;if(typeof s=="string"){i=b("<div>"+s+"</div>").css(g).prependTo(o.container)}else{i=b(s).css(g).prependTo(o.container)}if(o.opt.features.debug.active&&i.height()==0){alert("DEBUG: Al gestore label e' stata passata una label ancora senza dimensioni, quindi ancora non disegnata. Per questo motivo il posizionamento potrebbe non essere correto.")}var e=d[0];var c=d[1];if(!j.label.frameAnchor||j.label.frameAnchor[0]=="middle"){e-=i.width()/2}else{if(j.label.frameAnchor&&j.label.frameAnchor[0]=="end"){e-=i.width()}}if(!j.label.frameAnchor||j.label.frameAnchor[1]=="middle"){c-=i.height()/2}else{if(j.label.frameAnchor&&j.label.frameAnchor[1]=="top"){c-=i.height()}}if(f){i.css({margin:c+"px 0 0 "+e+"px",opacity:n})}else{i.css({margin:c+"px 0 0 "+e+"px"})}return{path:[["DOMELEMENT",i]],attr:false}}}return false}};b.elycharts.featuresmanager.register(b.elycharts.labelmanager,5)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.legendmanager={afterShow:function(L,l){if(L.legenditems){for(item in L.legenditems){L.legenditems[item].remove()}L.legenditems=false}if(!L.opt.legend||L.opt.legend.length==0){return}var d=L.opt.features.legend;if(d===false){return}var e=d.x;if(e=="auto"){var D=1;e=0}var c=d.width;if(c=="auto"){var o=1;c=L.width}var H=0;var A=[];var f=0;var B,M,K,r,q,p,G;for(B in L.opt.legend){if(L.opt.type!="pie"){f++}else{f+=L.opt.legend[B].length}}var J=0;for(B in L.opt.legend){if(L.opt.type!="pie"){M=[L.opt.legend[B]]}else{M=L.opt.legend[B]}for(var I=0;I<M.length;I++){var m=a.areaProps(L,"Series",B,L.opt.type=="pie"?I:false);var C=b.extend(true,{},d);if(m.legend){C=b.extend(true,C,m.legend)}var F=a.getItemColor(L,B,L.opt.type=="pie"?I:false);if(F){a.colorize(L,C,[["dotProps","fill"]],F)}if(!C.dotProps.fill&&L.opt.type=="pie"){if(m.plotProps&&m.plotProps.fill){C.dotProps.fill=m.plotProps.fill}}var g=d.margins?d.margins[0]+d.margins[2]:0;var n=d.margins?d.margins[1]+d.margins[3]:0;var N=d.margins?d.margins[0]:0;var z=d.margins?d.margins[3]:0;if(!d.horizontal){K=(d.height-g)/f;r=c-n;q=Math.floor(e+z);p=Math.floor(d.y+N+K*J)}else{K=d.height-g;if(!d.itemWidth||d.itemWidth=="fixed"){r=(c-n)/f;q=Math.floor(e+z+r*J)}else{r=(c-n)-H;q=e+z+H}p=Math.floor(d.y+N)}if(C.dotType=="rect"){A.push(a.showPath(L,[["RECT",d.dotMargins[0]+q,p+Math.floor((K-C.dotHeight)/2),d.dotMargins[0]+q+C.dotWidth,p+Math.floor((K-C.dotHeight)/2)+C.dotHeight,C.dotR]]).attr(C.dotProps));G=d.dotMargins[0]+C.dotWidth+d.dotMargins[1]}else{if(C.dotType=="circle"){A.push(a.showPath(L,[["CIRCLE",d.dotMargins[0]+q+C.dotR,p+(K/2),C.dotR]]).attr(C.dotProps));G=d.dotMargins[0]+C.dotR*2+d.dotMargins[1]}}var v=M[I];var u=a.showPath(L,[["TEXT",v,q+G,p+Math.ceil(K/2)+(Raphael.VML?2:0)]]).attr({"text-anchor":"start"}).attr(C.textProps);A.push(u);while(u.getBBox().width>(r-G)&&u.getBBox().width>10){v=v.substring(0,v.length-1);u.attr({text:v})}u.show();if(d.horizontal&&d.itemWidth=="auto"){H+=G+u.getBBox().width+4}else{if(!d.horizontal&&o){H=u.getBBox().width+G>H?u.getBBox().width+G:H}else{H+=r}}J++}}if(o){c=H+d.margins[3]+d.margins[1]-1}if(D){e=Math.floor((L.width-c)/2);for(J in A){if(A[J].attrs.x){A[J].attr("x",A[J].attrs.x+e)}else{A[J].attr("path",a.movePath(L,A[J].attrs.path,[e,0]))}}}var s=[["RECT",e,d.y,e+c,d.y+d.height,d.r]];var E=a.showPath(L,s).attr(d.borderProps);for(J in A){A[J].toFront()}A.unshift(E);L.legenditems=A}};b.elycharts.featuresmanager.register(b.elycharts.legendmanager,90)})(jQuery);(function(c){var a=c.elycharts.featuresmanager;var b=c.elycharts.common;c.elycharts.mousemanager={clear:function(d){if(d.mouseLayer){d.mouseLayer.remove();d.mouseLayer=null;d.mousePaper.clear();d.mousePaper.remove();d.mousePaper=null;d.mouseTimer=null;d.mouseAreas=null}},afterShow:function(n,g){if(!n.opt.interactive){return}this.clear(n);n.mouseLayer=c("<div></div>").css({position:"absolute","z-index":20,opacity:1}).prependTo(n.container);n.mousePaper=b._RaphaelInstance(n.mouseLayer.get(0),n.width,n.height);var f=n.mousePaper;if(n.opt.features.debug.active&&typeof DP_Debug!="undefined"){n.paper.text(n.width,n.height-5,"DEBUG").attr({"text-anchor":"end",stroke:"red",opacity:0.1});f.text(n.width,n.height-5,"DEBUG").attr({"text-anchor":"end",stroke:"red",opacity:0.1}).click(function(){DP_Debug.dump(n.opt,"",false,4)})}var l,h;n.mouseAreas=[];if(n.opt.features.mousearea.type=="single"){for(l=0;l<g.length;l++){if(g[l].mousearea){if(!g[l].paths){if(g[l].path.length>=1&&(g[l].path[0][0]=="LINE"||g[l].path[0][0]=="LINEAREA")){for(h=0;h<g[l].path[0][1].length;h++){var o=b.areaProps(n,g[l].section,g[l].serie);if(o.mouseareaShowOnNull||g[l].section!="Series"||n.opt.values[g[l].serie][h]!=null){n.mouseAreas.push({path:[["CIRCLE",g[l].path[0][1][h][0],g[l].path[0][1][h][1],10]],piece:g[l],pieces:g,index:h,props:o})}}}else{for(h=0;h<g[l].path.length;h++){n.mouseAreas.push({path:[["CIRCLE",b.getX(g[l].path[h]),b.getY(g[l].path[h]),10]],piece:g[l],pieces:g,index:h,props:b.areaProps(n,g[l].section,g[l].serie)})}}}else{if(g[l].paths){for(h=0;h<g[l].paths.length;h++){if(g[l].paths[h].path){n.mouseAreas.push({path:g[l].paths[h].path,piece:g[l],pieces:g,index:h,props:b.areaProps(n,g[l].section,g[l].serie)})}}}}}}}else{var d=n.opt.features.mousearea.indexCenter;if(d=="auto"){d=n.indexCenter}var e,r;if(d=="bar"){r=(n.width-n.opt.margins[3]-n.opt.margins[1])/(n.opt.labels.length>0?n.opt.labels.length:1);e=n.opt.margins[3]}else{r=(n.width-n.opt.margins[3]-n.opt.margins[1])/(n.opt.labels.length>1?n.opt.labels.length-1:1);e=n.opt.margins[3]-r/2}for(var q in n.opt.labels){var m=parseInt(q);n.mouseAreas.push({path:[["RECT",e+m*r,n.height-n.opt.margins[2],e+(m+1)*r,n.opt.margins[0]]],piece:false,pieces:g,index:parseInt(m),props:n.opt.defaultSeries})}}var p=false;if(!n.opt.features.mousearea.syncTag){n.mouseareaenv={chartEnv:false,mouseObj:false,caller:false,inArea:-1,timer:false};p=n.mouseareaenv}else{if(!c.elycharts.mouseareaenv){c.elycharts.mouseareaenv={}}if(!c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]){c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]={chartEnv:false,mouseObj:false,caller:false,inArea:-1,timer:false}}p=c.elycharts.mouseareaenv[n.opt.features.mousearea.syncTag]}for(l=0;l<n.mouseAreas.length;l++){n.mouseAreas[l].area=b.showPath(n,n.mouseAreas[l].path,f).attr({stroke:"#000",fill:"#fff",opacity:0});(function(u,w,v,s,j){var t=w.piece;var i=w.index;w.mouseover=function(x){w.event=x;clearTimeout(j.timer);s.onMouseOverArea(u,t,i,w);if(j.chartEnv&&j.chartEnv.id!=u.id){j.caller.onMouseExitArea(j.chartEnv,j.mouseObj.piece,j.mouseObj.index,j.mouseObj);s.onMouseEnterArea(u,t,i,w)}else{if(j.inArea!=v){if(j.inArea<0){s.onMouseEnterArea(u,t,i,w)}else{s.onMouseChangedArea(u,t,i,w)}}}j.chartEnv=u;j.mouseObj=w;j.caller=s;j.inArea=v};w.mouseout=function(x){w.event=x;clearTimeout(j.timer);s.onMouseOutArea(u,t,i,w);j.timer=setTimeout(function(){j.timer=false;s.onMouseExitArea(u,t,i,w);j.chartEnv=false;j.inArea=-1},u.opt.features.mousearea.areaMoveDelay)};c(w.area.node).mouseover(w.mouseover);c(w.area.node).mouseout(w.mouseout)})(n,n.mouseAreas[l],l,this,p)}},onMouseOverArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseOver){g.opt.features.mousearea.onMouseOver(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseOver(g,d.piece?d.piece.serie:false,d.index,d)},onMouseOutArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseOut){g.opt.features.mousearea.onMouseOut(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseOut(g,d.piece?d.piece.serie:false,d.index,d)},onMouseEnterArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseEnter){g.opt.features.mousearea.onMouseEnter(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseEnter(g,d.piece?d.piece.serie:false,d.index,d)},onMouseChangedArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseChanged){g.opt.features.mousearea.onMouseChanged(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseChanged(g,d.piece?d.piece.serie:false,d.index,d)},onMouseExitArea:function(g,f,e,d){if(g.opt.features.mousearea.onMouseExit){g.opt.features.mousearea.onMouseExit(g,d.piece?d.piece.serie:false,d.index,d)}a.onMouseExit(g,d.piece?d.piece.serie:false,d.index,d)}};c.elycharts.featuresmanager.register(c.elycharts.mousemanager,0)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.tooltipmanager={clear:function(c){if(c.tooltipContainer){c.tooltipFrame.clear();c.tooltipFrame.remove();c.tooltipFrame=null;c.tooltipFrameElement=null;c.tooltipContent.remove();c.tooltipContent=null;c.tooltipContainer.remove();c.tooltipContainer=null}},afterShow:function(c,d){this.clear(c);if(!b.elycharts.tooltipid){b.elycharts.tooltipid=0}b.elycharts.tooltipid++;c.tooltipContainer=b('<div id="elycharts_tooltip_'+b.elycharts.tooltipid+'" style="position: absolute; top: 100; left: 100; z-index: 10; overflow: hidden; white-space: nowrap; display: none"><div id="elycharts_tooltip_'+b.elycharts.tooltipid+'_frame" style="position: absolute; top: 0; left: 0; z-index: -1"></div><div id="elycharts_tooltip_'+b.elycharts.tooltipid+'_content" style="cursor: default"></div></div>').appendTo(document.body);c.tooltipFrame=a._RaphaelInstance("elycharts_tooltip_"+b.elycharts.tooltipid+"_frame",500,500);c.tooltipContent=b("#elycharts_tooltip_"+b.elycharts.tooltipid+"_content")},_prepareShow:function(e,d,c,g){if(d.width&&d.width!="auto"&&d.height&&d.height!="auto"){var j=d.frameProps&&d.frameProps["stroke-width"]?d.frameProps["stroke-width"]:0;e.tooltipContainer.width(d.width+j+1).height(d.height+j+1);if(!e.tooltipFrameElement&&d.frameProps){var f=[["RECT",j/2,j/2,d.width,d.height,d.roundedCorners]];e.tooltipFrameElement=a.showPath(e,f,e.tooltipFrame).attr(d.frameProps)}}if(e.tooltipFrameElement){e.tooltipFrameElement.attr(d.frameProps)}if(d.padding){e.tooltipContent.css({padding:d.padding[0]+"px "+d.padding[1]+"px"})}e.tooltipContent.css(d.contentStyle);e.tooltipContent.html(g);var h=b(e.container).offset();if(e.opt.features.tooltip.fixedPos){h.top+=e.opt.features.tooltip.fixedPos[1];h.left+=e.opt.features.tooltip.fixedPos[0]}else{var i=this.getXY(e,d,c);if(!i[2]){h.left+=i[0];while(h.top+i[1]<0){i[1]+=20}h.top+=i[1]}else{h.left=i[0];h.top=i[1]}}return{top:h.top,left:h.left}},getXY:function(e,i,c){var m=0,l=0;if(c.path[0][0]=="RECT"){m=a.getX(c.path[0])-i.offset[1];l=a.getY(c.path[0])-i.height-i.offset[0]}else{if(c.path[0][0]=="CIRCLE"){m=a.getX(c.path[0])-i.offset[1];l=a.getY(c.path[0])-i.height-i.offset[0]}else{if(c.path[0][0]=="SLICE"){var p=c.path[0];var n=i.width&&i.width!="auto"?i.width:100;var d=i.height&&i.height!="auto"?i.height:100;var f=Math.sqrt(Math.pow(n,2)+Math.pow(d,2))/2;if(f>e.opt.r){f=e.opt.r}var o=p[5]+(p[6]-p[5])/2+180;var g=Math.PI/180;m=p[1]+f*Math.cos(-o*g)-n/2;l=p[2]+f*Math.sin(-o*g)-d/2}else{if(c.piece&&c.piece.paths&&c.index>=0&&c.piece.paths[c.index]&&c.piece.paths[c.index].rect){var j=c.piece.paths[c.index].rect;m=j[0]-i.offset[1];l=j[1]-i.height-i.offset[0]}}}}if(e.opt.features.tooltip.positionHandler){return e.opt.features.tooltip.positionHandler(e,i,c,m,l)}else{return[m,l]}},getTip:function(d,e,c){var f=false;if(d.opt.tooltips){if(typeof d.opt.tooltips=="function"){f=d.opt.tooltips(d,e,c,e&&d.opt.values[e]&&d.opt.values[e][c]?d.opt.values[e][c]:false,d.opt.labels&&d.opt.labels[c]?d.opt.labels[c]:false)}else{if(e&&d.opt.tooltips[e]&&d.opt.tooltips[e][c]){f=d.opt.tooltips[e][c]}else{if(!e&&d.opt.tooltips[c]){f=d.opt.tooltips[c]}}}}return f},_getProps:function(g,h,e,d){var f=d.props.tooltip;if(g.emptySeries&&g.opt.series.empty){f=b.extend(true,f,g.opt.series.empty.tooltip)}if(!f||!f.active){return false}if(f.frameProps){var c=a.getItemColor(g,h,e);if(c){f=a._clone(f);a.colorize(g,f,[["frameProps","stroke"]],c)}}return f},_fadeOut:function(c){c.tooltipContainer.fadeOut(c.opt.features.tooltip.fadeDelay)},onMouseEnter:function(f,g,d,c){var e=this._getProps(f,g,d,c);if(!e){return false}var h=this.getTip(f,g,d);if(!h){this._fadeOut(f);return true}f.tooltipContainer.css(this._prepareShow(f,e,c,h)).fadeIn(f.opt.features.tooltip.fadeDelay);return true},onMouseChanged:function(f,g,d,c){var e=this._getProps(f,g,d,c);if(!e){return false}var h=this.getTip(f,g,d);if(!h){this._fadeOut(f);return true}f.tooltipContainer.clearQueue();f.tooltipContainer.fadeIn(f.opt.features.tooltip.fadeDelay);f.tooltipContainer.animate(this._prepareShow(f,e,c,h),f.opt.features.tooltip.moveDelay,"linear");return true},onMouseExit:function(f,g,d,c){var e=this._getProps(f,g,d,c);if(!e){return false}this._fadeOut(f);return true}};b.elycharts.featuresmanager.register(b.elycharts.tooltipmanager,20)})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.line={init:function(c){},_getColorizationKey:function(c){if(c=="line"){return[["plotProps","stroke"],["dotProps","fill"],["fillProps","fill"]]}else{return[["plotProps","stroke"],["plotProps","fill"]]}},draw:function(n){if(a.executeIfChanged(n,["values","series"])){n.plots={};n.axis={x:{}};n.barno=0;n.indexCenter="line"}var z=n.opt;var N=n.plots;var A=n.axis;var f=n.paper;var X=n.opt.values;var q=n.opt.labels;var S,o,E,B,e,m;if(a.executeIfChanged(n,["values","series"])){var V=0;var O=false;for(B in X){e={index:V,type:false,visible:false};N[B]=e;if(X[B]){E=a.areaProps(n,"Series",B);e.type=E.type;if(E.type=="bar"){n.indexCenter="bar"}if(E.visible){e.visible=true;if(!m||m<X[B].length){m=X[B].length}var I=[];for(S=0;S<X[B].length;S++){var F=X[B][S];if(E.avgOverNulls&&F==null){if(E.type=="bar"){F=0}else{for(var R=S+1;R<X[B].length&&X[B][R]==null;R++){}var h=R<X[B].length?X[B][R]:null;for(var Q=S-1;Q>=0&&X[B][Q]==null;Q--){}var H=Q>=0?X[B][Q]:null;F=h!=null?(H!=null?(h*(S-Q)+H*(R-S))/(R-Q):h):H}}I.push(F)}if(E.stacked&&!(typeof E.stacked=="string")){E.stacked=O}if(typeof E.stacked=="undefined"||E.stacked==B||E.stacked<0||!N[E.stacked]||!N[E.stacked].visible||N[E.stacked].type!=e.type){e.ref=B;if(E.type=="bar"){e.barno=n.barno++}e.from=[];if(!E.cumulative){e.to=I}else{e.to=[];o=0;for(S=0;S<I.length;S++){e.to.push(o+=I[S]!=null?I[S]:0)}}for(S=0;S<I.length;S++){e.from.push(e.to[S]!=null?0:null)}}else{e.ref=E.stacked;if(E.type=="bar"){e.barno=N[E.stacked].barno}e.from=N[E.stacked].stack;e.to=[];o=0;if(!E.cumulative){for(S=0;S<I.length;S++){e.to.push(e.from[S]+(I[S]!=null?I[S]:0))}}else{for(S=0;S<I.length;S++){e.to.push(e.from[S]+(o+=(I[S]!=null?I[S]:0)))}}N[E.stacked].stack=e.to}e.stack=e.to;e.max=Math.max.apply(Math,e.from.concat(e.to));e.min=Math.min.apply(Math,e.from.concat(e.to));if(E.axis){if(!A[E.axis]){A[E.axis]={plots:[]}}A[E.axis].plots.push(B);if(typeof A[E.axis].max=="undefined"){A[E.axis].max=e.max}else{A[E.axis].max=Math.max(A[E.axis].max,e.max)}if(typeof A[E.axis].min=="undefined"){A[E.axis].min=e.min}else{A[E.axis].min=Math.min(A[E.axis].min,e.min)}}O=B}}}}if(!q){q=[]}while(m>q.length){q.push(null)}m=q.length;n.opt.labels=q;if(a.executeIfChanged(n,["values","series","axis"])){for(var s in A){E=a.areaProps(n,"Axis",s);A[s].props=E;if(typeof E.max!="undefined"){A[s].max=E.max}if(typeof E.min!="undefined"){A[s].min=E.min}if(A[s].min==A[s].max){A[s].max=A[s].min+1}if(E.normalize&&E.normalize>0){var M=Math.abs(A[s].max);if(A[s].min&&Math.abs(A[s].min)>M){M=Math.abs(A[s].min)}if(M){var C=Math.floor(Math.log(M)/Math.LN10)-(E.normalize-1);C=C>=0?Math.pow(10,C):1/Math.pow(10,-C);M=Math.ceil(M/C/(z.features.grid.ny?z.features.grid.ny:1))*C*(z.features.grid.ny?z.features.grid.ny:1);M=Math.round(M/C)*C;A[s].normalizationBase=C;if(A[s].max){A[s].max=Math.ceil(A[s].max/M)*M}if(A[s].min){A[s].min=Math.floor(A[s].min/M)*M}}}if(A[s].plots){for(var J=0;J<A[s].plots.length;J++){N[A[s].plots[J]].max=A[s].max;N[A[s].plots[J]].min=A[s].min}}}}var T=[];this.grid(n,T);var t=(n.width-z.margins[3]-z.margins[1])/(q.length>1?q.length-1:1);var P=(n.width-z.margins[3]-z.margins[1])/(q.length>0?q.length:1);for(B in X){E=a.areaProps(n,"Series",B);e=N[B];a.colorize(n,E,this._getColorizationKey(E.type),a.getItemColor(n,B));if(E.lineCenter&&E.lineCenter=="auto"){E.lineCenter=(n.indexCenter=="bar")}else{if(E.lineCenter&&n.indexCenter=="line"){n.indexCenter="bar"}}if(X[B]&&E.visible){var r=(n.height-z.margins[2]-z.margins[0])/(e.max-e.min);if(E.type=="line"){var D=["LINE",[],E.rounded];var g=["LINEAREA",[],[],E.rounded];var W=[];for(S=0,J=q.length;S<J;S++){if(e.to.length>S){var Y=a.areaProps(n,"Series",B,S);a.colorize(n,Y,this._getColorizationKey(E.type),a.getItemColor(n,B,S));var L=Math.round((E.lineCenter?P/2:0)+z.margins[3]+S*(E.lineCenter?P:t));var K=null;if(e.to[S]!=null){var U=e.to[S]>e.max?e.max:(e.to[S]<e.min?e.min:e.to[S]);K=Math.round(n.height-z.margins[2]-r*(U-e.min))}var p=null;if(e.from[S]!=null){var u=e.from[S]>e.max?e.max:(e.from[S]<e.min?e.min:e.from[S]);p=Math.round(n.height-z.margins[2]-r*(u-e.min))+(Raphael.VML?1:0)}D[1].push([L,K]);if(E.fill){g[1].push([L,K]);g[2].push([L,p])}if(Y.dot){if(X[B][S]==null&&!Y.dotShowOnNull){W.push({path:false,attr:false})}else{W.push({path:[["CIRCLE",L,K,Y.dotProps.size]],attr:Y.dotProps})}}}}if(E.fill){T.push({section:"Series",serie:B,subSection:"Fill",path:[g],attr:E.fillProps})}else{T.push({section:"Series",serie:B,subSection:"Fill",path:false,attr:false})}T.push({section:"Series",serie:B,subSection:"Plot",path:[D],attr:E.plotProps,mousearea:"pathsteps"});if(W.length){T.push({section:"Series",serie:B,subSection:"Dot",paths:W})}else{T.push({section:"Series",serie:B,subSection:"Dot",path:false,attr:false})}}else{pieceBar=[];for(S=0,J=q.length;S<J;S++){if(e.to.length>S){if(e.from[S]!=e.to[S]){var Y=a.areaProps(n,"Series",B,S);a.colorize(n,Y,this._getColorizationKey(E.type),a.getItemColor(n,B,S));var l=Math.floor((P-z.barMargins)/(1+(n.barno-1)*(100-z.barOverlapPerc)/100));var G=l*(100-E.barWidthPerc)/200;var c=z.barMargins/2+e.barno*(l*(100-z.barOverlapPerc)/100);var w=Math.floor(z.margins[3]+S*P+c+G);var aa=Math.round(n.height-z.margins[2]-r*(e.to[S]-e.min));var Z=Math.round(n.height-z.margins[2]-r*(e.from[S]-e.min));pieceBar.push({path:[["RECT",w,aa,w+l-G*2,Z]],attr:Y.plotProps})}else{pieceBar.push({path:false,attr:false})}}}if(pieceBar.length){T.push({section:"Series",serie:B,subSection:"Plot",paths:pieceBar,mousearea:"paths"})}else{T.push({section:"Series",serie:B,subSection:"Plot",path:false,attr:false,mousearea:"paths"})}}}else{if(E.type=="line"){T.push({section:"Series",serie:B,subSection:"Fill",path:false,attr:false})}T.push({section:"Series",serie:B,subSection:"Plot",path:false,attr:false,mousearea:"paths"});if(E.type=="line"){T.push({section:"Series",serie:B,subSection:"Dot",path:false,attr:false})}}}return T},grid:function(l,ab){if(a.executeIfChanged(l,["values","series","axis","labels","margins","width","height","features.grid"])){var C=l.opt;var I=l.opt.features.grid;var c=l.paper;var E=l.axis;var r=l.opt.labels;var w=(l.width-C.margins[3]-C.margins[1])/(r.length>1?r.length-1:1);var W=(l.width-C.margins[3]-C.margins[1])/(r.length>0?r.length:1);var aa,Z,R,Q,G,X,V,e,J,o;var M=[];var m=I.labelsCenter;if(m=="auto"){m=(l.indexCenter=="bar")}if(E.x&&E.x.props.labels){var H=false;var u=E.x.props.labelsAnchor||"auto";if(u=="auto"){u=E.x.props.labelsRotate>0?"start":(E.x.props.labelsRotate==0?"middle":"end")}var ac=E.x.props.labelsPos||"auto";if(ac=="auto"){ac=m?(E.x.props.labelsRotate==0?u:"middle"):"start"}for(aa=0;aa<r.length;aa++){if((typeof r[aa]!="boolean"&&r[aa]!=null)||r[aa]){if(!E.x.props.labelsSkip||aa>=E.x.props.labelsSkip){J=r[aa];if(E.x.props.labelsFormatHandler){J=E.x.props.labelsFormatHandler(J)}o=(E.x.props.prefix?E.x.props.prefix:"")+J+(E.x.props.suffix?E.x.props.suffix:"");X=C.margins[3]+aa*(m?W:w)+(E.x.props.labelsMargin?E.x.props.labelsMargin:0);if(ac=="middle"){X+=(m?W:w)/2}if(ac=="end"){X+=(m?W:w)}V=l.height-C.margins[2]+E.x.props.labelsDistance;e=c.text(X,V,o).attr(E.x.props.labelsProps).toBack();e.attr({"text-anchor":u});var g=false;var D=e.getBBox();var ae={x:D.x,y:D.y};var ad={x:D.x+D.width,y:D.y+D.height};var q={x:X,y:V};rotate=function(j,i){var y=j.x*Math.cos(i)-j.y*Math.sin(i),x=j.x*Math.sin(i)+j.y*Math.cos(i);return{x:y,y:x}};collide=function(j,i,ah){xor=function(aj,ai){return(aj||ai)&&!(aj&&ai)};if(j.alpha!=i.alpha){throw"collide doens't support rects with different rotations"}var af=rotate({x:j.p1.x-ah,y:j.p1.y-ah},-j.alpha);var ag=rotate({x:j.p2.x+ah,y:j.p2.y+ah},-j.alpha);var x=rotate({x:i.p1.x-ah,y:i.p1.y-ah},-i.alpha);var y=rotate({x:i.p2.x+ah,y:i.p2.y+ah},-i.alpha);return !xor(Math.min(af.x,ag.x)>Math.max(x.x,y.x),Math.max(af.x,ag.x)<Math.min(x.x,y.x))&&!xor(Math.min(af.y,ag.y)>Math.max(x.y,y.y),Math.max(af.y,ag.y)<Math.min(x.y,y.y))};rotated=function(x,i,af){translate=function(ah,ag){return{x:ah.x+ag.x,y:ah.y+ag.y}};negate=function(ag){return{x:-ag.x,y:-ag.y}};var y=translate(rotate(translate(x.p1,negate(i)),af),i);var j=translate(rotate(translate(x.p2,negate(i)),af),i);return{p1:y,p2:j,alpha:x.alpha+af}};D=function(y){if(y.alpha==0){return{x:y.p1.x,y:y.p1.y,width:y.p2.x-y.p1.x,height:y.p2.y-y.p1.y}}else{var j=[];j.push({x:0,y:0});j.push({x:y.p2.x-y.p1.x,y:0});j.push({x:0,y:y.p2.y-y.p1.y});j.push({x:y.p2.x-y.p1.x,y:y.p2.y-y.p1.y});var ai=[];ai.left=0;ai.right=0;ai.top=0;ai.bottom=0;for(_px=0;_px<j.length;_px++){var ag=j[_px];var ah=parseInt((ag.x*Math.cos(y.alpha))+(ag.y*Math.sin(y.alpha)));var af=parseInt((ag.x*Math.sin(y.alpha))+(ag.y*Math.cos(y.alpha)));ai.left=Math.min(ai.left,ah);ai.right=Math.max(ai.right,ah);ai.top=Math.min(ai.top,af);ai.bottom=Math.max(ai.bottom,af)}var x=parseInt(Math.abs(ai.right-ai.left));var i=parseInt(Math.abs(ai.bottom-ai.top));var ah=((y.p1.x+y.p2.x)/2)-x/2;var af=((y.p1.y+y.p2.y)/2)-i/2;return{x:ah,y:af,width:x,height:i}}};var Y=Raphael.rad(E.x.props.labelsRotate);var K=rotated({p1:ae,p2:ad,alpha:0},q,Y);var h=E.x.props.labelsMarginRight?E.x.props.labelsMarginRight/2:0;if(E.x.props.labelsHideCovered&&H&&collide(K,H,h)){e.hide()}else{g=D(K);if(I.nx=="auto"&&(g.x<0||g.x+g.width>l.width)){e.hide()}else{H=K}}if(E.x.props.labelsRotate){if(Raphael.animation){e.transform(Raphael.format("r{0},{1},{2}",E.x.props.labelsRotate,X,V)).toBack()}else{e.rotate(E.x.props.labelsRotate,X,V).toBack()}}M.push({path:[["RELEMENT",e]],attr:false})}}}}ab.push({section:"Axis",serie:"x",subSection:"Label",paths:M});if(E.x&&E.x.props.title){R=C.margins[3]+Math.floor((l.width-C.margins[1]-C.margins[3])/2);Q=l.height-C.margins[2]+E.x.props.titleDistance*(Raphael.VML?E.x.props.titleDistanceIE:1);ab.push({section:"Axis",serie:"x",subSection:"Title",path:[["TEXT",E.x.props.title,R,Q]],attr:E.x.props.titleProps})}else{ab.push({section:"Axis",serie:"x",subSection:"Title",path:false,attr:false})}for(var z in ["l","r"]){Z=["l","r"][z];if(E[Z]&&E[Z].props.labels&&I.ny){M=[];for(aa=E[Z].props.labelsSkip?E[Z].props.labelsSkip:0;aa<=I.ny;aa++){var t=(l.height-C.margins[2]-C.margins[0])/I.ny;if(Z=="r"){X=l.width-C.margins[1]+E[Z].props.labelsDistance;if(!E[Z].props.labelsProps["text-anchor"]){E[Z].props.labelsProps["text-anchor"]="start"}}else{X=C.margins[3]-E[Z].props.labelsDistance;if(!E[Z].props.labelsProps["text-anchor"]){E[Z].props.labelsProps["text-anchor"]="end"}}if(E[Z].props.labelsAnchor&&E[Z].props.labelsAnchor!="auto"){E[Z].props.labelsProps["text-anchor"]=E[Z].props.labelsAnchor}J=(E[Z].min+(aa*((E[Z].max-E[Z].min)/I.ny)));if(E[Z].normalizationBase){J=Math.round(J/E[Z].normalizationBase)/(1/E[Z].normalizationBase)}if(E[Z].props.labelsFormatHandler){J=E[Z].props.labelsFormatHandler(J)}if(E[Z].props.labelsCompactUnits){J=a.compactUnits(J,E[Z].props.labelsCompactUnits)}o=(E[Z].props.prefix?E[Z].props.prefix:"")+J+(E[Z].props.suffix?E[Z].props.suffix:"");V=l.height-C.margins[2]-aa*t;M.push({path:[["TEXT",o,X,V+(E[Z].props.labelsMargin?E[Z].props.labelsMargin:0)]],attr:E[Z].props.labelsProps})}ab.push({section:"Axis",serie:Z,subSection:"Label",paths:M})}else{ab.push({section:"Axis",serie:Z,subSection:"Label",paths:[]})}if(E[Z]&&E[Z].props.title){if(Z=="r"){R=l.width-C.margins[1]+E[Z].props.titleDistance*(Raphael.VML?E[Z].props.titleDistanceIE:1)}else{R=C.margins[3]-E[Z].props.titleDistance*(Raphael.VML?E[Z].props.titleDistanceIE:1)}var B=a._clone(E[Z].props.titleProps);var L=Z=="l"?270:90;var Q=C.margins[0]+Math.floor((l.height-C.margins[0]-C.margins[2])/2);if(Raphael.animation){var e=c.text(R,Q,E[Z].props.title).attr(B).transform(Raphael.format("r{0}",L)).toBack();ab.push({section:"Axis",serie:Z,subSection:"Title",path:[["RELEMENT",e]],attr:false})}else{B.rotation=L;ab.push({section:"Axis",serie:Z,subSection:"Title",path:[["TEXT",E[Z].props.title,R,Q]],attr:B})}}else{ab.push({section:"Axis",serie:Z,subSection:"Title",path:false,attr:false})}}if(I.nx||I.ny){var S=[],A=[],n=[],U=I.nx=="auto"?(m?r.length:r.length-1):I.nx,T=I.ny,f=(l.height-C.margins[2]-C.margins[0])/(T?T:1),p=(l.width-C.margins[1]-C.margins[3])/(U?U:1),P=typeof I.forceBorder=="object"?I.forceBorder[3]:I.forceBorder,O=typeof I.forceBorder=="object"?I.forceBorder[1]:I.forceBorder,v=typeof I.forceBorder=="object"?I.forceBorder[0]:I.forceBorder,s=typeof I.forceBorder=="object"?I.forceBorder[2]:I.forceBorder,N=T>0?(typeof I.draw=="object"?I.draw[0]:I.draw):false,F=U>0?typeof I.draw=="object"?I.draw[1]:I.draw:false;if(T>0){for(aa=0;aa<T+1;aa++){if(v&&aa==0||s&&aa==T||N&&aa>0&&aa<T){S.push(["M",C.margins[3]-I.extra[3],C.margins[0]+Math.round(aa*f)]);S.push(["L",l.width-C.margins[1]+I.extra[1],C.margins[0]+Math.round(aa*f)])}if(aa<T){if(aa%2==0&&I.evenHProps||aa%2==1&&I.oddHProps){A.push({path:[["RECT",C.margins[3]-I.extra[3],C.margins[0]+Math.round(aa*f),l.width-C.margins[1]+I.extra[1],C.margins[0]+Math.round((aa+1)*f)]],attr:aa%2==0?I.evenHProps:I.oddHProps})}else{A.push({path:false,attr:false})}}}}for(aa=0;aa<U+1;aa++){if(P&&aa==0||O&&aa==U||F&&((I.nx!="auto"&&aa>0&&aa<U)||(I.nx=="auto"&&(typeof r[aa]!="boolean"||r[aa])))){S.push(["M",C.margins[3]+Math.round(aa*p),C.margins[0]-I.extra[0]]);S.push(["L",C.margins[3]+Math.round(aa*p),l.height-C.margins[2]+I.extra[2]])}if(aa<U){if(aa%2==0&&I.evenVProps||aa%2==1&&I.oddVProps){n.push({path:[["RECT",C.margins[3]+Math.round(aa*p),C.margins[0]-I.extra[0],C.margins[3]+Math.round((aa+1)*p),l.height-C.margins[2]+I.extra[2],]],attr:aa%2==0?I.evenVProps:I.oddVProps})}else{n.push({path:false,attr:false})}}}ab.push({section:"Grid",path:S.length?S:false,attr:S.length?I.props:false});ab.push({section:"GridBandH",paths:A});ab.push({section:"GridBandV",paths:n});var d=[];if(I.ticks.active&&(typeof I.ticks.active!="object"||I.ticks.active[0])){for(aa=0;aa<U+1;aa++){if(I.nx!="auto"||typeof r[aa]!="boolean"||r[aa]){d.push(["M",C.margins[3]+Math.round(aa*p),l.height-C.margins[2]-I.ticks.size[1]]);d.push(["L",C.margins[3]+Math.round(aa*p),l.height-C.margins[2]+I.ticks.size[0]])}}}if(I.ticks.active&&(typeof I.ticks.active!="object"||I.ticks.active[1])){for(aa=0;aa<T+1;aa++){d.push(["M",C.margins[3]-I.ticks.size[0],C.margins[0]+Math.round(aa*f)]);d.push(["L",C.margins[3]+I.ticks.size[1],C.margins[0]+Math.round(aa*f)])}}if(I.ticks.active&&(typeof I.ticks.active!="object"||I.ticks.active[2])){for(aa=0;aa<T+1;aa++){d.push(["M",l.width-C.margins[1]-I.ticks.size[1],C.margins[0]+Math.round(aa*f)]);d.push(["L",l.width-C.margins[1]+I.ticks.size[0],C.margins[0]+Math.round(aa*f)])}}ab.push({section:"Ticks",path:d.length?d:false,attr:d.length?I.ticks.props:false})}}}}})(jQuery);(function(b){var a=b.elycharts.common;b.elycharts.pie={init:function(c){},draw:function(E){var d=E.opt;var p=E.width-E.opt.margins[1]-E.opt.margins[3];var C=E.height-E.opt.margins[0]-E.opt.margins[2];var t=E.opt.r?E.opt.r:Math.floor((p<C?p:C)/2*(E.opt.rPerc?E.opt.rPerc/100:0.8));var f=(E.opt.cx?E.opt.cx:Math.floor(p/2))+E.opt.margins[3];var e=(E.opt.cy?E.opt.cy:Math.floor(C/2))+E.opt.margins[0];var A=0,B,s,v,z,g;for(v in d.values){z={visible:false,total:0,values:[]};E.plots[v]=z;var c=a.areaProps(E,"Series",v);a.colorize(E,c,[["plotProps","stroke"],["plotProps","fill"]],a.getItemColor(E,v));if(c.visible){z.visible=true;A++;z.values=d.values[v];for(B=0,s=z.values.length;B<s;B++){if(z.values[B]>0){g=a.areaProps(E,"Series",v,B);a.colorize(E,g,[["plotProps","stroke"],["plotProps","fill"]],a.getItemColor(E,v,B));if(typeof g.inside=="undefined"||g.inside<0){z.total+=z.values[B]}}}for(B=0;B<s;B++){if(z.values[B]<z.total*d.valueThresold){z.total=z.total-z.values[B];z.values[B]=0}}}}var u=t/A;var m=-u,j=0;var n=[];for(v in d.values){z=E.plots[v];var y=[];if(z.visible){m+=u;j+=u;var F=E.opt.startAngle,D=0,l=0;if(z.total==0){E.emptySeries=true;g=a.areaProps(E,"Series","empty");a.colorize(E,g,[["plotProps","stroke"],["plotProps","fill"]],a.getItemColor(E,v));y.push({path:[["CIRCLE",f,e,t]],attr:g.plotProps})}else{E.emptySeries=false;for(B=0,s=z.values.length;B<s;B++){var x=z.values[B];if(x>0){g=a.areaProps(E,"Series",v,B);a.colorize(E,g,[["plotProps","stroke"],["plotProps","fill"]],a.getItemColor(E,v,B));if(typeof g.inside=="undefined"||g.inside<0){F+=l;D=360*x/z.total;l=D}else{D=360*values[g.inside]/z.total*x/values[g.inside]}var o=m,q=j;if(g.r){if(g.r>0){if(g.r<=1){q=m+u*g.r}else{q=m+g.r}}else{if(g.r>=-1){o=m+u*(-g.r)}else{o=m-g.r}}}if(!E.opt.clockwise){y.push({path:[["SLICE",f,e,q,o,F,F+D]],attr:g.plotProps})}else{y.push({path:[["SLICE",f,e,q,o,-F-D,-F]],attr:g.plotProps})}}else{y.push({path:false,attr:false})}}}}else{if(d.values[v]&&d.values[v].length){for(B=0,s=d.values[v].length;B<s;B++){y.push({path:false,attr:false})}}}n.push({section:"Series",serie:v,subSection:"Plot",paths:y,mousearea:"paths"})}return n}}})(jQuery);
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.arnan.me/donate/?utm_campaign=donations&utm_medium=readm
|
|
4 |
Tags: ads, advert, adverts, banner, monetize, admin, advertise, adrotator, rotator, ad, advertising, advertisement, advertiser, publisher, adsense, chitika, clickbank, broadstreet, geo, geolocation, geotarget, banner manager, advert manager, campaign manager, export, import, maxmind, statistics, stats, report, geoselect, geolite, schedules, schedule, monetize, header, widget, html5 advert, javascript advert, tracking, clicks, impressions, rotate, zone, zones, sidebar, footer, content, posts, pages
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.7
|
7 |
-
Stable tag: 3.
|
8 |
License: GPLv3
|
9 |
|
10 |
The popular choice for monetizing your website with adverts while keeping things simple. Start making money today!
|
@@ -97,15 +97,31 @@ You can also post your questions on the [forum](https://ajdg.solutions/forums/?u
|
|
97 |
|
98 |
Be a Pro and go Pro. With [AdRotate Pro](https://ajdg.solutions/products/adrotate-for-wordpress/?utm_campaign=adrotate-page&utm_medium=readme&utm_source=adrotate-free)!
|
99 |
|
100 |
-
= 3.
|
101 |
-
* [
|
102 |
-
|
103 |
-
|
104 |
-
* [
|
105 |
-
* [fix]
|
106 |
-
* [fix]
|
107 |
-
* [fix]
|
108 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
|
110 |
All recent changes are available on the [AdRotate website](https://ajdg.solutions/products/adrotate-for-wordpress/development/?utm_campaign=development&utm_medium=readme&utm_source=adrotate-free).
|
111 |
|
@@ -114,7 +130,13 @@ NOTE: Unsolicited offers, parnterships, job offers, promotional emails or produc
|
|
114 |
== Upgrade Notice ==
|
115 |
|
116 |
= 3.16.3 =
|
117 |
-
* [
|
|
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
All recent changes are available on the [AdRotate website](https://ajdg.solutions/products/adrotate-for-wordpress/development/?utm_campaign=development&utm_medium=readme&utm_source=adrotate-free).
|
120 |
|
4 |
Tags: ads, advert, adverts, banner, monetize, admin, advertise, adrotator, rotator, ad, advertising, advertisement, advertiser, publisher, adsense, chitika, clickbank, broadstreet, geo, geolocation, geotarget, banner manager, advert manager, campaign manager, export, import, maxmind, statistics, stats, report, geoselect, geolite, schedules, schedule, monetize, header, widget, html5 advert, javascript advert, tracking, clicks, impressions, rotate, zone, zones, sidebar, footer, content, posts, pages
|
5 |
Requires at least: 3.8
|
6 |
Tested up to: 4.7
|
7 |
+
Stable tag: 3.17
|
8 |
License: GPLv3
|
9 |
|
10 |
The popular choice for monetizing your website with adverts while keeping things simple. Start making money today!
|
97 |
|
98 |
Be a Pro and go Pro. With [AdRotate Pro](https://ajdg.solutions/products/adrotate-for-wordpress/?utm_campaign=adrotate-page&utm_medium=readme&utm_source=adrotate-free)!
|
99 |
|
100 |
+
= 3.17 FREE =
|
101 |
+
* [new] Usage of WP Object Cache for stats
|
102 |
+
* [new] Moved tracker data to WP Transient API
|
103 |
+
* [change] Stats now counted per hour instead of per day
|
104 |
+
* [change] Updated Elycharts to v2.1.6
|
105 |
+
* [fix] Post Injection not always in the right location for categories
|
106 |
+
* [fix] Tracking hash split in the right values
|
107 |
+
* [fix] Graph date labels showing through each other
|
108 |
+
|
109 |
+
= 4.2 PRO =
|
110 |
+
* [new] Usage of WP Object Cache for stats
|
111 |
+
* [new] Moved tracker data to WP Transient API
|
112 |
+
* [change] Stats now counted per hour instead of per day
|
113 |
+
* [change] Updated Elycharts to v2.1.6
|
114 |
+
* [fix] Impressions now always show on adverts dashboard
|
115 |
+
* [fix] Post Injection not always in the right location for categories
|
116 |
+
* [fix] Undefined notice on Main AdRotate dashboard
|
117 |
+
* [fix] Undefined notice on Transactions dashboard
|
118 |
+
* [fix] Hide relevant dashboard links if advertisers are disabled
|
119 |
+
* [fix] Count correct number of hourly impressions
|
120 |
+
* [fix] Tracking hash split in the right values
|
121 |
+
* [fix] 'best' and 'least' advert counts showing wrong numbers
|
122 |
+
* [fix] Graph date labels showing through each other
|
123 |
+
* [fix] Not all Geo Targeting strings translated
|
124 |
+
* [i18n] Polish translation via Michal
|
125 |
|
126 |
All recent changes are available on the [AdRotate website](https://ajdg.solutions/products/adrotate-for-wordpress/development/?utm_campaign=development&utm_medium=readme&utm_source=adrotate-free).
|
127 |
|
130 |
== Upgrade Notice ==
|
131 |
|
132 |
= 3.16.3 =
|
133 |
+
* [new] Usage of WP Object Cache for stats
|
134 |
+
* [new] Moved tracker data to WP Transient API
|
135 |
+
* [change] Stats now counted per hour instead of per day
|
136 |
+
* [change] Updated Elycharts to v2.1.6
|
137 |
+
* [fix] Post Injection not always in the right location for categories
|
138 |
+
* [fix] Tracking hash split in the right values
|
139 |
+
* [fix] Graph date labels showing through each other
|
140 |
|
141 |
All recent changes are available on the [AdRotate website](https://ajdg.solutions/products/adrotate-for-wordpress/development/?utm_campaign=development&utm_medium=readme&utm_source=adrotate-free).
|
142 |
|