Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
84009dc16c | ||
|
|
82c12f6d98 | ||
|
|
6beff3a333 | ||
|
|
d49200c99e | ||
|
|
faed6ac09a |
No files matched your search
+173
-15
@@ -12,11 +12,30 @@ if (!get_session('ss_admin')) {
|
|||||||
// 스킨디렉토리를 SELECT 형식으로 얻음
|
// 스킨디렉토리를 SELECT 형식으로 얻음
|
||||||
function get_skin_select($skin_gubun, $id, $name, $selected='', $event='')
|
function get_skin_select($skin_gubun, $id, $name, $selected='', $event='')
|
||||||
{
|
{
|
||||||
$skins = get_skin_dir($skin_gubun);
|
global $config;
|
||||||
|
|
||||||
|
$skins = array();
|
||||||
|
|
||||||
|
if(defined('G5_THEME_PATH') && $config['cf_theme']) {
|
||||||
|
$dirs = get_skin_dir($skin_gubun, G5_THEME_PATH.'/'.G5_SKIN_DIR);
|
||||||
|
if(!empty($dirs)) {
|
||||||
|
foreach($dirs as $dir) {
|
||||||
|
$skins[] = 'theme/'.$dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$skins = array_merge($skins, get_skin_dir($skin_gubun));
|
||||||
|
|
||||||
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
|
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
|
||||||
for ($i=0; $i<count($skins); $i++) {
|
for ($i=0; $i<count($skins); $i++) {
|
||||||
if ($i == 0) $str .= "<option value=\"\">선택</option>";
|
if ($i == 0) $str .= "<option value=\"\">선택</option>";
|
||||||
$str .= option_selected($skins[$i], $selected);
|
if(preg_match('#^theme/(.+)$#', $skins[$i], $match))
|
||||||
|
$text = '(테마) '.$match[1];
|
||||||
|
else
|
||||||
|
$text = $skins[$i];
|
||||||
|
|
||||||
|
$str .= option_selected($skins[$i], $selected, $text);
|
||||||
}
|
}
|
||||||
$str .= "</select>";
|
$str .= "</select>";
|
||||||
return $str;
|
return $str;
|
||||||
@@ -25,11 +44,30 @@ function get_skin_select($skin_gubun, $id, $name, $selected='', $event='')
|
|||||||
// 모바일 스킨디렉토리를 SELECT 형식으로 얻음
|
// 모바일 스킨디렉토리를 SELECT 형식으로 얻음
|
||||||
function get_mobile_skin_select($skin_gubun, $id, $name, $selected='', $event='')
|
function get_mobile_skin_select($skin_gubun, $id, $name, $selected='', $event='')
|
||||||
{
|
{
|
||||||
$skins = get_skin_dir($skin_gubun, G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
global $config;
|
||||||
|
|
||||||
|
$skins = array();
|
||||||
|
|
||||||
|
if(defined('G5_THEME_PATH') && $config['cf_theme']) {
|
||||||
|
$dirs = get_skin_dir($skin_gubun, G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
||||||
|
if(!empty($dirs)) {
|
||||||
|
foreach($dirs as $dir) {
|
||||||
|
$skins[] = 'theme/'.$dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$skins = array_merge($skins, get_skin_dir($skin_gubun, G5_MOBILE_PATH.'/'.G5_SKIN_DIR));
|
||||||
|
|
||||||
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
|
$str = "<select id=\"$id\" name=\"$name\" $event>\n";
|
||||||
for ($i=0; $i<count($skins); $i++) {
|
for ($i=0; $i<count($skins); $i++) {
|
||||||
if ($i == 0) $str .= "<option value=\"\">선택</option>";
|
if ($i == 0) $str .= "<option value=\"\">선택</option>";
|
||||||
$str .= option_selected($skins[$i], $selected);
|
if(preg_match('#^theme/(.+)$#', $skins[$i], $match))
|
||||||
|
$text = '(테마) '.$match[1];
|
||||||
|
else
|
||||||
|
$text = $skins[$i];
|
||||||
|
|
||||||
|
$str .= option_selected($skins[$i], $selected, $text);
|
||||||
}
|
}
|
||||||
$str .= "</select>";
|
$str .= "</select>";
|
||||||
return $str;
|
return $str;
|
||||||
@@ -44,6 +82,9 @@ function get_skin_dir($skin, $skin_path=G5_SKIN_PATH)
|
|||||||
$result_array = array();
|
$result_array = array();
|
||||||
|
|
||||||
$dirname = $skin_path.'/'.$skin.'/';
|
$dirname = $skin_path.'/'.$skin.'/';
|
||||||
|
if(!is_dir($dirname))
|
||||||
|
return;
|
||||||
|
|
||||||
$handle = opendir($dirname);
|
$handle = opendir($dirname);
|
||||||
while ($file = readdir($handle)) {
|
while ($file = readdir($handle)) {
|
||||||
if($file == '.'||$file == '..') continue;
|
if($file == '.'||$file == '..') continue;
|
||||||
@@ -57,6 +98,101 @@ function get_skin_dir($skin, $skin_path=G5_SKIN_PATH)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 테마
|
||||||
|
function get_theme_dir()
|
||||||
|
{
|
||||||
|
$result_array = array();
|
||||||
|
|
||||||
|
$dirname = G5_PATH.'/'.G5_THEME_DIR.'/';
|
||||||
|
$handle = opendir($dirname);
|
||||||
|
while ($file = readdir($handle)) {
|
||||||
|
if($file == '.'||$file == '..') continue;
|
||||||
|
|
||||||
|
if (is_dir($dirname.$file)) {
|
||||||
|
$theme_path = $dirname.$file;
|
||||||
|
if(is_file($theme_path.'/index.php') && is_file($theme_path.'/head.php') && is_file($theme_path.'/tail.php'))
|
||||||
|
$result_array[] = $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
closedir($handle);
|
||||||
|
natsort($result_array);
|
||||||
|
|
||||||
|
return $result_array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 테마정보
|
||||||
|
function get_theme_info($dir)
|
||||||
|
{
|
||||||
|
$info = array();
|
||||||
|
$path = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir;
|
||||||
|
|
||||||
|
if(is_dir($path)) {
|
||||||
|
$screenshot = $path.'/screenshot.png';
|
||||||
|
if(is_file($screenshot)) {
|
||||||
|
$size = @getimagesize($screenshot);
|
||||||
|
|
||||||
|
if($size[2] == 3)
|
||||||
|
$screenshot_url = str_replace(G5_PATH, G5_URL, $screenshot);
|
||||||
|
}
|
||||||
|
|
||||||
|
$info['screenshot'] = $screenshot_url;
|
||||||
|
|
||||||
|
$text = $path.'/readme.txt';
|
||||||
|
if(is_file($text)) {
|
||||||
|
$content = file($text, false);
|
||||||
|
$content = array_map('trim', $content);
|
||||||
|
|
||||||
|
preg_match('#^Theme Name:(.+)$#i', $content[0], $m0);
|
||||||
|
preg_match('#^Theme URI:(.+)$#i', $content[1], $m1);
|
||||||
|
preg_match('#^Maker:(.+)$#i', $content[2], $m2);
|
||||||
|
preg_match('#^Maker URI:(.+)$#i', $content[3], $m3);
|
||||||
|
preg_match('#^Version:(.+)$#i', $content[4], $m4);
|
||||||
|
preg_match('#^Detail:(.+)$#i', $content[5], $m5);
|
||||||
|
preg_match('#^License:(.+)$#i', $content[6], $m6);
|
||||||
|
preg_match('#^License URI:(.+)$#i', $content[7], $m7);
|
||||||
|
|
||||||
|
$info['theme_name'] = trim($m0[1]);
|
||||||
|
$info['theme_uri'] = trim($m1[1]);
|
||||||
|
$info['maker'] = trim($m2[1]);
|
||||||
|
$info['maker_uri'] = trim($m3[1]);
|
||||||
|
$info['version'] = trim($m4[1]);
|
||||||
|
$info['detail'] = trim($m5[1]);
|
||||||
|
$info['license'] = trim($m6[1]);
|
||||||
|
$info['license_uri'] = trim($m7[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$info['theme_name'])
|
||||||
|
$info['theme_name'] = $dir;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $info;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 테마설정 정보
|
||||||
|
function get_theme_config_value($dir, $key='*')
|
||||||
|
{
|
||||||
|
$tconfig = array();
|
||||||
|
|
||||||
|
$theme_config_file = G5_PATH.'/'.G5_THEME_DIR.'/'.$dir.'/theme.config.php';
|
||||||
|
if(is_file) {
|
||||||
|
include($theme_config_file);
|
||||||
|
|
||||||
|
if($key == '*') {
|
||||||
|
$tconfig = $theme_config;
|
||||||
|
} else {
|
||||||
|
$keys = array_map('trim', explode(',', $key));
|
||||||
|
foreach($keys as $v) {
|
||||||
|
$tconfig[$v] = trim($theme_config[$v]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $tconfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// 회원권한을 SELECT 형식으로 얻음
|
// 회원권한을 SELECT 형식으로 얻음
|
||||||
function get_member_level_select($name, $start_id=0, $end_id=10, $selected="", $event="")
|
function get_member_level_select($name, $start_id=0, $end_id=10, $selected="", $event="")
|
||||||
{
|
{
|
||||||
@@ -95,26 +231,48 @@ function get_member_id_select($name, $level, $selected="", $event="")
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 권한 검사
|
// 권한 검사
|
||||||
function auth_check($auth, $attr)
|
function auth_check($auth, $attr, $return=false)
|
||||||
{
|
{
|
||||||
global $is_admin;
|
global $is_admin;
|
||||||
|
|
||||||
if ($is_admin == 'super') return;
|
if ($is_admin == 'super') return;
|
||||||
|
|
||||||
if (!trim($auth))
|
if (!trim($auth)) {
|
||||||
alert('이 메뉴에는 접근 권한이 없습니다.\\n\\n접근 권한은 최고관리자만 부여할 수 있습니다.');
|
$msg = '이 메뉴에는 접근 권한이 없습니다.\\n\\n접근 권한은 최고관리자만 부여할 수 있습니다.';
|
||||||
|
if($return)
|
||||||
|
return $msg;
|
||||||
|
else
|
||||||
|
alert($msg);
|
||||||
|
}
|
||||||
|
|
||||||
$attr = strtolower($attr);
|
$attr = strtolower($attr);
|
||||||
|
|
||||||
if (!strstr($auth, $attr)) {
|
if (!strstr($auth, $attr)) {
|
||||||
if ($attr == 'r')
|
if ($attr == 'r') {
|
||||||
alert('읽을 권한이 없습니다.');
|
$msg = '읽을 권한이 없습니다.';
|
||||||
else if ($attr == 'w')
|
if($return)
|
||||||
alert('입력, 추가, 생성, 수정 권한이 없습니다.');
|
return $msg;
|
||||||
else if ($attr == 'd')
|
else
|
||||||
alert('삭제 권한이 없습니다.');
|
alert($msg);
|
||||||
else
|
} else if ($attr == 'w') {
|
||||||
alert('속성이 잘못 되었습니다.');
|
$msg = '입력, 추가, 생성, 수정 권한이 없습니다.';
|
||||||
|
if($return)
|
||||||
|
return $msg;
|
||||||
|
else
|
||||||
|
alert($msg);
|
||||||
|
} else if ($attr == 'd') {
|
||||||
|
$msg = '삭제 권한이 없습니다.';
|
||||||
|
if($return)
|
||||||
|
return $msg;
|
||||||
|
else
|
||||||
|
alert($msg);
|
||||||
|
} else {
|
||||||
|
$msg = '속성이 잘못 되었습니다.';
|
||||||
|
if($return)
|
||||||
|
return $msg;
|
||||||
|
else
|
||||||
|
alert($msg);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ $menu['menu100'] = array (
|
|||||||
array('100000', '환경설정', G5_ADMIN_URL.'/config_form.php', 'config'),
|
array('100000', '환경설정', G5_ADMIN_URL.'/config_form.php', 'config'),
|
||||||
array('', '기본환경설정', G5_ADMIN_URL.'/config_form.php', 'cf_basic'),
|
array('', '기본환경설정', G5_ADMIN_URL.'/config_form.php', 'cf_basic'),
|
||||||
array('', '관리권한설정', G5_ADMIN_URL.'/auth_list.php', 'cf_auth'),
|
array('', '관리권한설정', G5_ADMIN_URL.'/auth_list.php', 'cf_auth'),
|
||||||
|
array('', '테마설정', G5_ADMIN_URL.'/theme.php', 'cf_theme', 1),
|
||||||
array('', '메뉴설정', G5_ADMIN_URL.'/menu_list.php', 'cf_menu', 1),
|
array('', '메뉴설정', G5_ADMIN_URL.'/menu_list.php', 'cf_menu', 1),
|
||||||
array('100300', '메일 테스트', G5_ADMIN_URL.'/sendmail_test.php', 'cf_mailtest'),
|
array('100300', '메일 테스트', G5_ADMIN_URL.'/sendmail_test.php', 'cf_mailtest'),
|
||||||
array('100310', '팝업레이어관리', G5_ADMIN_URL.'/newwinlist.php', 'scf_poplayer'),
|
array('100310', '팝업레이어관리', G5_ADMIN_URL.'/newwinlist.php', 'scf_poplayer'),
|
||||||
|
|||||||
@@ -8,5 +8,6 @@ $menu['menu300'] = array (
|
|||||||
array('300500', '1:1문의설정', ''.G5_ADMIN_URL.'/qa_config.php', 'qa'),
|
array('300500', '1:1문의설정', ''.G5_ADMIN_URL.'/qa_config.php', 'qa'),
|
||||||
array('300600', '내용관리', G5_ADMIN_URL.'/contentlist.php', 'scf_contents', 1),
|
array('300600', '내용관리', G5_ADMIN_URL.'/contentlist.php', 'scf_contents', 1),
|
||||||
array('300700', 'FAQ관리', G5_ADMIN_URL.'/faqmasterlist.php', 'scf_faq', 1),
|
array('300700', 'FAQ관리', G5_ADMIN_URL.'/faqmasterlist.php', 'scf_faq', 1),
|
||||||
|
array('300820', '글,댓글 현황', G5_ADMIN_URL.'/write_count.php', 'scf_write_count'),
|
||||||
);
|
);
|
||||||
?>
|
?>
|
||||||
+34
-4
@@ -153,10 +153,9 @@ $pg_anchor = '<ul class="anchor">
|
|||||||
$frm_submit = '<div class="btn_confirm01 btn_confirm">
|
$frm_submit = '<div class="btn_confirm01 btn_confirm">
|
||||||
<input type="submit" value="확인" class="btn_submit" accesskey="s">
|
<input type="submit" value="확인" class="btn_submit" accesskey="s">
|
||||||
<a href="./board_list.php?'.$qstr.'">목록</a>'.PHP_EOL;
|
<a href="./board_list.php?'.$qstr.'">목록</a>'.PHP_EOL;
|
||||||
if ($w == 'u') $frm_submit .= ' <a href="./board_copy.php?bo_table='.$bo_table.'" id="board_copy" target="win_board_copy">게시판복사</a>
|
if ($w == 'u') $frm_submit .= '<a href="./board_copy.php?bo_table='.$bo_table.'" id="board_copy" target="win_board_copy">게시판복사</a>
|
||||||
<a href="'.G5_BBS_URL.'/board.php?bo_table='.$board['bo_table'].'" class="btn_frmline">게시판 바로가기</a>
|
<a href="'.G5_BBS_URL.'/board.php?bo_table='.$board['bo_table'].'" class="btn_frmline">게시판 바로가기</a>
|
||||||
<a href="./board_thumbnail_delete.php?bo_table='.$board['bo_table'].'&'.$qstr.'" onclick="return delete_confirm2(\'게시판 썸네일 파일을 삭제하시겠습니까?\');">게시판 썸네일 삭제</a>
|
<a href="./board_thumbnail_delete.php?bo_table='.$board['bo_table'].'&'.$qstr.'" onclick="return delete_confirm2(\'게시판 썸네일 파일을 삭제하시겠습니까?\');">게시판 썸네일 삭제</a>'.PHP_EOL;
|
||||||
'.PHP_EOL;
|
|
||||||
$frm_submit .= '</div>';
|
$frm_submit .= '</div>';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
@@ -1118,7 +1117,7 @@ $frm_submit .= '</div>';
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<?php echo $frm_submit; ?>
|
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_galc">테마 이미지설정 가져오기</button></div>', $frm_submit); ?>
|
||||||
|
|
||||||
<section id="anc_bo_point">
|
<section id="anc_bo_point">
|
||||||
<h2 class="h2_frm">게시판 포인트 설정</h2>
|
<h2 class="h2_frm">게시판 포인트 설정</h2>
|
||||||
@@ -1240,6 +1239,37 @@ $(function(){
|
|||||||
window.open(this.href, "win_board_copy", "left=10,top=10,width=500,height=400");
|
window.open(this.href, "win_board_copy", "left=10,top=10,width=500,height=400");
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".get_theme_galc").on("click", function() {
|
||||||
|
if(!confirm("현재 테마의 게시판 이미지 설정을 적용하시겠습니까?"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "./theme_config_load.php",
|
||||||
|
cache: false,
|
||||||
|
async: false,
|
||||||
|
data: { type: "board" },
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if(data.error) {
|
||||||
|
alert(data.error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var field = Array('bo_gallery_cols', 'bo_gallery_width', 'bo_gallery_height', 'bo_mobile_gallery_width', 'bo_mobile_gallery_height', 'bo_image_width');
|
||||||
|
var count = field.length;
|
||||||
|
var key;
|
||||||
|
|
||||||
|
for(i=0; i<count; i++) {
|
||||||
|
key = field[i];
|
||||||
|
|
||||||
|
if(data[key] != undefined && data[key] != "")
|
||||||
|
$("input[name="+key+"]").val(data[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function board_copy(bo_table) {
|
function board_copy(bo_table) {
|
||||||
|
|||||||
+51
-119
@@ -9,12 +9,9 @@ $token = get_token();
|
|||||||
if ($is_admin != 'super')
|
if ($is_admin != 'super')
|
||||||
alert('최고관리자만 접근 가능합니다.');
|
alert('최고관리자만 접근 가능합니다.');
|
||||||
|
|
||||||
if (!isset($config['cf_include_index'])) {
|
if (!isset($config['cf_add_script'])) {
|
||||||
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
||||||
ADD `cf_include_index` VARCHAR(255) NOT NULL AFTER `cf_admin`,
|
ADD `cf_add_script` TEXT NOT NULL AFTER `cf_admin_email_name` ", true);
|
||||||
ADD `cf_include_head` VARCHAR(255) NOT NULL AFTER `cf_include_index`,
|
|
||||||
ADD `cf_include_tail` VARCHAR(255) NOT NULL AFTER `cf_include_head`,
|
|
||||||
ADD `cf_add_script` TEXT NOT NULL AFTER `cf_include_tail` ", true);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($config['cf_mobile_new_skin'])) {
|
if (!isset($config['cf_mobile_new_skin'])) {
|
||||||
@@ -212,7 +209,7 @@ $frm_submit = '<div class="btn_confirm01 btn_confirm">
|
|||||||
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
|
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
|
||||||
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
|
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
|
||||||
|
|
||||||
if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw']) {
|
||||||
$userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
|
$userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
@@ -341,105 +338,41 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="cf_new_skin">최근게시물 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_new_skin">최근게시물 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_new_skin" id="cf_new_skin" required class="required">
|
<?php echo get_skin_select('new', 'cf_new_skin', 'cf_new_skin', $config['cf_new_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('new');
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_new_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
<th scope="row"><label for="cf_mobile_new_skin">모바일<br>최근게시물 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_mobile_new_skin">모바일<br>최근게시물 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_mobile_new_skin" id="cf_mobile_new_skin" required class="required">
|
<?php echo get_mobile_skin_select('new', 'cf_mobile_new_skin', 'cf_mobile_new_skin', $config['cf_mobile_new_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('new', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_new_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="cf_search_skin">검색 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_search_skin">검색 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_search_skin" id="cf_search_skin" required class="required">
|
<?php echo get_skin_select('search', 'cf_search_skin', 'cf_search_skin', $config['cf_search_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('search');
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_search_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
<th scope="row"><label for="cf_mobile_search_skin">모바일 검색 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_mobile_search_skin">모바일 검색 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_mobile_search_skin" id="cf_mobile_search_skin" required class="required">
|
<?php echo get_mobile_skin_select('search', 'cf_mobile_search_skin', 'cf_mobile_search_skin', $config['cf_mobile_search_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('search', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_search_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="cf_connect_skin">접속자 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_connect_skin">접속자 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_connect_skin" id="cf_connect_skin" required class="required">
|
<?php echo get_skin_select('connect', 'cf_connect_skin', 'cf_connect_skin', $config['cf_connect_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('connect');
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_connect_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
<th scope="row"><label for="cf_mobile_connect_skin">모바일 접속자 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_mobile_connect_skin">모바일 접속자 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_mobile_connect_skin" id="cf_mobile_connect_skin" required class="required">
|
<?php echo get_mobile_skin_select('connect', 'cf_mobile_connect_skin', 'cf_mobile_connect_skin', $config['cf_mobile_connect_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('connect', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_connect_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="cf_faq_skin">FAQ 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_faq_skin">FAQ 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_faq_skin" id="cf_faq_skin" required class="required">
|
<?php echo get_skin_select('faq', 'cf_faq_skin', 'cf_faq_skin', $config['cf_faq_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('faq');
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_faq_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
<th scope="row"><label for="cf_mobile_faq_skin">모바일 FAQ 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_mobile_faq_skin">모바일 FAQ 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_mobile_faq_skin" id="cf_mobile_faq_skin" required class="required">
|
<?php echo get_mobile_skin_select('faq', 'cf_mobile_faq_skin', 'cf_mobile_faq_skin', $config['cf_mobile_faq_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('faq', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo "<option value=\"".$arr[$i]."\"".get_selected($config['cf_mobile_faq_skin'], $arr[$i]).">".$arr[$i]."</option>\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -532,7 +465,7 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<?php echo $frm_submit; ?>
|
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_confc" data-type="conf_skin">테마 스킨설정 가져오기</button></div>', $frm_submit); ?>
|
||||||
|
|
||||||
<section id="anc_cf_board">
|
<section id="anc_cf_board">
|
||||||
<h2 class="h2_frm">게시판 기본 설정</h2>
|
<h2 class="h2_frm">게시판 기본 설정</h2>
|
||||||
@@ -636,27 +569,11 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
|||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="cf_member_skin">회원 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_member_skin">회원 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_member_skin" id="cf_member_skin" required class="required">
|
<?php echo get_skin_select('member', 'cf_member_skin', 'cf_member_skin', $config['cf_member_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('member');
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo '<option value="'.$arr[$i].'"'.get_selected($config['cf_member_skin'], $arr[$i]).'>'.$arr[$i].'</option>'."\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
<th scope="row"><label for="cf_mobile_member_skin">모바일<br>회원 스킨<strong class="sound_only">필수</strong></label></th>
|
<th scope="row"><label for="cf_mobile_member_skin">모바일<br>회원 스킨<strong class="sound_only">필수</strong></label></th>
|
||||||
<td>
|
<td>
|
||||||
<select name="cf_mobile_member_skin" id="cf_mobile_member_skin" required class="required">
|
<?php echo get_mobile_skin_select('member', 'cf_mobile_member_skin', 'cf_mobile_member_skin', $config['cf_mobile_member_skin'], 'required'); ?>
|
||||||
<?php
|
|
||||||
$arr = get_skin_dir('member', G5_MOBILE_PATH.'/'.G5_SKIN_DIR);
|
|
||||||
for ($i=0; $i<count($arr); $i++) {
|
|
||||||
if ($i == 0) echo "<option value=\"\">선택</option>";
|
|
||||||
echo '<option value="'.$arr[$i].'"'.get_selected($config['cf_mobile_member_skin'], $arr[$i]).'>'.$arr[$i].'</option>'."\n";
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</select>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -761,7 +678,7 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<?php echo $frm_submit; ?>
|
<?php echo preg_replace('#</div>$#i', '<button type="button" class="get_theme_confc" data-type="conf_member">테마 회원스킨설정 가져오기</button></div>', $frm_submit); ?>
|
||||||
|
|
||||||
<section id="anc_cf_cert">
|
<section id="anc_cf_cert">
|
||||||
<h2 class="h2_frm">본인확인 설정</h2>
|
<h2 class="h2_frm">본인확인 설정</h2>
|
||||||
@@ -1082,27 +999,6 @@ if ($config['cf_icode_id'] && $config['cf_icode_pw']) {
|
|||||||
<col>
|
<col>
|
||||||
</colgroup>
|
</colgroup>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
|
||||||
<th scope="row"><label for="cf_include_index">초기화면 파일 경로</label></th>
|
|
||||||
<td>
|
|
||||||
<?php echo help('입력이 없으면 index.php가 초기화면 파일로 설정됩니다.<br>초기화면 파일은 index.php 파일과 동일한 위치에 존재해야 합니다.') ?>
|
|
||||||
<input type="text" name="cf_include_index" value="<?php echo $config['cf_include_index'] ?>" id="cf_include_index" class="frm_input" size="50">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row"><label for="cf_include_head">상단 파일 경로</label></th>
|
|
||||||
<td>
|
|
||||||
<?php echo help('입력이 없으면 head.php가 상단 파일로 설정됩니다.<br>상단 파일은 head.php 파일과 동일한 위치에 존재해야 합니다.') ?>
|
|
||||||
<input type="text" name="cf_include_head" value="<?php echo $config['cf_include_head'] ?>" id="cf_include_head" class="frm_input" size="50">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<th scope="row"><label for="cf_include_tail">하단 파일 경로</label></th>
|
|
||||||
<td>
|
|
||||||
<?php echo help('입력이 없으면 tail.php가 하단 파일로 설정됩니다.<br>초기화면 파일은 tail.php 파일과 동일한 위치에 존재해야 합니다.') ?>
|
|
||||||
<input type="text" name="cf_include_tail" value="<?php echo $config['cf_include_tail'] ?>" id="cf_include_tail" class="frm_input" size="50">
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><label for="cf_add_script">추가 script, css</label></th>
|
<th scope="row"><label for="cf_add_script">추가 script, css</label></th>
|
||||||
<td>
|
<td>
|
||||||
@@ -1250,6 +1146,42 @@ $(function(){
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$(".get_theme_confc").on("click", function() {
|
||||||
|
var type = $(this).data("type");
|
||||||
|
var msg = "기본환경 스킨 설정";
|
||||||
|
if(type == "conf_member")
|
||||||
|
msg = "기본환경 회원스킨 설정";
|
||||||
|
|
||||||
|
if(!confirm("현재 테마의 "+msg+"을 적용하시겠습니까?"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "./theme_config_load.php",
|
||||||
|
cache: false,
|
||||||
|
async: false,
|
||||||
|
data: { type: type },
|
||||||
|
dataType: "json",
|
||||||
|
success: function(data) {
|
||||||
|
if(data.error) {
|
||||||
|
alert(data.error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var field = Array('cf_member_skin', 'cf_mobile_member_skin', 'cf_new_skin', 'cf_mobile_new_skin', 'cf_search_skin', 'cf_mobile_search_skin', 'cf_connect_skin', 'cf_mobile_connect_skin', 'cf_faq_skin', 'cf_mobile_faq_skin');
|
||||||
|
var count = field.length;
|
||||||
|
var key;
|
||||||
|
|
||||||
|
for(i=0; i<count; i++) {
|
||||||
|
key = field[i];
|
||||||
|
|
||||||
|
if(data[key] != undefined && data[key] != "")
|
||||||
|
$("select[name="+key+"]").val(data[key]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
function fconfigform_submit(f)
|
function fconfigform_submit(f)
|
||||||
|
|||||||
@@ -29,9 +29,6 @@ $sql = " update {$g5['config_table']}
|
|||||||
cf_admin = '{$_POST['cf_admin']}',
|
cf_admin = '{$_POST['cf_admin']}',
|
||||||
cf_admin_email = '{$_POST['cf_admin_email']}',
|
cf_admin_email = '{$_POST['cf_admin_email']}',
|
||||||
cf_admin_email_name = '{$_POST['cf_admin_email_name']}',
|
cf_admin_email_name = '{$_POST['cf_admin_email_name']}',
|
||||||
cf_include_index = '{$_POST['cf_include_index']}',
|
|
||||||
cf_include_head = '{$_POST['cf_include_head']}',
|
|
||||||
cf_include_tail = '{$_POST['cf_include_tail']}',
|
|
||||||
cf_add_script = '{$_POST['cf_add_script']}',
|
cf_add_script = '{$_POST['cf_add_script']}',
|
||||||
cf_use_point = '{$_POST['cf_use_point']}',
|
cf_use_point = '{$_POST['cf_use_point']}',
|
||||||
cf_point_term = '{$_POST['cf_point_term']}',
|
cf_point_term = '{$_POST['cf_point_term']}',
|
||||||
|
|||||||
@@ -714,3 +714,48 @@ strong.sodr_nonpay {display:block;padding:5px 0;text-align:right}
|
|||||||
.sevice_2 .svc_sms .svc_btn a{display:inline-block; background:#f8f8f8;width:100%;text-align:center;margin:0;padding:10px 0 0 }
|
.sevice_2 .svc_sms .svc_btn a{display:inline-block; background:#f8f8f8;width:100%;text-align:center;margin:0;padding:10px 0 0 }
|
||||||
.sevice_2 .svc_design{overflow:hidden;height:210px;position:relative}
|
.sevice_2 .svc_design{overflow:hidden;height:210px;position:relative}
|
||||||
.sevice_2 .svc_design .svc_btn a{margin:0 0 20px}
|
.sevice_2 .svc_design .svc_btn a{margin:0 0 20px}
|
||||||
|
|
||||||
|
/*테마*/
|
||||||
|
.theme_p{padding:0 20px}
|
||||||
|
#theme_list{padding:0;margin:0 10px;list-style:none; width: 1000px;position:relative}
|
||||||
|
#theme_list:after{display:block;visibility:hidden;clear:both;content:""}
|
||||||
|
#theme_list li{padding:10px;margin:0;float:left;width:302px}
|
||||||
|
#theme_list li:after{display:block;visibility:hidden;clear:both;content:""}
|
||||||
|
#theme_list li .tmli_if{border: 1px solid #d1dee2;width:300px;}
|
||||||
|
#theme_list li .tmli_if>img{width:300px;height:225px;}
|
||||||
|
#theme_list li .tmli_if:hover>img{-ms-filter:"progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";filter: alpha(opacity=50);-moz-opacity:0.5;-khtml-opacity: 0.5;opacity: 0.5;}
|
||||||
|
#theme_list li .tmli_tit{position:relative; border-top: 1px solid #d1dee2; background: #e5ecef;}
|
||||||
|
#theme_list li .tmli_tit p{height:40px;line-height:40px;padding:0 10px 0;font-weight:bold;text-overflow: ellipsis; overflow: hidden; white-space: nowrap;}
|
||||||
|
#theme_list li .tmli_tit button.tmli_dt{position:absolute;top:8px;right:10px;padding:5px;background:#111;color:#fff;display:none;border:none}
|
||||||
|
#theme_list li .tmli_if:hover button.tmli_dt{display:block}
|
||||||
|
#theme_list li .theme_sl{float:left;border:none;margin-top:5px;padding:0 5px;height:26px;background:#999;color:#fff}
|
||||||
|
#theme_list li .theme_sl:hover{background:#ff3061}
|
||||||
|
#theme_list li .theme_deactive{margin-left:4px}
|
||||||
|
#theme_list li .theme_sl_use{background:#ff3061;line-height:26px}
|
||||||
|
#theme_list li .theme_pr{float:right;margin-top:5px;padding:0 5px;height:24px;line-height:24px; border: 1px solid #ccc; background: #fafafa; }
|
||||||
|
#theme_list li .theme_preview{ float: right; margin-top: 5px; padding:0 5px;height:26px; border: 1px solid #ccc; background: #fafafa; margin-right:3px}
|
||||||
|
|
||||||
|
#theme_detail{position:fixed;_position:absolute;top:50%;left:20px;_top:300px;width:950px;height:490px;margin-top:-245px;background:#fff;border:1px solid #000;z-index:99999;}
|
||||||
|
#theme_detail .thdt_img{padding:20px 0 20px 20px;float:left;}
|
||||||
|
#theme_detail .thdt_img img{width:600px;height:450px;}
|
||||||
|
#theme_detail .thdt_if{float:right;width:290px;padding:40px 20px 0 0;position:relative}
|
||||||
|
#theme_detail .thdt_if h2{padding:0 ;margin:0}
|
||||||
|
#theme_detail .thdt_if p{font-weight:normal;padding:10px;background:#f5f5f5;height:250px;overflow-y:auto;}
|
||||||
|
#theme_detail .thdt_if a{vertical-align:middle;}
|
||||||
|
#theme_detail .thdt_if .thdt_home{background:url(../img/link_icon.gif) no-repeat bottom right;padding-right:13px;}
|
||||||
|
#theme_detail .close_btn{position:absolute;top:10px;right:10px;background:url(../img/close.gif) no-repeat 50% 50%;border:none;width:30px;height:30px;overflow:hidden;text-indent:-9999px;}
|
||||||
|
#theme_detail table{border-collapse:collapse;margin:5px 0 10px}
|
||||||
|
#theme_detail table th{padding: 5px 0; border: 1px solid #d1dee2; background: #e5ecef;width:50px;padding:10px;text-align:left}
|
||||||
|
#theme_detail table td{ border: 1px solid #ececec;padding:10px}
|
||||||
|
.no_theme{text-align:center;padding:100px 0;color:#555}
|
||||||
|
|
||||||
|
/*글,댓글현황*/
|
||||||
|
#wr_cont{position:relative;margin:10px 20px}
|
||||||
|
#wr_cont input[type="submit"]{background:#ff3061;border:none;color:#fff;padding: 0 5px;height: 24px;}
|
||||||
|
#wr_cont select{height: 24px;}
|
||||||
|
#grp_color{border:2px solid #ddd;position:absolute;top:0;right:0;list-style:none;padding: 5px 5px; margin:0;}
|
||||||
|
#grp_color li{padding:5px 10px;}
|
||||||
|
#grp_color li span{width:10px;height:10px; display:inline-block;background:rgb(75, 178, 197);margin-right:5px;}
|
||||||
|
#grp_color li.color2 span{background:rgb(234, 162, 40);}
|
||||||
|
#chart_wr h5{text-align:center;border:1px solid #eee;padding:30px 0}
|
||||||
|
#chart_wr{margin:20px }
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
@charset "utf-8";
|
||||||
|
#preview_item{height:50px}
|
||||||
|
#preview_item ul{margin:0;padding:0;top:0;width:100%;border-bottom:1px solid #eee; margin:0 auto;text-align:center;background:#333;position:fixed;top:0;z-index:999999;width:100%;}
|
||||||
|
#preview_item ul li{list-style:none;display:inline-block;height:50px;line-height:50px;padding:0 3px;*display:inline; zoom:1;}
|
||||||
|
#preview_item ul li a{color:#555;padding:0 8px;height:24px;line-height:24px;background:#f2f2f2;border-radius:3px;display:inline-block;vertical-align:middle;border:1px solid #dcdcdc;}
|
||||||
|
#preview_item ul li a:hover{background:#ccc;text-decoration:none;border:1px solid #ccc;}
|
||||||
|
#preview_item ul li button{color:#fff;padding:0 8px;background:#FF5191;border-radius:3px;height:26px;line-height:24px;vertical-align:middle;border:none}
|
||||||
|
#preview_item ul li button:hover{background:#e40d5c;color:#fff;text-decoration:none;}
|
||||||
+1
-1
@@ -8,7 +8,7 @@ auth_check($auth[$sub_menu], "w");
|
|||||||
$sql = " select * from {$g5['faq_master_table']} where fm_id = '$fm_id' ";
|
$sql = " select * from {$g5['faq_master_table']} where fm_id = '$fm_id' ";
|
||||||
$fm = sql_fetch($sql);
|
$fm = sql_fetch($sql);
|
||||||
|
|
||||||
$html_title = 'FAQ '.$fm['fm_subject'];;
|
$html_title = 'FAQ '.$fm['fm_subject'];
|
||||||
|
|
||||||
if ($w == "u")
|
if ($w == "u")
|
||||||
{
|
{
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 200 B |
Binary file not shown.
|
After Width: | Height: | Size: 53 B |
Binary file not shown.
|
After Width: | Height: | Size: 7.8 KiB |
+2
-2
@@ -52,14 +52,14 @@ $(function() {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#add_manual").live("click", function() {
|
$(document).on("click", "#add_manual", function() {
|
||||||
var me_name = $.trim($("#me_name").val());
|
var me_name = $.trim($("#me_name").val());
|
||||||
var me_link = $.trim($("#me_link").val());
|
var me_link = $.trim($("#me_link").val());
|
||||||
|
|
||||||
add_menu_list(me_name, me_link, "<?php echo $code; ?>");
|
add_menu_list(me_name, me_link, "<?php echo $code; ?>");
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".add_select").live("click", function() {
|
$(document).on("click", ".add_select", function() {
|
||||||
var me_name = $.trim($(this).siblings("input[name='subject[]']").val());
|
var me_name = $.trim($(this).siblings("input[name='subject[]']").val());
|
||||||
var me_link = $.trim($(this).siblings("input[name='link[]']").val());
|
var me_link = $.trim($(this).siblings("input[name='link[]']").val());
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -136,12 +136,12 @@ $colspan = 7;
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
$(function() {
|
$(function() {
|
||||||
$(".btn_add_submenu").live("click", function() {
|
$(document).on("click", ".btn_add_submenu", function() {
|
||||||
var code = $(this).closest("tr").find("input[name='code[]']").val().substr(0, 2);
|
var code = $(this).closest("tr").find("input[name='code[]']").val().substr(0, 2);
|
||||||
add_submenu(code);
|
add_submenu(code);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".btn_del_menu").live("click", function() {
|
$(document).on("click", ".btn_del_menu", function() {
|
||||||
if(!confirm("메뉴를 삭제하시겠습니까?"))
|
if(!confirm("메뉴를 삭제하시겠습니까?"))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ $g5['title'] = "SMS 기본설정";
|
|||||||
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
|
if (!$config['cf_icode_server_ip']) $config['cf_icode_server_ip'] = '211.172.232.124';
|
||||||
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
|
if (!$config['cf_icode_server_port']) $config['cf_icode_server_port'] = '7295';
|
||||||
|
|
||||||
if ($config['cf_icode_id'] && $config['cf_icode_pw'])
|
if ($config['cf_sms_use'] && $config['cf_icode_id'] && $config['cf_icode_pw'])
|
||||||
{
|
{
|
||||||
$userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
|
$userinfo = get_icode_userinfo($config['cf_icode_id'], $config['cf_icode_pw']);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ if ($result)
|
|||||||
$row['bk_hp'] = get_hp($row['bk_hp'], 1);
|
$row['bk_hp'] = get_hp($row['bk_hp'], 1);
|
||||||
|
|
||||||
$log = array_shift($SMS->Log);
|
$log = array_shift($SMS->Log);
|
||||||
$log = @iconv('UTF-8', 'UTF-8//IGNORE', $log);
|
$log = @iconv('euc-kr', 'utf-8', $log);
|
||||||
|
|
||||||
sql_query("insert into {$g5['sms5_history_table']} set wr_no='$wr_no', wr_renum='$new_wr_renum', bg_no='{$row['bg_no']}', mb_id='{$row['mb_id']}', bk_no='{$row['bk_no']}', hs_name='{$row['hs_name']}', hs_hp='{$row['hs_hp']}', hs_datetime='".G5_TIME_YMDHIS."', hs_flag='$hs_flag', hs_code='$hs_code', hs_memo='".addslashes($hs_memo)."', hs_log='".addslashes($log)."'", false);
|
sql_query("insert into {$g5['sms5_history_table']} set wr_no='$wr_no', wr_renum='$new_wr_renum', bg_no='{$row['bg_no']}', mb_id='{$row['mb_id']}', bk_no='{$row['bk_no']}', hs_name='{$row['hs_name']}', hs_hp='{$row['hs_hp']}', hs_datetime='".G5_TIME_YMDHIS."', hs_flag='$hs_flag', hs_code='$hs_code', hs_memo='".addslashes($hs_memo)."', hs_log='".addslashes($log)."'", false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -202,7 +202,7 @@ if ($result)
|
|||||||
$row['bk_hp'] = get_hp($row['bk_hp'], 1);
|
$row['bk_hp'] = get_hp($row['bk_hp'], 1);
|
||||||
|
|
||||||
$log = array_shift($SMS->Log);
|
$log = array_shift($SMS->Log);
|
||||||
$log = @iconv('UTF-8', 'UTF-8//IGNORE', $log);
|
$log = @iconv('euc-kr', 'utf-8', $log);
|
||||||
|
|
||||||
sql_query("insert into {$g5['sms5_history_table']} set wr_no='$wr_no', wr_renum=0, bg_no='{$row['bg_no']}', mb_id='{$row['mb_id']}', bk_no='{$row['bk_no']}', hs_name='".addslashes($row['bk_name'])."', hs_hp='{$row['bk_hp']}', hs_datetime='".G5_TIME_YMDHIS."', hs_flag='$hs_flag', hs_code='$hs_code', hs_memo='".addslashes($hs_memo)."', hs_log='".addslashes($log)."'", false);
|
sql_query("insert into {$g5['sms5_history_table']} set wr_no='$wr_no', wr_renum=0, bg_no='{$row['bg_no']}', mb_id='{$row['mb_id']}', bk_no='{$row['bk_no']}', hs_name='".addslashes($row['bk_name'])."', hs_hp='{$row['bk_hp']}', hs_datetime='".G5_TIME_YMDHIS."', hs_flag='$hs_flag', hs_code='$hs_code', hs_memo='".addslashes($hs_memo)."', hs_log='".addslashes($log)."'", false);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
$(function() {
|
||||||
|
$(".theme_active").on("click", function() {
|
||||||
|
var theme = $(this).data("theme");
|
||||||
|
var name = $(this).data("name");
|
||||||
|
|
||||||
|
if(!confirm(name+" 테마를 적용하시겠습니까?"))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
var set_default_skin = 0;
|
||||||
|
if($(this).data("set_default_skin") == true) {
|
||||||
|
if(confirm("기본환경설정, 1:1문의 스킨을 테마에서 설정된 스킨으로 변경하시겠습니까?\n\n변경을 선택하시면 테마에서 지정된 스킨으로 회원스킨 등이 변경됩니다."))
|
||||||
|
set_default_skin = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "./theme_update.php",
|
||||||
|
data: {
|
||||||
|
"theme": theme,
|
||||||
|
"set_default_skin": set_default_skin
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
async: false,
|
||||||
|
success: function(data) {
|
||||||
|
if(data) {
|
||||||
|
alert(data);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".theme_deactive").on("click", function() {
|
||||||
|
var theme = $(this).data("theme");
|
||||||
|
var name = $(this).data("name");
|
||||||
|
|
||||||
|
if(!confirm(name+" 테마 사용설정을 해제하시겠습니까?\n\n테마 설정을 해제하셔도 게시판 등의 스킨은 변경되지 않으므로 개별 변경작업이 필요합니다."))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "./theme_update.php",
|
||||||
|
data: {
|
||||||
|
"theme": theme,
|
||||||
|
"type": "reset"
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
async: false,
|
||||||
|
success: function(data) {
|
||||||
|
if(data) {
|
||||||
|
alert(data);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
document.location.reload();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
$(".theme_preview").on("click", function() {
|
||||||
|
var theme = $(this).data("theme");
|
||||||
|
|
||||||
|
$("#theme_detail").remove();
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
type: "POST",
|
||||||
|
url: "./theme_detail.php",
|
||||||
|
data: {
|
||||||
|
"theme": theme
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
async: false,
|
||||||
|
success: function(data) {
|
||||||
|
$("#theme_list").after(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
$sub_menu = "100280";
|
||||||
|
include_once('./_common.php');
|
||||||
|
|
||||||
|
if ($is_admin != 'super')
|
||||||
|
alert('최고관리자만 접근 가능합니다.');
|
||||||
|
|
||||||
|
// 테마 필드 추가
|
||||||
|
if(!isset($config['cf_theme'])) {
|
||||||
|
sql_query(" ALTER TABLE `{$g5['config_table']}`
|
||||||
|
ADD `cf_theme` varchar(255) NOT NULL DEFAULT '' AFTER `cf_title` ", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
$theme = get_theme_dir();
|
||||||
|
if($config['cf_theme'] && in_array($config['cf_theme'], $theme))
|
||||||
|
array_unshift($theme, $config['cf_theme']);
|
||||||
|
$theme = array_values(array_unique($theme));
|
||||||
|
$total_count = count($theme);
|
||||||
|
|
||||||
|
// 설정된 테마가 존재하지 않는다면 cf_theme 초기화
|
||||||
|
if($config['cf_theme'] && !in_array($config['cf_theme'], $theme))
|
||||||
|
sql_query(" update {$g5['config_table']} set cf_theme = '' ");
|
||||||
|
|
||||||
|
$g5['title'] = "테마설정";
|
||||||
|
include_once('./admin.head.php');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<script src="<?php echo G5_ADMIN_URL; ?>/theme.js"></script>
|
||||||
|
|
||||||
|
<p class="theme_p">설치된 테마 : <?php echo number_format($total_count); ?></p>
|
||||||
|
|
||||||
|
<?php if($total_count > 0) { ?>
|
||||||
|
<ul id="theme_list">
|
||||||
|
<?php
|
||||||
|
for($i=0; $i<$total_count; $i++) {
|
||||||
|
$info = get_theme_info($theme[$i]);
|
||||||
|
|
||||||
|
$name = get_text($info['theme_name']);
|
||||||
|
if($info['screenshot'])
|
||||||
|
$screenshot = '<img src="'.$info['screenshot'].'" alt="'.$name.'">';
|
||||||
|
else
|
||||||
|
$screenshot = '<img src="'.G5_ADMIN_URL.'/img/theme_img.jpg" alt="">';
|
||||||
|
|
||||||
|
if($config['cf_theme'] == $theme[$i]) {
|
||||||
|
$btn_active = '<span class="theme_sl theme_sl_use">사용중</span><button type="button" class="theme_sl theme_deactive" data-theme="'.$theme[$i].'" '.'data-name="'.$name.'">사용안함</button>';
|
||||||
|
} else {
|
||||||
|
$tconfig = get_theme_config_value($theme[$i], 'set_default_skin');
|
||||||
|
if($tconfig['set_default_skin'])
|
||||||
|
$set_default_skin = 'true';
|
||||||
|
else
|
||||||
|
$set_default_skin = 'false';
|
||||||
|
|
||||||
|
$btn_active = '<button type="button" class="theme_sl theme_active" data-theme="'.$theme[$i].'" '.'data-name="'.$name.'" data-set_default_skin="'.$set_default_skin.'">테마적용</button>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<li>
|
||||||
|
<div class="tmli_if">
|
||||||
|
<?php echo $screenshot; ?>
|
||||||
|
<div class="tmli_tit">
|
||||||
|
<p><?php echo get_text($info['theme_name']); ?></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<?php echo $btn_active; ?>
|
||||||
|
<a href="./theme_preview.php?theme=<?php echo $theme[$i]; ?>" class="theme_pr" target="theme_preview">미리보기</a>
|
||||||
|
<button type="button" class="tmli_dt theme_preview" data-theme="<?php echo $theme[$i]; ?>">상세보기</button>
|
||||||
|
</li>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</ul>
|
||||||
|
<?php } else { ?>
|
||||||
|
<p class="no_theme">설치된 테마가 없습니다.</p>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
include_once ('./admin.tail.php');
|
||||||
|
?>
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
$sub_menu = "300100";
|
||||||
|
include_once('./_common.php');
|
||||||
|
include_once(G5_LIB_PATH.'/json.lib.php');
|
||||||
|
|
||||||
|
$data = array();
|
||||||
|
$data['error'] = '';
|
||||||
|
|
||||||
|
$data['error'] = auth_check($auth[$sub_menu], 'w', true);
|
||||||
|
if($data['error'])
|
||||||
|
die(json_encode($data));
|
||||||
|
|
||||||
|
if(!$config['cf_theme']) {
|
||||||
|
$data['error'] = '사용 중인 테마가 없습니다.';
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
$theme_dir = get_theme_dir();
|
||||||
|
if(!in_array($config['cf_theme'], $theme_dir)) {
|
||||||
|
$data['error'] = $config['cf_theme'].' 테마는 설치된 테마가 아닙니다.';
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = $_POST['type'];
|
||||||
|
$arr_type = array('board', 'conf_skin', 'conf_member');
|
||||||
|
if(!in_array($type, $arr_type)) {
|
||||||
|
$data['error'] = '올바른 방법으로 이용해 주십시오.';
|
||||||
|
die(json_encode($data));
|
||||||
|
}
|
||||||
|
|
||||||
|
if($type == 'board') {
|
||||||
|
$keys = array('bo_gallery_cols', 'bo_gallery_width', 'bo_gallery_height', 'bo_mobile_gallery_width', 'bo_mobile_gallery_height', 'bo_image_width');
|
||||||
|
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach($keys as $val) {
|
||||||
|
if($tconfig[$val]) {
|
||||||
|
$data[$val] = (int)preg_replace('#[^0-9]#', '', $tconfig[$val]);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($i == 0)
|
||||||
|
$data['error'] = '적용할 게시판 이미지 설정이 없습니다.';
|
||||||
|
} else if($type == 'conf_skin') {
|
||||||
|
$keys = array('cf_new_skin', 'cf_mobile_new_skin', 'cf_search_skin', 'cf_mobile_search_skin', 'cf_connect_skin', 'cf_mobile_connect_skin', 'cf_faq_skin', 'cf_mobile_faq_skin');
|
||||||
|
|
||||||
|
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach($keys as $val) {
|
||||||
|
if($tconfig[$val]) {
|
||||||
|
$data[$val] = preg_match('#^theme/.+$#', $tconfig[$val]) ? $tconfig[$val] : 'theme/'.$tconfig[$val];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($i == 0)
|
||||||
|
$data['error'] = '적용할 기본환경 스킨 설정이 없습니다.';
|
||||||
|
} else if($type == 'conf_member') {
|
||||||
|
$keys = array('cf_member_skin', 'cf_mobile_member_skin');
|
||||||
|
|
||||||
|
$tconfig = get_theme_config_value($config['cf_theme'], implode(',', $keys));
|
||||||
|
|
||||||
|
$i = 0;
|
||||||
|
foreach($keys as $val) {
|
||||||
|
if($tconfig[$val]) {
|
||||||
|
$data[$val] = preg_match('#^theme/.+$#', $tconfig[$val]) ? $tconfig[$val] : 'theme/'.$tconfig[$val];
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if($i == 0)
|
||||||
|
$data['error'] = '적용할 기본환경 회원스킨 설정이 없습니다.';
|
||||||
|
}
|
||||||
|
|
||||||
|
die(json_encode($data));
|
||||||
|
?>
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
<?php
|
||||||
|
$sub_menu = "100280";
|
||||||
|
include_once('./_common.php');
|
||||||
|
|
||||||
|
if ($is_admin != 'super')
|
||||||
|
die('최고관리자만 접근 가능합니다.');
|
||||||
|
|
||||||
|
$theme = trim($_POST['theme']);
|
||||||
|
$theme_dir = get_theme_dir();
|
||||||
|
|
||||||
|
if(!in_array($theme, $theme_dir))
|
||||||
|
die('선택하신 테마가 설치되어 있지 않습니다.');
|
||||||
|
|
||||||
|
$info = get_theme_info($theme);
|
||||||
|
|
||||||
|
if($info['screenshot'])
|
||||||
|
$screenshot = '<img src="'.$info['screenshot'].'" alt="'.$name.'">';
|
||||||
|
else
|
||||||
|
$screenshot = '<img src="'.G5_ADMIN_URL.'/img/theme_img.jpg" alt="">';
|
||||||
|
|
||||||
|
$name = get_text($info['theme_name']);
|
||||||
|
if($info['theme_uri']) {
|
||||||
|
$name = '<a href="'.set_http($info['theme_uri']).'" target="_blank" class="thdt_home">'.$name.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$maker = get_text($info['maker']);
|
||||||
|
if($info['maker_uri']) {
|
||||||
|
$maker = '<a href="'.set_http($info['maker_uri']).'" target="_blank" class="thdt_home">'.$maker.'</a>';
|
||||||
|
}
|
||||||
|
|
||||||
|
$license = get_text($info['license']);
|
||||||
|
if($info['license_uri']) {
|
||||||
|
$license = '<a href="'.set_http($info['license_uri']).'" target="_blank" class="thdt_home">'.$license.'</a>';
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div id="theme_detail">
|
||||||
|
<div class="thdt_img"><?php echo $screenshot; ?></div>
|
||||||
|
<div class="thdt_if">
|
||||||
|
<h2><?php echo $name; ?></h2>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Version</th>
|
||||||
|
<td><?php echo get_text($info['version']); ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">Maker</th>
|
||||||
|
<td><?php echo $maker; ?></td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">License</th>
|
||||||
|
<td><?php echo $license; ?></td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<p><?php echo get_text($info['detail']); ?></p>
|
||||||
|
<button type="button" class="close_btn">닫기</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(".close_btn").on("click", function() {
|
||||||
|
$("#theme_detail").remove();
|
||||||
|
});
|
||||||
|
</script>
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
<?php
|
||||||
|
$sub_menu = "100280";
|
||||||
|
define('_THEME_PREVIEW_', true);
|
||||||
|
include_once('./_common.php');
|
||||||
|
|
||||||
|
$theme_dir = get_theme_dir();
|
||||||
|
|
||||||
|
if(!$theme || !in_array($theme, $theme_dir))
|
||||||
|
alert_close('테마가 존재하지 않거나 올바르지 않습니다.');
|
||||||
|
|
||||||
|
$info = get_theme_info($theme);
|
||||||
|
|
||||||
|
$arr_mode = array('index', 'list', 'view');
|
||||||
|
$mode = substr(strip_tags($_GET['mode']), 0, 20);
|
||||||
|
if(!in_array($mode, $arr_mode))
|
||||||
|
$mode = 'index';
|
||||||
|
|
||||||
|
$qstr_index = '&mode=index';
|
||||||
|
$qstr_list = '&mode=list';
|
||||||
|
$qstr_view = '&mode=view';
|
||||||
|
$qstr_device = '&mode='.$mode.'&device='.(G5_IS_MOBILE ? 'pc' : 'mobile');
|
||||||
|
|
||||||
|
$sql = " select bo_table, wr_parent from {$g5['board_new_table']} order by bn_id desc limit 1 ";
|
||||||
|
$row = sql_fetch($sql);
|
||||||
|
$bo_table = $row['bo_table'];
|
||||||
|
$board = sql_fetch(" select * from {$g5['board_table']} where bo_table = '$bo_table' ");
|
||||||
|
$write_table = $g5['write_prefix'] . $bo_table;
|
||||||
|
|
||||||
|
// theme.config.php 미리보기 게시판 스킨이 설정돼 있다면
|
||||||
|
$tconfig = get_theme_config_value($theme, 'set_default_skin, preview_board_skin, preview_mobile_board_skin');
|
||||||
|
if($mode == 'list' || $mode == 'view') {
|
||||||
|
if($tconfig['preview_board_skin'])
|
||||||
|
$board['bo_skin'] = preg_match('#^theme/.+$#', $tconfig['preview_board_skin']) ? $tconfig['preview_board_skin'] : 'theme/'.$tconfig['preview_board_skin'];
|
||||||
|
|
||||||
|
if($tconfig['preview_mobile_board_skin'])
|
||||||
|
$board['bo_mobile_skin'] = preg_match('#^theme/.+$#', $tconfig['preview_mobile_board_skin']) ? $tconfig['preview_mobile_board_skin'] : 'theme/'.$tconfig['preview_mobile_board_skin'];
|
||||||
|
}
|
||||||
|
|
||||||
|
// 스킨경로
|
||||||
|
if (G5_IS_MOBILE) {
|
||||||
|
$board_skin_path = get_skin_path('board', $board['bo_mobile_skin']);
|
||||||
|
$board_skin_url = get_skin_url('board', $board['bo_mobile_skin']);
|
||||||
|
$member_skin_path = get_skin_path('member', $config['cf_mobile_member_skin']);
|
||||||
|
$member_skin_url = get_skin_url('member', $config['cf_mobile_member_skin']);
|
||||||
|
$new_skin_path = get_skin_path('new', $config['cf_mobile_new_skin']);
|
||||||
|
$new_skin_url = get_skin_url('new', $config['cf_mobile_new_skin']);
|
||||||
|
$search_skin_path = get_skin_path('search', $config['cf_mobile_search_skin']);
|
||||||
|
$search_skin_url = get_skin_url('search', $config['cf_mobile_search_skin']);
|
||||||
|
$connect_skin_path = get_skin_path('connect', $config['cf_mobile_connect_skin']);
|
||||||
|
$connect_skin_url = get_skin_url('connect', $config['cf_mobile_connect_skin']);
|
||||||
|
$faq_skin_path = get_skin_path('faq', $config['cf_mobile_faq_skin']);
|
||||||
|
$faq_skin_url = get_skin_url('faq', $config['cf_mobile_faq_skin']);
|
||||||
|
} else {
|
||||||
|
$board_skin_path = get_skin_path('board', $board['bo_skin']);
|
||||||
|
$board_skin_url = get_skin_url('board', $board['bo_skin']);
|
||||||
|
$member_skin_path = get_skin_path('member', $config['cf_member_skin']);
|
||||||
|
$member_skin_url = get_skin_url('member', $config['cf_member_skin']);
|
||||||
|
$new_skin_path = get_skin_path('new', $config['cf_new_skin']);
|
||||||
|
$new_skin_url = get_skin_url('new', $config['cf_new_skin']);
|
||||||
|
$search_skin_path = get_skin_path('search', $config['cf_search_skin']);
|
||||||
|
$search_skin_url = get_skin_url('search', $config['cf_search_skin']);
|
||||||
|
$connect_skin_path = get_skin_path('connect', $config['cf_connect_skin']);
|
||||||
|
$connect_skin_url = get_skin_url('connect', $config['cf_connect_skin']);
|
||||||
|
$faq_skin_path = get_skin_path('faq', $config['cf_faq_skin']);
|
||||||
|
$faq_skin_url = get_skin_url('faq', $config['cf_faq_skin']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$conf = sql_fetch(" select cf_theme from {$g5['config_table']} ");
|
||||||
|
$name = get_text($info['theme_name']);
|
||||||
|
if($conf['cf_theme'] != $theme) {
|
||||||
|
if($tconfig['set_default_skin'])
|
||||||
|
$set_default_skin = 'true';
|
||||||
|
else
|
||||||
|
$set_default_skin = 'false';
|
||||||
|
|
||||||
|
$btn_active = '<li><button type="button" class="theme_sl theme_active" data-theme="'.$theme.'" '.'data-name="'.$name.'" data-set_default_skin="'.$set_default_skin.'">테마적용</button></li>';
|
||||||
|
} else {
|
||||||
|
$btn_active = '';
|
||||||
|
}
|
||||||
|
|
||||||
|
$g5['title'] = get_text($info['theme_name']).' 테마 미리보기';
|
||||||
|
require_once(G5_PATH.'/head.sub.php');
|
||||||
|
?>
|
||||||
|
|
||||||
|
<link rel="stylesheet" href="<?php echo G5_ADMIN_URL; ?>/css/theme.css">
|
||||||
|
<script src="<?php echo G5_ADMIN_URL; ?>/theme.js"></script>
|
||||||
|
|
||||||
|
<section id="preview_item">
|
||||||
|
<ul>
|
||||||
|
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_index; ?>">인덱스 화면</a></li>
|
||||||
|
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_list; ?>">게시글 리스트</a></li>
|
||||||
|
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_view; ?>">게시글 보기</a></li>
|
||||||
|
<li><a href="./theme_preview.php?theme=<?php echo $theme.$qstr_device; ?>"><?php echo (G5_IS_MOBILE ? 'PC 버전' : '모바일 버전'); ?></a></li>
|
||||||
|
<?php echo $btn_active; ?>
|
||||||
|
</ul>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section id="preview_content">
|
||||||
|
<?php
|
||||||
|
switch($mode) {
|
||||||
|
case 'list':
|
||||||
|
include(G5_BBS_PATH.'/board.php');
|
||||||
|
break;
|
||||||
|
case 'view':
|
||||||
|
$wr_id = $row['wr_parent'];
|
||||||
|
$write = sql_fetch(" select * from $write_table where wr_id = '$wr_id' ");
|
||||||
|
include(G5_BBS_PATH.'/board.php');
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
include(G5_PATH.'/index.php');
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
require_once(G5_PATH.'/tail.sub.php');
|
||||||
|
?>
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
<?php
|
||||||
|
$sub_menu = "100280";
|
||||||
|
include_once('./_common.php');
|
||||||
|
|
||||||
|
if ($is_admin != 'super')
|
||||||
|
die('최고관리자만 접근 가능합니다.');
|
||||||
|
|
||||||
|
$theme = trim($_POST['theme']);
|
||||||
|
$theme_dir = get_theme_dir();
|
||||||
|
|
||||||
|
if($_POST['type'] == 'reset') {
|
||||||
|
$sql = " update {$g5['config_table']} set cf_theme = '' ";
|
||||||
|
sql_query($sql);
|
||||||
|
die('');
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!in_array($theme, $theme_dir))
|
||||||
|
die('선택하신 테마가 설치되어 있지 않습니다.');
|
||||||
|
|
||||||
|
// 테마적용
|
||||||
|
$sql = " update {$g5['config_table']} set cf_theme = '$theme' ";
|
||||||
|
sql_query($sql);
|
||||||
|
|
||||||
|
// 테마 설정 스킨 적용
|
||||||
|
if($_POST['set_default_skin'] == 1) {
|
||||||
|
$keys = 'set_default_skin, cf_member_skin, cf_mobile_member_skin, cf_new_skin, cf_mobile_new_skin, cf_search_skin, cf_mobile_search_skin, cf_connect_skin, cf_mobile_connect_skin, cf_faq_skin, cf_mobile_faq_skin, qa_skin, qa_mobile_skin';
|
||||||
|
|
||||||
|
$tconfig = get_theme_config_value($theme, $keys);
|
||||||
|
|
||||||
|
if($tconfig['set_default_skin']) {
|
||||||
|
$sql_common = array();
|
||||||
|
$qa_sql_common = array();
|
||||||
|
|
||||||
|
foreach($tconfig as $key => $val) {
|
||||||
|
if(preg_match('#^qa_.+$#', $key)) {
|
||||||
|
if($val) {
|
||||||
|
if(!preg_match('#^theme/.+$#', $val))
|
||||||
|
$val = 'theme/'.$val;
|
||||||
|
|
||||||
|
$qa_sql_common[] = " $key = '$val' ";
|
||||||
|
}
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!isset($config[$key]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if($val) {
|
||||||
|
if(!preg_match('#^theme/.+$#', $val))
|
||||||
|
$val = 'theme/'.$val;
|
||||||
|
|
||||||
|
$sql_common[] = " $key = '$val' ";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($sql_common)) {
|
||||||
|
$sql = " update {$g5['config_table']} set " . implode(', ', $sql_common);
|
||||||
|
sql_query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!empty($qa_sql_common)) {
|
||||||
|
$sql = " update {$g5['qa_config_table']} set " . implode(', ', $qa_sql_common);
|
||||||
|
sql_query($sql);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
die('');
|
||||||
|
?>
|
||||||
@@ -0,0 +1,210 @@
|
|||||||
|
<?php
|
||||||
|
$sub_menu = '300820';
|
||||||
|
include_once('./_common.php');
|
||||||
|
|
||||||
|
check_demo();
|
||||||
|
|
||||||
|
auth_check($auth[$sub_menu], 'r');
|
||||||
|
|
||||||
|
// http://www.jqplot.com/
|
||||||
|
add_stylesheet('<link rel="stylesheet" href="'.G5_PLUGIN_URL.'/jqplot/jquery.jqplot.css">', 0);
|
||||||
|
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jquery.jqplot.js"></script>', 0);
|
||||||
|
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.canvasTextRenderer.min.js"></script>', 0);
|
||||||
|
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.categoryAxisRenderer.min.js"></script>', 0);
|
||||||
|
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/plugins/jqplot.pointLabels.min.js"></script>', 0);
|
||||||
|
add_javascript('<!--[if lt IE 9]><script src="'.G5_PLUGIN_URL.'/jqplot/excanvas.js"></script><![endif]-->', 0);
|
||||||
|
|
||||||
|
if (!($graph == 'line' || $graph == 'bar'))
|
||||||
|
$graph = 'line';
|
||||||
|
|
||||||
|
if ($graph == 'bar') {
|
||||||
|
// 바 타입으로 사용하는 코드입니다.
|
||||||
|
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.barRenderer.min.js"></script>', 0);
|
||||||
|
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.categoryAxisRenderer.min.js"></script>', 0);
|
||||||
|
add_javascript('<script src="'.G5_PLUGIN_URL.'/jqplot/jqplot.pointLabels.min.js"></script>', 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
$g5['title'] = '글,댓글 현황';
|
||||||
|
include_once ('./admin.head.php');
|
||||||
|
|
||||||
|
$period_array = array(
|
||||||
|
'오늘'=>array('시간', 0),
|
||||||
|
'어제'=>array('시간', 0),
|
||||||
|
'7일전'=>array('일', 7),
|
||||||
|
'14일전'=>array('일', 14),
|
||||||
|
'30일전'=>array('일', 30),
|
||||||
|
'3개월전'=>array('주', 90),
|
||||||
|
'6개월전'=>array('주', 180),
|
||||||
|
'1년전'=>array('월', 365),
|
||||||
|
'2년전'=>array('월', 365*2),
|
||||||
|
'3년전'=>array('월', 365*3),
|
||||||
|
'5년전'=>array('년', 365*5),
|
||||||
|
'10년전'=>array('년', 365*10),
|
||||||
|
);
|
||||||
|
|
||||||
|
$is_period = false;
|
||||||
|
foreach($period_array as $key=>$value) {
|
||||||
|
if ($key == $period) {
|
||||||
|
$is_period = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!$is_period)
|
||||||
|
$period = '오늘';
|
||||||
|
|
||||||
|
$day = $period_array[$period][0];
|
||||||
|
|
||||||
|
$today = date('Y-m-d', G5_SERVER_TIME);
|
||||||
|
$yesterday = date('Y-m-d', G5_SERVER_TIME - 86400);
|
||||||
|
|
||||||
|
if ($period == '오늘') {
|
||||||
|
$from = $today;
|
||||||
|
$to = $from;
|
||||||
|
} else if ($period == '어제') {
|
||||||
|
$from = $yesterday;
|
||||||
|
$to = $from;
|
||||||
|
} else if ($period == '내일') {
|
||||||
|
$from = date('Y-m-d', G5_SERVER_TIME + (86400 * 2));
|
||||||
|
$to = $from;
|
||||||
|
} else {
|
||||||
|
$from = date('Y-m-d', G5_SERVER_TIME - (86400 * $period_array[$period][1]));
|
||||||
|
$to = $yesterday;
|
||||||
|
}
|
||||||
|
|
||||||
|
$sql_bo_table = '';
|
||||||
|
if ($bo_table)
|
||||||
|
$sql_bo_table = "and bo_table = '$bo_table'";
|
||||||
|
|
||||||
|
switch ($day) {
|
||||||
|
case '시간' :
|
||||||
|
$sql = " select substr(bn_datetime,6,8) as hours, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by hours order by bn_datetime ";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||||
|
// 월-일 시간
|
||||||
|
$line1[] = "['".substr($row['hours'],0,8)."',".$row['wcount'].']';
|
||||||
|
$line2[] = "['".substr($row['hours'],0,8)."',".$row['ccount'].']';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '일' :
|
||||||
|
$sql = " select substr(bn_datetime,1,10) as days, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by days order by bn_datetime ";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||||
|
// 월-일
|
||||||
|
$line1[] = "['".substr($row['days'],5,5)."',".$row['wcount'].']';
|
||||||
|
$line2[] = "['".substr($row['days'],5,5)."',".$row['ccount'].']';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '주' :
|
||||||
|
$sql = " select concat(substr(bn_datetime,1,4), '-', weekofyear(bn_datetime)) as weeks, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by weeks order by bn_datetime ";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||||
|
// 올해의 몇주로 보여주면 바로 확인이 안되므로 주를 날짜로 바꾼다.
|
||||||
|
// 년-월-일
|
||||||
|
list($lyear, $lweek) = explode('-', $row['weeks']);
|
||||||
|
$date = date('y-m-d', strtotime($lyear.'W'.str_pad($lweek, 2, '0', STR_PAD_LEFT)));
|
||||||
|
$line1[] = "['".$date."',".$row['wcount'].']';
|
||||||
|
$line2[] = "['".$date."',".$row['ccount'].']';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '월' :
|
||||||
|
$sql = " select substr(bn_datetime,1,7) as months, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by months order by bn_datetime ";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||||
|
// 년-월
|
||||||
|
$line1[] = "['".substr($row['months'],2,5)."',".$row['wcount'].']';
|
||||||
|
$line2[] = "['".substr($row['months'],2,5)."',".$row['ccount'].']';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case '년' :
|
||||||
|
$sql = " select substr(bn_datetime,1,4) as years, sum(if(wr_id=wr_parent,1,0)) as wcount, sum(if(wr_id=wr_parent,0,1)) as ccount from {$g5['board_new_table']} where substr(bn_datetime,1,10) between '$from' and '$to' {$sql_bo_table} group by years order by bn_datetime ";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
for ($i=0; $row=sql_fetch_array($result); $i++) {
|
||||||
|
// 년(4자리)
|
||||||
|
$line1[] = "['".substr($row['years'],0,4)."',".$row['wcount'].']';
|
||||||
|
$line2[] = "['".substr($row['years'],0,4)."',".$row['ccount'].']';
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
<div id="wr_cont">
|
||||||
|
<form>
|
||||||
|
<select name="bo_table">
|
||||||
|
<option value="">전체게시판</a>
|
||||||
|
<?php
|
||||||
|
$sql = " select bo_table, bo_subject from {$g5['board_table']} order by bo_count_write desc ";
|
||||||
|
$result = sql_query($sql);
|
||||||
|
for($i=0; $row=sql_fetch_array($result); $i++) {
|
||||||
|
echo "<option value=\"{$row['bo_table']}\"";
|
||||||
|
if ($bo_table == $row['bo_table'])
|
||||||
|
echo ' selected="selected"';
|
||||||
|
echo ">{$row['bo_subject']}</option>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select name="period">
|
||||||
|
<?php
|
||||||
|
foreach($period_array as $key=>$value) {
|
||||||
|
echo "<option value=\"{$key}\"";
|
||||||
|
if ($key == $period)
|
||||||
|
echo " selected=\"selected\"";
|
||||||
|
echo ">{$key}</option>\n";
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select name="graph">
|
||||||
|
<option value="line" <?php echo ($graph == 'line' ? 'selected="selected"' : ''); ?>>선그래프</option>
|
||||||
|
<option value="bar" <?php echo ($graph == 'bar' ? 'selected="selected"' : ''); ?>>막대그래프</option>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<input type="submit" class="btn_submit" value="확인">
|
||||||
|
</form>
|
||||||
|
<ul id="grp_color">
|
||||||
|
<li><span></span>글 수</li>
|
||||||
|
<li class="color2"><span></span>댓글 수</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<br>
|
||||||
|
<div id="chart_wr">
|
||||||
|
<?php
|
||||||
|
if (empty($line1) || empty($line2)) {
|
||||||
|
echo "<h5>그래프를 만들 데이터가 없습니다.</h5>\n";
|
||||||
|
} else {
|
||||||
|
?>
|
||||||
|
<div id="chart1" style="height:500px; width:100%;"></div>
|
||||||
|
<div>
|
||||||
|
<script>
|
||||||
|
$(document).ready(function(){
|
||||||
|
var line1 = [<?php echo implode($line1, ','); ?>];
|
||||||
|
var line2 = [<?php echo implode($line2, ','); ?>];
|
||||||
|
var plot1 = $.jqplot ('chart1', [line1, line2], {
|
||||||
|
seriesDefaults: {
|
||||||
|
<?php if ($graph == 'bar') { ?>
|
||||||
|
renderer:$.jqplot.BarRenderer,
|
||||||
|
<?php } ?>
|
||||||
|
pointLabels: { show: true }
|
||||||
|
},
|
||||||
|
axes:{
|
||||||
|
xaxis: {
|
||||||
|
renderer: $.jqplot.CategoryAxisRenderer,
|
||||||
|
label: '<?php echo $day; ?>',
|
||||||
|
pad:0,
|
||||||
|
max:23
|
||||||
|
},
|
||||||
|
yaxis: {
|
||||||
|
label: '글수',
|
||||||
|
min: 0
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
|
||||||
|
<?
|
||||||
|
include_once ('./admin.tail.php');
|
||||||
|
?>
|
||||||
+4
-4
@@ -222,19 +222,19 @@ $admin_href = "";
|
|||||||
if ($member['mb_id'] && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id']))
|
if ($member['mb_id'] && ($is_admin == 'super' || $group['gr_admin'] == $member['mb_id']))
|
||||||
$admin_href = G5_ADMIN_URL.'/board_form.php?w=u&bo_table='.$bo_table;
|
$admin_href = G5_ADMIN_URL.'/board_form.php?w=u&bo_table='.$bo_table;
|
||||||
|
|
||||||
include_once('./board_head.php');
|
include_once(G5_BBS_PATH.'/board_head.php');
|
||||||
|
|
||||||
// 게시물 아이디가 있다면 게시물 보기를 INCLUDE
|
// 게시물 아이디가 있다면 게시물 보기를 INCLUDE
|
||||||
if (isset($wr_id) && $wr_id) {
|
if (isset($wr_id) && $wr_id) {
|
||||||
include_once('./view.php');
|
include_once(G5_BBS_PATH.'/view.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 전체목록보이기 사용이 "예" 또는 wr_id 값이 없다면 목록을 보임
|
// 전체목록보이기 사용이 "예" 또는 wr_id 값이 없다면 목록을 보임
|
||||||
//if ($board['bo_use_list_view'] || empty($wr_id))
|
//if ($board['bo_use_list_view'] || empty($wr_id))
|
||||||
if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view'] || empty($wr_id))
|
if ($member['mb_level'] >= $board['bo_list_level'] && $board['bo_use_list_view'] || empty($wr_id))
|
||||||
include_once ('./list.php');
|
include_once (G5_BBS_PATH.'/list.php');
|
||||||
|
|
||||||
include_once('./board_tail.php');
|
include_once(G5_BBS_PATH.'/board_tail.php');
|
||||||
|
|
||||||
echo "\n<!-- 사용스킨 : ".(G5_IS_MOBILE ? $board['bo_mobile_skin'] : $board['bo_skin'])." -->\n";
|
echo "\n<!-- 사용스킨 : ".(G5_IS_MOBILE ? $board['bo_mobile_skin'] : $board['bo_skin'])." -->\n";
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -4,7 +4,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
|||||||
// 게시판 관리의 상단 내용
|
// 게시판 관리의 상단 내용
|
||||||
if (G5_IS_MOBILE) {
|
if (G5_IS_MOBILE) {
|
||||||
// 모바일의 경우 설정을 따르지 않는다.
|
// 모바일의 경우 설정을 따르지 않는다.
|
||||||
include_once('./_head.php');
|
include_once(G5_BBS_PATH.'/_head.php');
|
||||||
echo stripslashes($board['bo_mobile_content_head']);
|
echo stripslashes($board['bo_mobile_content_head']);
|
||||||
} else {
|
} else {
|
||||||
@include ($board['bo_include_head']);
|
@include ($board['bo_include_head']);
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
|||||||
if (G5_IS_MOBILE) {
|
if (G5_IS_MOBILE) {
|
||||||
echo stripslashes($board['bo_mobile_content_tail']);
|
echo stripslashes($board['bo_mobile_content_tail']);
|
||||||
// 모바일의 경우 설정을 따르지 않는다.
|
// 모바일의 경우 설정을 따르지 않는다.
|
||||||
include_once('./_tail.php');
|
include_once(G5_BBS_PATH.'/_tail.php');
|
||||||
} else {
|
} else {
|
||||||
echo stripslashes($board['bo_content_tail']);
|
echo stripslashes($board['bo_content_tail']);
|
||||||
@include ($board['bo_include_tail']);
|
@include ($board['bo_include_tail']);
|
||||||
|
|||||||
+2
-2
@@ -62,8 +62,8 @@ $str = preg_replace($src, $dst, $str);
|
|||||||
if(trim($co['co_skin']) == '')
|
if(trim($co['co_skin']) == '')
|
||||||
$co['co_skin'] = 'basic';
|
$co['co_skin'] = 'basic';
|
||||||
|
|
||||||
$content_skin_path = G5_SKIN_PATH.'/content/'.$co['co_skin'];
|
$content_skin_path = get_skin_path('content', $co['co_skin']);
|
||||||
$content_skin_url = G5_SKIN_URL.'/content/'.$co['co_skin'];
|
$content_skin_url = get_skin_url('content', $co['co_skin']);
|
||||||
$skin_file = $content_skin_path.'/content.skin.php';
|
$skin_file = $content_skin_path.'/content.skin.php';
|
||||||
|
|
||||||
if ($is_admin)
|
if ($is_admin)
|
||||||
|
|||||||
+11
-2
@@ -1,7 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once('./_common.php');
|
include_once('./_common.php');
|
||||||
include_once(G5_LIB_PATH.'/latest.lib.php');
|
|
||||||
$g5['title'] = $group['gr_subject'];
|
if(defined('G5_THEME_PATH')) {
|
||||||
|
$group_file = G5_THEME_PATH.'/group.php';
|
||||||
|
if(is_file($group_file)) {
|
||||||
|
require_once($group_file);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
unset($group_file);
|
||||||
|
}
|
||||||
|
|
||||||
if (G5_IS_MOBILE) {
|
if (G5_IS_MOBILE) {
|
||||||
include_once(G5_MOBILE_PATH.'/group.php');
|
include_once(G5_MOBILE_PATH.'/group.php');
|
||||||
@@ -11,7 +18,9 @@ if (G5_IS_MOBILE) {
|
|||||||
if(!$is_admin && $group['gr_device'] == 'mobile')
|
if(!$is_admin && $group['gr_device'] == 'mobile')
|
||||||
alert($group['gr_subject'].' 그룹은 모바일에서만 접근할 수 있습니다.');
|
alert($group['gr_subject'].' 그룹은 모바일에서만 접근할 수 있습니다.');
|
||||||
|
|
||||||
|
$g5['title'] = $group['gr_subject'];
|
||||||
include_once('./_head.php');
|
include_once('./_head.php');
|
||||||
|
include_once(G5_LIB_PATH.'/latest.lib.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ set_cookie('ck_auto', '', 0);
|
|||||||
// 자동로그인 해제 end --------------------------------
|
// 자동로그인 해제 end --------------------------------
|
||||||
|
|
||||||
if ($url) {
|
if ($url) {
|
||||||
$p = parse_url($url);
|
$p = @parse_url($url);
|
||||||
if ($p['scheme'] || $p['host']) {
|
if ($p['scheme'] || $p['host']) {
|
||||||
alert('url에 도메인을 지정할 수 없습니다.');
|
alert('url에 도메인을 지정할 수 없습니다.');
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -51,7 +51,7 @@ $sql = " select wr_subject from {$write_table}
|
|||||||
and wr_is_comment = 0 ";
|
and wr_is_comment = 0 ";
|
||||||
$row = sql_fetch($sql);
|
$row = sql_fetch($sql);
|
||||||
|
|
||||||
$g5['title'] = $row['wr_subject'];
|
$g5['title'] = get_text($row['wr_subject']);
|
||||||
|
|
||||||
include_once($member_skin_path.'/password.skin.php');
|
include_once($member_skin_path.'/password.skin.php');
|
||||||
|
|
||||||
|
|||||||
+18
-5
@@ -85,12 +85,25 @@ for ($i=0; $row2=sql_fetch_array($result); $i++) {
|
|||||||
$list3[$i]['subject'] = cut_str($row2['po_subject'],60,"…");
|
$list3[$i]['subject'] = cut_str($row2['po_subject'],60,"…");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G5_IS_MOBILE) {
|
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||||
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
if (G5_IS_MOBILE) {
|
||||||
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
$poll_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||||
|
if(!is_dir($poll_skin_path))
|
||||||
|
$poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||||
|
$poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path);
|
||||||
|
} else {
|
||||||
|
$poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||||
|
$poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path);
|
||||||
|
}
|
||||||
|
//$skin_dir = $match[1];
|
||||||
} else {
|
} else {
|
||||||
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
if (G5_IS_MOBILE) {
|
||||||
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||||
|
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||||
|
} else {
|
||||||
|
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
||||||
|
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once(G5_PATH.'/head.sub.php');
|
include_once(G5_PATH.'/head.sub.php');
|
||||||
|
|||||||
+2
-2
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
$qa_skin_path = (G5_IS_MOBILE ? G5_MOBILE_PATH : G5_PATH).'/'.G5_SKIN_DIR.'/qa/'.(G5_IS_MOBILE ? $qaconfig['qa_mobile_skin'] : $qaconfig['qa_skin']);
|
$qa_skin_path = get_skin_path('qa', (G5_IS_MOBILE ? $qaconfig['qa_mobile_skin'] : $qaconfig['qa_skin']));
|
||||||
$qa_skin_url = (G5_IS_MOBILE ? G5_MOBILE_URL : G5_URL).'/'.G5_SKIN_DIR.'/qa/'.(G5_IS_MOBILE ? $qaconfig['qa_mobile_skin'] : $qaconfig['qa_skin']);
|
$qa_skin_url = get_skin_url('qa', (G5_IS_MOBILE ? $qaconfig['qa_mobile_skin'] : $qaconfig['qa_skin']));
|
||||||
|
|
||||||
if (G5_IS_MOBILE) {
|
if (G5_IS_MOBILE) {
|
||||||
// 모바일의 경우 설정을 따르지 않는다.
|
// 모바일의 경우 설정을 따르지 않는다.
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ if ($w == '' || $w == 'u') {
|
|||||||
if($w == '' && $mb_password != $mb_password_re)
|
if($w == '' && $mb_password != $mb_password_re)
|
||||||
alert('비밀번호가 일치하지 않습니다.');
|
alert('비밀번호가 일치하지 않습니다.');
|
||||||
|
|
||||||
if ($msg = empty_mb_name($mb_id)) alert($msg, "", true, true);
|
if ($msg = empty_mb_name($mb_name)) alert($msg, "", true, true);
|
||||||
if ($msg = empty_mb_nick($mb_nick)) alert($msg, "", true, true);
|
if ($msg = empty_mb_nick($mb_nick)) alert($msg, "", true, true);
|
||||||
if ($msg = empty_mb_email($mb_email)) alert($msg, "", true, true);
|
if ($msg = empty_mb_email($mb_email)) alert($msg, "", true, true);
|
||||||
if ($msg = reserve_mb_id($mb_id)) alert($msg, "", true, true);
|
if ($msg = reserve_mb_id($mb_id)) alert($msg, "", true, true);
|
||||||
|
|||||||
+118
-77
@@ -218,58 +218,6 @@ if ($config['cf_editor'])
|
|||||||
else
|
else
|
||||||
define('G5_EDITOR_LIB', G5_LIB_PATH."/editor.lib.php");
|
define('G5_EDITOR_LIB', G5_LIB_PATH."/editor.lib.php");
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
// 사용기기 설정
|
|
||||||
// config.php G5_SET_DEVICE 설정에 따라 사용자 화면 제한됨
|
|
||||||
// pc 설정 시 모바일 기기에서도 PC화면 보여짐
|
|
||||||
// mobile 설정 시 PC에서도 모바일화면 보여짐
|
|
||||||
// both 설정 시 접속 기기에 따른 화면 보여짐
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
$is_mobile = false;
|
|
||||||
$set_device = true;
|
|
||||||
if(defined('G5_SET_DEVICE')) {
|
|
||||||
switch(G5_SET_DEVICE) {
|
|
||||||
case 'pc':
|
|
||||||
$is_mobile = false;
|
|
||||||
$set_device = false;
|
|
||||||
break;
|
|
||||||
case 'mobile':
|
|
||||||
$is_mobile = true;
|
|
||||||
$set_device = false;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
//==============================================================================
|
|
||||||
// Mobile 모바일 설정
|
|
||||||
// 쿠키에 저장된 값이 모바일이라면 브라우저 상관없이 모바일로 실행
|
|
||||||
// 그렇지 않다면 브라우저의 HTTP_USER_AGENT 에 따라 모바일 결정
|
|
||||||
// G5_MOBILE_AGENT : config.php 에서 선언
|
|
||||||
//------------------------------------------------------------------------------
|
|
||||||
if (G5_USE_MOBILE && $set_device) {
|
|
||||||
if ($_REQUEST['device']=='pc')
|
|
||||||
$is_mobile = false;
|
|
||||||
else if ($_REQUEST['device']=='mobile')
|
|
||||||
$is_mobile = true;
|
|
||||||
else if (isset($_SESSION['ss_is_mobile']))
|
|
||||||
$is_mobile = $_SESSION['ss_is_mobile'];
|
|
||||||
else if (is_mobile())
|
|
||||||
$is_mobile = true;
|
|
||||||
} else {
|
|
||||||
$set_device = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$_SESSION['ss_is_mobile'] = $is_mobile;
|
|
||||||
define('G5_IS_MOBILE', $is_mobile);
|
|
||||||
define('G5_DEVICE_BUTTON_DISPLAY', $set_device);
|
|
||||||
if (G5_IS_MOBILE) {
|
|
||||||
$g5['mobile_path'] = G5_PATH.'/'.$g5['mobile_dir'];
|
|
||||||
}
|
|
||||||
//==============================================================================
|
|
||||||
|
|
||||||
// 4.00.03 : [보안관련] PHPSESSID 가 틀리면 로그아웃한다.
|
// 4.00.03 : [보안관련] PHPSESSID 가 틀리면 로그아웃한다.
|
||||||
if (isset($_REQUEST['PHPSESSID']) && $_REQUEST['PHPSESSID'] != session_id())
|
if (isset($_REQUEST['PHPSESSID']) && $_REQUEST['PHPSESSID'] != session_id())
|
||||||
goto_url(G5_BBS_URL.'/logout.php');
|
goto_url(G5_BBS_URL.'/logout.php');
|
||||||
@@ -371,7 +319,7 @@ if (isset($_REQUEST['url'])) {
|
|||||||
$url = '';
|
$url = '';
|
||||||
$urlencode = urlencode($_SERVER['REQUEST_URI']);
|
$urlencode = urlencode($_SERVER['REQUEST_URI']);
|
||||||
if (G5_DOMAIN) {
|
if (G5_DOMAIN) {
|
||||||
$p = parse_url(G5_DOMAIN);
|
$p = @parse_url(G5_DOMAIN);
|
||||||
$urlencode = G5_DOMAIN.urldecode(preg_replace("/^".urlencode($p['path'])."/", "", $urlencode));
|
$urlencode = G5_DOMAIN.urldecode(preg_replace("/^".urlencode($p['path'])."/", "", $urlencode));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -513,35 +461,128 @@ if ($is_admin != 'super') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 테마경로
|
||||||
|
if(defined('_THEME_PREVIEW_') && _THEME_PREVIEW_ === true)
|
||||||
|
$config['cf_theme'] = trim($_GET['theme']);
|
||||||
|
|
||||||
|
if(isset($config['cf_theme']) && trim($config['cf_theme'])) {
|
||||||
|
$theme_path = G5_PATH.'/'.G5_THEME_DIR.'/'.$config['cf_theme'];
|
||||||
|
if(is_dir($theme_path)) {
|
||||||
|
define('G5_THEME_PATH', $theme_path);
|
||||||
|
define('G5_THEME_URL', G5_URL.'/'.G5_THEME_DIR.'/'.$config['cf_theme']);
|
||||||
|
define('G5_THEME_MOBILE_PATH', $theme_path.'/'.G5_MOBILE_DIR);
|
||||||
|
define('G5_THEME_LIB_PATH', $theme_path.'/'.G5_LIB_DIR);
|
||||||
|
define('G5_THEME_CSS_URL', G5_THEME_URL.'/'.G5_CSS_DIR);
|
||||||
|
define('G5_THEME_IMG_URL', G5_THEME_URL.'/'.G5_IMG_DIR);
|
||||||
|
define('G5_THEME_JS_URL', G5_THEME_URL.'/'.G5_JS_DIR);
|
||||||
|
}
|
||||||
|
unset($theme_path);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 테마 설정 로드
|
||||||
|
if(is_file(G5_THEME_PATH.'/theme.config.php'))
|
||||||
|
include_once(G5_THEME_PATH.'/theme.config.php');
|
||||||
|
|
||||||
|
//=====================================================================================
|
||||||
|
// 사용기기 설정
|
||||||
|
// 테마의 G5_THEME_DEVICE 설정에 따라 사용자 화면 제한됨
|
||||||
|
// 테마에 별도 설정이 없는 경우 config.php G5_SET_DEVICE 설정에 따라 사용자 화면 제한됨
|
||||||
|
// pc 설정 시 모바일 기기에서도 PC화면 보여짐
|
||||||
|
// mobile 설정 시 PC에서도 모바일화면 보여짐
|
||||||
|
// both 설정 시 접속 기기에 따른 화면 보여짐
|
||||||
|
//-------------------------------------------------------------------------------------
|
||||||
|
$is_mobile = false;
|
||||||
|
$set_device = true;
|
||||||
|
|
||||||
|
if(defined('G5_THEME_DEVICE') && G5_THEME_DEVICE != '') {
|
||||||
|
switch(G5_THEME_DEVICE) {
|
||||||
|
case 'pc':
|
||||||
|
$is_mobile = false;
|
||||||
|
$set_device = false;
|
||||||
|
break;
|
||||||
|
case 'mobile':
|
||||||
|
$is_mobile = true;
|
||||||
|
$set_device = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(defined('G5_SET_DEVICE') && $set_device) {
|
||||||
|
switch(G5_SET_DEVICE) {
|
||||||
|
case 'pc':
|
||||||
|
$is_mobile = false;
|
||||||
|
$set_device = false;
|
||||||
|
break;
|
||||||
|
case 'mobile':
|
||||||
|
$is_mobile = true;
|
||||||
|
$set_device = false;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
//==============================================================================
|
||||||
|
// Mobile 모바일 설정
|
||||||
|
// 쿠키에 저장된 값이 모바일이라면 브라우저 상관없이 모바일로 실행
|
||||||
|
// 그렇지 않다면 브라우저의 HTTP_USER_AGENT 에 따라 모바일 결정
|
||||||
|
// G5_MOBILE_AGENT : config.php 에서 선언
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
if (G5_USE_MOBILE && $set_device) {
|
||||||
|
if ($_REQUEST['device']=='pc')
|
||||||
|
$is_mobile = false;
|
||||||
|
else if ($_REQUEST['device']=='mobile')
|
||||||
|
$is_mobile = true;
|
||||||
|
else if (isset($_SESSION['ss_is_mobile']))
|
||||||
|
$is_mobile = $_SESSION['ss_is_mobile'];
|
||||||
|
else if (is_mobile())
|
||||||
|
$is_mobile = true;
|
||||||
|
} else {
|
||||||
|
$set_device = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$_SESSION['ss_is_mobile'] = $is_mobile;
|
||||||
|
define('G5_IS_MOBILE', $is_mobile);
|
||||||
|
define('G5_DEVICE_BUTTON_DISPLAY', $set_device);
|
||||||
|
if (G5_IS_MOBILE) {
|
||||||
|
$g5['mobile_path'] = G5_PATH.'/'.$g5['mobile_dir'];
|
||||||
|
}
|
||||||
|
//==============================================================================
|
||||||
|
|
||||||
|
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
// 스킨경로
|
// 스킨경로
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
if (G5_IS_MOBILE) {
|
if (G5_IS_MOBILE) {
|
||||||
$board_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/board/'.$board['bo_mobile_skin'];
|
$board_skin_path = get_skin_path('board', $board['bo_mobile_skin']);
|
||||||
$board_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/board/'.$board['bo_mobile_skin'];
|
$board_skin_url = get_skin_url('board', $board['bo_mobile_skin']);
|
||||||
$member_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/member/'.$config['cf_mobile_member_skin'];
|
$member_skin_path = get_skin_path('member', $config['cf_mobile_member_skin']);
|
||||||
$member_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/member/'.$config['cf_mobile_member_skin'];
|
$member_skin_url = get_skin_url('member', $config['cf_mobile_member_skin']);
|
||||||
$new_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/new/'.$config['cf_mobile_new_skin'];
|
$new_skin_path = get_skin_path('new', $config['cf_mobile_new_skin']);
|
||||||
$new_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/new/'.$config['cf_mobile_new_skin'];
|
$new_skin_url = get_skin_url('new', $config['cf_mobile_new_skin']);
|
||||||
$search_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/search/'.$config['cf_mobile_search_skin'];
|
$search_skin_path = get_skin_path('search', $config['cf_mobile_search_skin']);
|
||||||
$search_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/search/'.$config['cf_mobile_search_skin'];
|
$search_skin_url = get_skin_url('search', $config['cf_mobile_search_skin']);
|
||||||
$connect_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/connect/'.$config['cf_mobile_connect_skin'];
|
$connect_skin_path = get_skin_path('connect', $config['cf_mobile_connect_skin']);
|
||||||
$connect_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/connect/'.$config['cf_mobile_connect_skin'];
|
$connect_skin_url = get_skin_url('connect', $config['cf_mobile_connect_skin']);
|
||||||
$faq_skin_path = G5_MOBILE_PATH .'/'.G5_SKIN_DIR.'/faq/'.$config['cf_mobile_faq_skin'];
|
$faq_skin_path = get_skin_path('faq', $config['cf_mobile_faq_skin']);
|
||||||
$faq_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/faq/'.$config['cf_mobile_faq_skin'];
|
$faq_skin_url = get_skin_url('faq', $config['cf_mobile_faq_skin']);
|
||||||
} else {
|
} else {
|
||||||
$board_skin_path = G5_SKIN_PATH.'/board/'.$board['bo_skin'];
|
$board_skin_path = get_skin_path('board', $board['bo_skin']);
|
||||||
$board_skin_url = G5_SKIN_URL .'/board/'.$board['bo_skin'];
|
$board_skin_url = get_skin_url('board', $board['bo_skin']);
|
||||||
$member_skin_path = G5_SKIN_PATH.'/member/'.$config['cf_member_skin'];
|
$member_skin_path = get_skin_path('member', $config['cf_member_skin']);
|
||||||
$member_skin_url = G5_SKIN_URL .'/member/'.$config['cf_member_skin'];
|
$member_skin_url = get_skin_url('member', $config['cf_member_skin']);
|
||||||
$new_skin_path = G5_SKIN_PATH.'/new/'.$config['cf_new_skin'];
|
$new_skin_path = get_skin_path('new', $config['cf_new_skin']);
|
||||||
$new_skin_url = G5_SKIN_URL .'/new/'.$config['cf_new_skin'];
|
$new_skin_url = get_skin_url('new', $config['cf_new_skin']);
|
||||||
$search_skin_path = G5_SKIN_PATH.'/search/'.$config['cf_search_skin'];
|
$search_skin_path = get_skin_path('search', $config['cf_search_skin']);
|
||||||
$search_skin_url = G5_SKIN_URL .'/search/'.$config['cf_search_skin'];
|
$search_skin_url = get_skin_url('search', $config['cf_search_skin']);
|
||||||
$connect_skin_path = G5_SKIN_PATH.'/connect/'.$config['cf_connect_skin'];
|
$connect_skin_path = get_skin_path('connect', $config['cf_connect_skin']);
|
||||||
$connect_skin_url = G5_SKIN_URL .'/connect/'.$config['cf_connect_skin'];
|
$connect_skin_url = get_skin_url('connect', $config['cf_connect_skin']);
|
||||||
$faq_skin_path = G5_SKIN_PATH.'/faq/'.$config['cf_faq_skin'];
|
$faq_skin_path = get_skin_path('faq', $config['cf_faq_skin']);
|
||||||
$faq_skin_url = G5_SKIN_URL.'/faq/'.$config['cf_faq_skin'];
|
$faq_skin_url = get_skin_url('faq', $config['cf_faq_skin']);
|
||||||
}
|
}
|
||||||
//==============================================================================
|
//==============================================================================
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -5,7 +5,7 @@
|
|||||||
********************/
|
********************/
|
||||||
|
|
||||||
define('G5_VERSION', '그누보드5');
|
define('G5_VERSION', '그누보드5');
|
||||||
define('G5_GNUBOARD_VER', '5.0.41');
|
define('G5_GNUBOARD_VER', '5.1.1');
|
||||||
|
|
||||||
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
|
// 이 상수가 정의되지 않으면 각각의 개별 페이지는 별도로 실행될 수 없음
|
||||||
define('_GNUBOARD_', true);
|
define('_GNUBOARD_', true);
|
||||||
@@ -59,6 +59,7 @@ define('G5_SNS_DIR', 'sns');
|
|||||||
define('G5_SYNDI_DIR', 'syndi');
|
define('G5_SYNDI_DIR', 'syndi');
|
||||||
define('G5_PHPMAILER_DIR', 'PHPMailer_v2.0.4');
|
define('G5_PHPMAILER_DIR', 'PHPMailer_v2.0.4');
|
||||||
define('G5_SESSION_DIR', 'session');
|
define('G5_SESSION_DIR', 'session');
|
||||||
|
define('G5_THEME_DIR', 'theme');
|
||||||
|
|
||||||
// URL 은 브라우저상에서의 경로 (도메인으로 부터의)
|
// URL 은 브라우저상에서의 경로 (도메인으로 부터의)
|
||||||
if (G5_DOMAIN) {
|
if (G5_DOMAIN) {
|
||||||
|
|||||||
@@ -1,8 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
// head.sub.php, tail.sub.php 파일의 이름을 지정할 수 있습니다.
|
|
||||||
// 지정된 파일은 head.sub.php, tail.sub.php 파일과 동일한 위치에 존재해야 합니다.
|
|
||||||
//define('G5_HEAD_SUB_FILE', 'user.head.sub.php');
|
|
||||||
//define('G5_TAIL_SUB_FILE', 'user.tail.sub.php');
|
|
||||||
?>
|
?>
|
||||||
+2
-2
@@ -4,7 +4,7 @@ include_once(G5_LIB_PATH.'/connect.lib.php');
|
|||||||
include_once(G5_LIB_PATH.'/outlogin.lib.php');
|
include_once(G5_LIB_PATH.'/outlogin.lib.php');
|
||||||
|
|
||||||
$g5['title'] = '그누보드4 DB 데이터 이전';
|
$g5['title'] = '그누보드4 DB 데이터 이전';
|
||||||
include_once(G5_PATH.'/head.sub.php');
|
include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/head.sub.php');
|
||||||
|
|
||||||
if(get_session('tables_copied') == 'done')
|
if(get_session('tables_copied') == 'done')
|
||||||
alert('DB 데이터 변환을 이미 실행하였습니다. 중복 실행시 오류가 발생할 수 있습니다.', G5_URL);
|
alert('DB 데이터 변환을 이미 실행하였습니다. 중복 실행시 오류가 발생할 수 있습니다.', G5_URL);
|
||||||
@@ -172,5 +172,5 @@ $(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once(G5_PATH.'/tail.sub.php');
|
include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/tail.sub.php');
|
||||||
?>
|
?>
|
||||||
+2
-2
@@ -10,7 +10,7 @@ set_time_limit ( 0 );
|
|||||||
ini_set('memory_limit', '50M');
|
ini_set('memory_limit', '50M');
|
||||||
|
|
||||||
$g5['title'] = '그누보드4 DB 데이터 이전';
|
$g5['title'] = '그누보드4 DB 데이터 이전';
|
||||||
include_once(G5_PATH.'/head.sub.php');
|
include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/head.sub.php');
|
||||||
|
|
||||||
echo '<link rel="stylesheet" href="'.G5_URL.'/g4_import.css">';
|
echo '<link rel="stylesheet" href="'.G5_URL.'/g4_import.css">';
|
||||||
|
|
||||||
@@ -536,5 +536,5 @@ $(function() {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once(G5_PATH.'/tail.sub.php');
|
include_once(G5_PATH.'/'.G5_THEME_DIR.'/basic/tail.sub.php');
|
||||||
?>
|
?>
|
||||||
@@ -1,10 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
// 상단 파일 경로 지정 : 이 코드는 가능한 삭제하지 마십시오.
|
if(defined('G5_THEME_PATH')) {
|
||||||
if ($config['cf_include_head'] && is_file(G5_PATH.'/'.$config['cf_include_head'])) {
|
require_once(G5_THEME_PATH.'/head.php');
|
||||||
include_once(G5_PATH.'/'.$config['cf_include_head']);
|
return;
|
||||||
return; // 이 코드의 아래는 실행을 하지 않습니다.
|
}
|
||||||
|
|
||||||
|
if (G5_IS_MOBILE) {
|
||||||
|
include_once(G5_MOBILE_PATH.'/head.php');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once(G5_PATH.'/head.sub.php');
|
include_once(G5_PATH.'/head.sub.php');
|
||||||
@@ -14,11 +18,6 @@ include_once(G5_LIB_PATH.'/poll.lib.php');
|
|||||||
include_once(G5_LIB_PATH.'/visit.lib.php');
|
include_once(G5_LIB_PATH.'/visit.lib.php');
|
||||||
include_once(G5_LIB_PATH.'/connect.lib.php');
|
include_once(G5_LIB_PATH.'/connect.lib.php');
|
||||||
include_once(G5_LIB_PATH.'/popular.lib.php');
|
include_once(G5_LIB_PATH.'/popular.lib.php');
|
||||||
|
|
||||||
if (G5_IS_MOBILE) {
|
|
||||||
include_once(G5_MOBILE_PATH.'/head.php');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- 상단 시작 { -->
|
<!-- 상단 시작 { -->
|
||||||
@@ -98,7 +97,7 @@ if (G5_IS_MOBILE) {
|
|||||||
<?php } ?>
|
<?php } ?>
|
||||||
<li><a href="<?php echo G5_BBS_URL ?>/faq.php">FAQ</a></li>
|
<li><a href="<?php echo G5_BBS_URL ?>/faq.php">FAQ</a></li>
|
||||||
<li><a href="<?php echo G5_BBS_URL ?>/qalist.php">1:1문의</a></li>
|
<li><a href="<?php echo G5_BBS_URL ?>/qalist.php">1:1문의</a></li>
|
||||||
<li><a href="<?php echo G5_BBS_URL ?>/current_connect.php">접속자 <?php echo connect(); // 현재 접속자수 ?></a></li>
|
<li><a href="<?php echo G5_BBS_URL ?>/current_connect.php">접속자 <?php echo connect(); // 현재 접속자수, 테마의 스킨을 사용하려면 스킨을 theme/basic 과 같이 지정 ?></a></li>
|
||||||
<li><a href="<?php echo G5_BBS_URL ?>/new.php">새글</a></li>
|
<li><a href="<?php echo G5_BBS_URL ?>/new.php">새글</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
@@ -158,8 +157,8 @@ if (G5_IS_MOBILE) {
|
|||||||
<!-- 콘텐츠 시작 { -->
|
<!-- 콘텐츠 시작 { -->
|
||||||
<div id="wrapper">
|
<div id="wrapper">
|
||||||
<div id="aside">
|
<div id="aside">
|
||||||
<?php echo outlogin('basic'); // 외부 로그인 ?>
|
<?php echo outlogin('basic'); // 외부 로그인, 테마의 스킨을 사용하려면 스킨을 theme/basic 과 같이 지정 ?>
|
||||||
<?php echo poll('basic'); // 설문조사 ?>
|
<?php echo poll('basic'); // 설문조사, 테마의 스킨을 사용하려면 스킨을 theme/basic 과 같이 지정 ?>
|
||||||
</div>
|
</div>
|
||||||
<div id="container">
|
<div id="container">
|
||||||
<?php if ((!$bo_table || $w == 's' ) && !defined("_INDEX_")) { ?><div id="container_title"><?php echo $g5['title'] ?></div><?php } ?>
|
<?php if ((!$bo_table || $w == 's' ) && !defined("_INDEX_")) { ?><div id="container_title"><?php echo $g5['title'] ?></div><?php } ?>
|
||||||
+7
-6
@@ -2,14 +2,14 @@
|
|||||||
// 이 파일은 새로운 파일 생성시 반드시 포함되어야 함
|
// 이 파일은 새로운 파일 생성시 반드시 포함되어야 함
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
$begin_time = get_microtime();
|
// 테마 head.sub.php 파일
|
||||||
|
if(!defined('G5_IS_ADMIN') && defined('G5_THEME_PATH') && is_file(G5_THEME_PATH.'/head.sub.php')) {
|
||||||
// 사용자가 지정한 head.sub.php 파일이 있다면 include
|
require_once(G5_THEME_PATH.'/head.sub.php');
|
||||||
if(defined('G5_HEAD_SUB_FILE') && is_file(G5_PATH.'/'.G5_HEAD_SUB_FILE)) {
|
|
||||||
include_once(G5_PATH.'/'.G5_HEAD_SUB_FILE);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$begin_time = get_microtime();
|
||||||
|
|
||||||
if (!isset($g5['title'])) {
|
if (!isset($g5['title'])) {
|
||||||
$g5['title'] = $config['cf_title'];
|
$g5['title'] = $config['cf_title'];
|
||||||
$g5_head_title = $g5['title'];
|
$g5_head_title = $g5['title'];
|
||||||
@@ -54,7 +54,8 @@ if($config['cf_add_meta'])
|
|||||||
<title><?php echo $g5_head_title; ?></title>
|
<title><?php echo $g5_head_title; ?></title>
|
||||||
<?php
|
<?php
|
||||||
if (defined('G5_IS_ADMIN')) {
|
if (defined('G5_IS_ADMIN')) {
|
||||||
echo '<link rel="stylesheet" href="'.G5_ADMIN_URL.'/css/admin.css">'.PHP_EOL;
|
if(!defined('_THEME_PREVIEW_'))
|
||||||
|
echo '<link rel="stylesheet" href="'.G5_ADMIN_URL.'/css/admin.css">'.PHP_EOL;
|
||||||
} else {
|
} else {
|
||||||
echo '<link rel="stylesheet" href="'.G5_CSS_URL.'/'.(G5_IS_MOBILE?'mobile':'default').'.css">'.PHP_EOL;
|
echo '<link rel="stylesheet" href="'.G5_CSS_URL.'/'.(G5_IS_MOBILE?'mobile':'default').'.css">'.PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
define('_INDEX_', true);
|
|
||||||
include_once('./_common.php');
|
include_once('./_common.php');
|
||||||
|
|
||||||
// 초기화면 파일 경로 지정 : 이 코드는 가능한 삭제하지 마십시오.
|
define('_INDEX_', true);
|
||||||
if ($config['cf_include_index'] && is_file(G5_PATH.'/'.$config['cf_include_index'])) {
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
include_once(G5_PATH.'/'.$config['cf_include_index']);
|
|
||||||
return; // 이 코드의 아래는 실행을 하지 않습니다.
|
if(defined('G5_THEME_PATH')) {
|
||||||
|
require_once(G5_THEME_PATH.'/index.php');
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G5_IS_MOBILE) {
|
if (G5_IS_MOBILE) {
|
||||||
@@ -13,7 +14,7 @@ if (G5_IS_MOBILE) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once('./_head.php');
|
include_once(G5_PATH.'/head.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<h2 class="sound_only">최신글</h2>
|
<h2 class="sound_only">최신글</h2>
|
||||||
@@ -35,6 +36,7 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
|
|||||||
<?php
|
<?php
|
||||||
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
|
// 이 함수가 바로 최신글을 추출하는 역할을 합니다.
|
||||||
// 사용방법 : latest(스킨, 게시판아이디, 출력라인, 글자수);
|
// 사용방법 : latest(스킨, 게시판아이디, 출력라인, 글자수);
|
||||||
|
// 테마의 스킨을 사용하려면 theme/basic 과 같이 지정
|
||||||
echo latest("basic", $row['bo_table'], 5, 25);
|
echo latest("basic", $row['bo_table'], 5, 25);
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
@@ -44,5 +46,5 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
|
|||||||
<!-- } 최신글 끝 -->
|
<!-- } 최신글 끝 -->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once('./_tail.php');
|
include_once(G5_PATH.'/tail.php');
|
||||||
?>
|
?>
|
||||||
@@ -185,12 +185,10 @@ CREATE TABLE IF NOT EXISTS `g5_board_new` (
|
|||||||
DROP TABLE IF EXISTS `g5_config`;
|
DROP TABLE IF EXISTS `g5_config`;
|
||||||
CREATE TABLE IF NOT EXISTS `g5_config` (
|
CREATE TABLE IF NOT EXISTS `g5_config` (
|
||||||
`cf_title` varchar(255) NOT NULL DEFAULT '',
|
`cf_title` varchar(255) NOT NULL DEFAULT '',
|
||||||
|
`cf_theme` varchar(255) NOT NULL DEFAULT '',
|
||||||
`cf_admin` varchar(255) NOT NULL DEFAULT '',
|
`cf_admin` varchar(255) NOT NULL DEFAULT '',
|
||||||
`cf_admin_email` varchar(255) NOT NULL DEFAULT '',
|
`cf_admin_email` varchar(255) NOT NULL DEFAULT '',
|
||||||
`cf_admin_email_name` varchar(255) NOT NULL DEFAULT '',
|
`cf_admin_email_name` varchar(255) NOT NULL DEFAULT '',
|
||||||
`cf_include_index` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cf_include_head` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cf_include_tail` varchar(255) NOT NULL DEFAULT '',
|
|
||||||
`cf_add_script` text NOT NULL,
|
`cf_add_script` text NOT NULL,
|
||||||
`cf_use_point` tinyint(4) NOT NULL DEFAULT '0',
|
`cf_use_point` tinyint(4) NOT NULL DEFAULT '0',
|
||||||
`cf_point_term` int(11) NOT NULL DEFAULT '0',
|
`cf_point_term` int(11) NOT NULL DEFAULT '0',
|
||||||
|
|||||||
@@ -53,10 +53,12 @@ if (!$select_db) {
|
|||||||
|
|
||||||
$mysql_set_mode = 'false';
|
$mysql_set_mode = 'false';
|
||||||
@mysql_query('set names utf8');
|
@mysql_query('set names utf8');
|
||||||
if(version_compare(mysql_get_server_info(), '5.6.6', '>=') == 1) {
|
$row = mysql_fetch_assoc(mysql_query(" SELECT @@sql_mode as mode "));
|
||||||
|
if($row['mode']) {
|
||||||
@mysql_query("SET SESSION sql_mode = ''");
|
@mysql_query("SET SESSION sql_mode = ''");
|
||||||
$mysql_set_mode = 'true';
|
$mysql_set_mode = 'true';
|
||||||
}
|
}
|
||||||
|
unset($row);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="ins_inner">
|
<div class="ins_inner">
|
||||||
@@ -90,6 +92,7 @@ $download_point = 0;
|
|||||||
// config 테이블 설정
|
// config 테이블 설정
|
||||||
$sql = " insert into `{$table_prefix}config`
|
$sql = " insert into `{$table_prefix}config`
|
||||||
set cf_title = '".G5_VERSION."',
|
set cf_title = '".G5_VERSION."',
|
||||||
|
cf_theme = 'basic',
|
||||||
cf_admin = '$admin_id',
|
cf_admin = '$admin_id',
|
||||||
cf_admin_email = '$admin_email',
|
cf_admin_email = '$admin_email',
|
||||||
cf_admin_email_name = '".G5_VERSION."',
|
cf_admin_email_name = '".G5_VERSION."',
|
||||||
|
|||||||
+2
-2
@@ -69,7 +69,7 @@ $(function(){
|
|||||||
});
|
});
|
||||||
|
|
||||||
// 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌
|
// 임시저장된 글 제목과 내용을 가져와서 제목과 내용 입력박스에 노출해 줌
|
||||||
$(".autosave_load").live("click", function(){
|
$(document).on( "click", ".autosave_load", function(){
|
||||||
var $li = $(this).parents("li");
|
var $li = $(this).parents("li");
|
||||||
var as_id = $li.data("as_id");
|
var as_id = $li.data("as_id");
|
||||||
var as_uid = $li.data("uid");
|
var as_uid = $li.data("uid");
|
||||||
@@ -93,7 +93,7 @@ $(function(){
|
|||||||
$("#autosave_pop").hide();
|
$("#autosave_pop").hide();
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".autosave_del").live("click", function(){
|
$(document).on( "click", ".autosave_del", function(){
|
||||||
var $li = $(this).parents("li");
|
var $li = $(this).parents("li");
|
||||||
var as_id = $li.data("as_id");
|
var as_id = $li.data("as_id");
|
||||||
$.get(g5_bbs_url+"/ajax.autosavedel.php", {"as_id":as_id}, function(data){
|
$.get(g5_bbs_url+"/ajax.autosavedel.php", {"as_id":as_id}, function(data){
|
||||||
|
|||||||
+1
-1
@@ -674,7 +674,7 @@ $(function(){
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("textarea#wr_content[maxlength]").live("keyup change", function() {
|
$(document).on( "keyup change", "textarea#wr_content[maxlength]", function(){
|
||||||
var str = $(this).val();
|
var str = $(this).val();
|
||||||
var mx = parseInt($(this).attr("maxlength"));
|
var mx = parseInt($(this).attr("maxlength"));
|
||||||
if (str.length > mx) {
|
if (str.length > mx) {
|
||||||
|
|||||||
+38
-3
@@ -2066,7 +2066,7 @@ function delete_editor_thumbnail($contents)
|
|||||||
|
|
||||||
for($i=0; $i<count($matchs[1]); $i++) {
|
for($i=0; $i<count($matchs[1]); $i++) {
|
||||||
// 이미지 path 구함
|
// 이미지 path 구함
|
||||||
$imgurl = parse_url($matchs[1][$i]);
|
$imgurl = @parse_url($matchs[1][$i]);
|
||||||
$srcfile = $_SERVER['DOCUMENT_ROOT'].$imgurl['path'];
|
$srcfile = $_SERVER['DOCUMENT_ROOT'].$imgurl['path'];
|
||||||
|
|
||||||
$filename = preg_replace("/\.[^\.]+$/i", "", basename($srcfile));
|
$filename = preg_replace("/\.[^\.]+$/i", "", basename($srcfile));
|
||||||
@@ -2857,7 +2857,7 @@ function check_url_host($url, $msg='', $return_url=G5_URL)
|
|||||||
if(!$msg)
|
if(!$msg)
|
||||||
$msg = 'url에 타 도메인을 지정할 수 없습니다.';
|
$msg = 'url에 타 도메인을 지정할 수 없습니다.';
|
||||||
|
|
||||||
$p = parse_url($url);
|
$p = @parse_url($url);
|
||||||
$host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']);
|
$host = preg_replace('/:[0-9]+$/', '', $_SERVER['HTTP_HOST']);
|
||||||
|
|
||||||
if ((isset($p['scheme']) && $p['scheme']) || (isset($p['host']) && $p['host'])) {
|
if ((isset($p['scheme']) && $p['scheme']) || (isset($p['host']) && $p['host'])) {
|
||||||
@@ -2962,7 +2962,7 @@ function clean_query_string($query, $amp=true)
|
|||||||
|
|
||||||
function get_device_change_url()
|
function get_device_change_url()
|
||||||
{
|
{
|
||||||
$p = parse_url(G5_URL);
|
$p = @parse_url(G5_URL);
|
||||||
$href = $p['scheme'].'://'.$p['host'];
|
$href = $p['scheme'].'://'.$p['host'];
|
||||||
if(isset($p['port']) && $p['port'])
|
if(isset($p['port']) && $p['port'])
|
||||||
$href .= ':'.$p['port'];
|
$href .= ':'.$p['port'];
|
||||||
@@ -2993,4 +2993,39 @@ function get_device_change_url()
|
|||||||
|
|
||||||
return $href;
|
return $href;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 스킨 path
|
||||||
|
function get_skin_path($dir, $skin)
|
||||||
|
{
|
||||||
|
global $config;
|
||||||
|
|
||||||
|
if(preg_match('#^theme/(.+)$#', $skin, $match)) { // 테마에 포함된 스킨이라면
|
||||||
|
$theme_path = '';
|
||||||
|
$cf_theme = trim($config['cf_theme']);
|
||||||
|
|
||||||
|
$theme_path = G5_PATH.'/'.G5_THEME_DIR.'/'.$cf_theme;
|
||||||
|
if(G5_IS_MOBILE) {
|
||||||
|
$skin_path = $theme_path.'/'.G5_MOBILE_DIR.'/'.G5_SKIN_DIR.'/'.$dir.'/'.$match[1];
|
||||||
|
if(!is_dir($skin_path))
|
||||||
|
$skin_path = $theme_path.'/'.G5_SKIN_DIR.'/'.$dir.'/'.$match[1];
|
||||||
|
} else {
|
||||||
|
$skin_path = $theme_path.'/'.G5_SKIN_DIR.'/'.$dir.'/'.$match[1];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if(G5_IS_MOBILE)
|
||||||
|
$skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/'.$dir.'/'.$skin;
|
||||||
|
else
|
||||||
|
$skin_path = G5_SKIN_PATH.'/'.$dir.'/'.$skin;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $skin_path;
|
||||||
|
}
|
||||||
|
|
||||||
|
// 스킨 url
|
||||||
|
function get_skin_url($dir, $skin)
|
||||||
|
{
|
||||||
|
$skin_path = get_skin_path($dir, $skin);
|
||||||
|
|
||||||
|
return str_replace(G5_PATH, G5_URL, $skin_path);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
+18
-5
@@ -10,12 +10,25 @@ function connect($skin_dir='basic')
|
|||||||
$sql = " select sum(IF(mb_id<>'',1,0)) as mb_cnt, count(*) as total_cnt from {$g5['login_table']} where mb_id <> '{$config['cf_admin']}' ";
|
$sql = " select sum(IF(mb_id<>'',1,0)) as mb_cnt, count(*) as total_cnt from {$g5['login_table']} where mb_id <> '{$config['cf_admin']}' ";
|
||||||
$row = sql_fetch($sql);
|
$row = sql_fetch($sql);
|
||||||
|
|
||||||
if(G5_IS_MOBILE) {
|
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||||
$connect_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/connect/'.$skin_dir;
|
if (G5_IS_MOBILE) {
|
||||||
$connect_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/connect/'.$skin_dir;
|
$connect_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/connect/'.$match[1];
|
||||||
|
if(!is_dir($connect_skin_path))
|
||||||
|
$connect_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/connect/'.$match[1];
|
||||||
|
$connect_skin_url = str_replace(G5_PATH, G5_URL, $connect_skin_path);
|
||||||
|
} else {
|
||||||
|
$connect_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/connect/'.$match[1];
|
||||||
|
$connect_skin_url = str_replace(G5_PATH, G5_URL, $connect_skin_path);
|
||||||
|
}
|
||||||
|
$skin_dir = $match[1];
|
||||||
} else {
|
} else {
|
||||||
$connect_skin_path = G5_SKIN_PATH.'/connect/'.$skin_dir;
|
if(G5_IS_MOBILE) {
|
||||||
$connect_skin_url = G5_SKIN_URL.'/connect/'.$skin_dir;
|
$connect_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/connect/'.$skin_dir;
|
||||||
|
$connect_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/connect/'.$skin_dir;
|
||||||
|
} else {
|
||||||
|
$connect_skin_path = G5_SKIN_PATH.'/connect/'.$skin_dir;
|
||||||
|
$connect_skin_url = G5_SKIN_URL.'/connect/'.$skin_dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|||||||
@@ -0,0 +1,79 @@
|
|||||||
|
<?php
|
||||||
|
if (!defined('_GNUBOARD_')) exit;
|
||||||
|
|
||||||
|
// http://tinsology.net/2011/04/php-json_encode-and-json_decode-alternatives/
|
||||||
|
|
||||||
|
if(!function_exists('json_encode'))
|
||||||
|
{
|
||||||
|
function json_encode($a=false)
|
||||||
|
{
|
||||||
|
// Some basic debugging to ensure we have something returned
|
||||||
|
if (is_null($a)) return 'null';
|
||||||
|
if ($a === false) return 'false';
|
||||||
|
if ($a === true) return 'true';
|
||||||
|
if (is_scalar($a))
|
||||||
|
{
|
||||||
|
if (is_float($a))
|
||||||
|
{
|
||||||
|
// Always use '.' for floats.
|
||||||
|
return floatval(str_replace(',', '.', strval($a)));
|
||||||
|
}
|
||||||
|
if (is_string($a))
|
||||||
|
{
|
||||||
|
static $jsonReplaces = array(array('\\', '/', "\n", "\t", "\r", "\b", "\f", '"'), array('\\\\', '\\/', '\\n', '\\t', '\\r', '\\b', '\\f', '\"'));
|
||||||
|
return '"' . str_replace($jsonReplaces[0], $jsonReplaces[1], $a) . '"';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return $a;
|
||||||
|
}
|
||||||
|
$isList = true;
|
||||||
|
for ($i = 0, reset($a); true; $i++) {
|
||||||
|
if (key($a) !== $i)
|
||||||
|
{
|
||||||
|
$isList = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$result = array();
|
||||||
|
if ($isList)
|
||||||
|
{
|
||||||
|
foreach ($a as $v) $result[] = json_encode($v);
|
||||||
|
return '[' . join(',', $result) . ']';
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
foreach ($a as $k => $v) $result[] = json_encode($k).':'.json_encode($v);
|
||||||
|
return '{' . join(',', $result) . '}';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!function_exists('json_decode'))
|
||||||
|
{
|
||||||
|
function json_decode($json)
|
||||||
|
{
|
||||||
|
$comment = false;
|
||||||
|
$out = '$x=';
|
||||||
|
for ($i=0; $i<strlen($json); $i++)
|
||||||
|
{
|
||||||
|
if (!$comment)
|
||||||
|
{
|
||||||
|
if (($json[$i] == '{') || ($json[$i] == '['))
|
||||||
|
$out .= ' array(';
|
||||||
|
else if (($json[$i] == '}') || ($json[$i] == ']'))
|
||||||
|
$out .= ')';
|
||||||
|
else if ($json[$i] == ':')
|
||||||
|
$out .= '=>';
|
||||||
|
else
|
||||||
|
$out .= $json[$i];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$out .= $json[$i];
|
||||||
|
if ($json[$i] == '"' && $json[($i-1)]!="\\")
|
||||||
|
$comment = !$comment;
|
||||||
|
}
|
||||||
|
eval($out . ';');
|
||||||
|
return $x;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
+18
-14
@@ -6,16 +6,28 @@ if (!defined('_GNUBOARD_')) exit;
|
|||||||
function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='')
|
function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=1, $options='')
|
||||||
{
|
{
|
||||||
global $g5;
|
global $g5;
|
||||||
//static $css = array();
|
|
||||||
|
|
||||||
if (!$skin_dir) $skin_dir = 'basic';
|
if (!$skin_dir) $skin_dir = 'basic';
|
||||||
|
|
||||||
if(G5_IS_MOBILE) {
|
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||||
$latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
if (G5_IS_MOBILE) {
|
||||||
$latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
$latest_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||||
|
if(!is_dir($latest_skin_path))
|
||||||
|
$latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||||
|
$latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
|
||||||
|
} else {
|
||||||
|
$latest_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/latest/'.$match[1];
|
||||||
|
$latest_skin_url = str_replace(G5_PATH, G5_URL, $latest_skin_path);
|
||||||
|
}
|
||||||
|
$skin_dir = $match[1];
|
||||||
} else {
|
} else {
|
||||||
$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
|
if(G5_IS_MOBILE) {
|
||||||
$latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
|
$latest_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
||||||
|
$latest_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/latest/'.$skin_dir;
|
||||||
|
} else {
|
||||||
|
$latest_skin_path = G5_SKIN_PATH.'/latest/'.$skin_dir;
|
||||||
|
$latest_skin_url = G5_SKIN_URL.'/latest/'.$skin_dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$cache_fwrite = false;
|
$cache_fwrite = false;
|
||||||
@@ -60,14 +72,6 @@ function latest($skin_dir='', $bo_table, $rows=10, $subject_len=40, $cache_time=
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// 같은 스킨은 .css 를 한번만 호출한다.
|
|
||||||
if (!in_array($skin_dir, $css) && is_file($latest_skin_path.'/style.css')) {
|
|
||||||
echo '<link rel="stylesheet" href="'.$latest_skin_url.'/style.css">';
|
|
||||||
$css[] = $skin_dir;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
include $latest_skin_path.'/latest.skin.php';
|
include $latest_skin_path.'/latest.skin.php';
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
|
|||||||
+18
-5
@@ -13,12 +13,25 @@ function outlogin($skin_dir='basic')
|
|||||||
$point = number_format($member['mb_point']);
|
$point = number_format($member['mb_point']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (G5_IS_MOBILE) {
|
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||||
$outlogin_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$skin_dir;
|
if (G5_IS_MOBILE) {
|
||||||
$outlogin_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/outlogin/'.$skin_dir;
|
$outlogin_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$match[1];
|
||||||
|
if(!is_dir($outlogin_skin_path))
|
||||||
|
$outlogin_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$match[1];
|
||||||
|
$outlogin_skin_url = str_replace(G5_PATH, G5_URL, $outlogin_skin_path);
|
||||||
|
} else {
|
||||||
|
$outlogin_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$match[1];
|
||||||
|
$outlogin_skin_url = str_replace(G5_PATH, G5_URL, $outlogin_skin_path);
|
||||||
|
}
|
||||||
|
$skin_dir = $match[1];
|
||||||
} else {
|
} else {
|
||||||
$outlogin_skin_path = G5_SKIN_PATH.'/outlogin/'.$skin_dir;
|
if (G5_IS_MOBILE) {
|
||||||
$outlogin_skin_url = G5_SKIN_URL.'/outlogin/'.$skin_dir;
|
$outlogin_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/outlogin/'.$skin_dir;
|
||||||
|
$outlogin_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/outlogin/'.$skin_dir;
|
||||||
|
} else {
|
||||||
|
$outlogin_skin_path = G5_SKIN_PATH.'/outlogin/'.$skin_dir;
|
||||||
|
$outlogin_skin_url = G5_SKIN_URL.'/outlogin/'.$skin_dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 읽지 않은 쪽지가 있다면
|
// 읽지 않은 쪽지가 있다면
|
||||||
|
|||||||
+21
-7
@@ -15,16 +15,30 @@ function poll($skin_dir='basic', $po_id=false)
|
|||||||
if(!$po_id)
|
if(!$po_id)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||||
|
if (G5_IS_MOBILE) {
|
||||||
|
$poll_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||||
|
if(!is_dir($poll_skin_path))
|
||||||
|
$poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||||
|
$poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path);
|
||||||
|
} else {
|
||||||
|
$poll_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/poll/'.$match[1];
|
||||||
|
$poll_skin_url = str_replace(G5_PATH, G5_URL, $poll_skin_path);
|
||||||
|
}
|
||||||
|
//$skin_dir = $match[1];
|
||||||
|
} else {
|
||||||
|
if (G5_IS_MOBILE) {
|
||||||
|
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||||
|
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
||||||
|
} else {
|
||||||
|
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
||||||
|
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '$po_id' ");
|
$po = sql_fetch(" select * from {$g5['poll_table']} where po_id = '$po_id' ");
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
if (G5_IS_MOBILE) {
|
|
||||||
$poll_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
|
||||||
$poll_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/poll/'.$skin_dir;
|
|
||||||
} else {
|
|
||||||
$poll_skin_path = G5_SKIN_PATH.'/poll/'.$skin_dir;
|
|
||||||
$poll_skin_url = G5_SKIN_URL.'/poll/'.$skin_dir;
|
|
||||||
}
|
|
||||||
include_once ($poll_skin_path.'/poll.skin.php');
|
include_once ($poll_skin_path.'/poll.skin.php');
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|||||||
+20
-6
@@ -20,14 +20,28 @@ function popular($skin_dir='basic', $pop_cnt=7, $date_cnt=3)
|
|||||||
$list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
|
$list[$i]['pp_word'] = get_text($list[$i]['pp_word']);
|
||||||
}
|
}
|
||||||
|
|
||||||
ob_start();
|
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||||
if(G5_IS_MOBILE) {
|
if (G5_IS_MOBILE) {
|
||||||
$popular_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/popular/'.$skin_dir;
|
$popular_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/popular/'.$match[1];
|
||||||
$popular_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/popular/'.$skin_dir;
|
if(!is_dir($popular_skin_path))
|
||||||
|
$popular_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/popular/'.$match[1];
|
||||||
|
$popular_skin_url = str_replace(G5_PATH, G5_URL, $popular_skin_path);
|
||||||
|
} else {
|
||||||
|
$popular_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/popular/'.$match[1];
|
||||||
|
$popular_skin_url = str_replace(G5_PATH, G5_URL,$popular_skin_path);
|
||||||
|
}
|
||||||
|
$skin_dir = $match[1];
|
||||||
} else {
|
} else {
|
||||||
$popular_skin_path = G5_SKIN_PATH.'/popular/'.$skin_dir;
|
if(G5_IS_MOBILE) {
|
||||||
$popular_skin_url = G5_SKIN_URL.'/popular/'.$skin_dir;
|
$popular_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/popular/'.$skin_dir;
|
||||||
|
$popular_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/popular/'.$skin_dir;
|
||||||
|
} else {
|
||||||
|
$popular_skin_path = G5_SKIN_PATH.'/popular/'.$skin_dir;
|
||||||
|
$popular_skin_url = G5_SKIN_URL.'/popular/'.$skin_dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
include_once ($popular_skin_path.'/popular.skin.php');
|
include_once ($popular_skin_path.'/popular.skin.php');
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|||||||
@@ -59,15 +59,19 @@ function get_list_thumbnail($bo_table, $wr_id, $thumb_width, $thumb_height, $is_
|
|||||||
|
|
||||||
if($tname) {
|
if($tname) {
|
||||||
if($edt) {
|
if($edt) {
|
||||||
|
// 오리지날 이미지
|
||||||
|
$ori = G5_URL.$data_path;
|
||||||
|
// 썸네일 이미지
|
||||||
$src = G5_URL.str_replace($filename, $tname, $data_path);
|
$src = G5_URL.str_replace($filename, $tname, $data_path);
|
||||||
} else {
|
} else {
|
||||||
|
$ori = G5_DATA_URL.'/file/'.$bo_table.'/'.$filename;
|
||||||
$src = G5_DATA_URL.'/file/'.$bo_table.'/'.$tname;
|
$src = G5_DATA_URL.'/file/'.$bo_table.'/'.$tname;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$thumb = array("src"=>$src, "alt"=>$alt);
|
$thumb = array("src"=>$src, "ori"=>$ori, "alt"=>$alt);
|
||||||
|
|
||||||
return $thumb;
|
return $thumb;
|
||||||
}
|
}
|
||||||
|
|||||||
+20
-6
@@ -18,14 +18,28 @@ function visit($skin_dir='basic')
|
|||||||
settype($visit[3], "integer");
|
settype($visit[3], "integer");
|
||||||
settype($visit[4], "integer");
|
settype($visit[4], "integer");
|
||||||
|
|
||||||
ob_start();
|
if(preg_match('#^theme/(.+)$#', $skin_dir, $match)) {
|
||||||
if(G5_IS_MOBILE) {
|
if (G5_IS_MOBILE) {
|
||||||
$visit_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/visit/'.$skin_dir;
|
$visit_skin_path = G5_THEME_MOBILE_PATH.'/'.G5_SKIN_DIR.'/visit/'.$match[1];
|
||||||
$visit_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/visit/'.$skin_dir;
|
if(!is_dir($visit_skin_path))
|
||||||
|
$visit_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/visit/'.$match[1];
|
||||||
|
$visit_skin_url = str_replace(G5_PATH, G5_URL, $visit_skin_path);
|
||||||
|
} else {
|
||||||
|
$visit_skin_path = G5_THEME_PATH.'/'.G5_SKIN_DIR.'/visit/'.$match[1];
|
||||||
|
$visit_skin_url = str_replace(G5_PATH, G5_URL, $visit_skin_path);
|
||||||
|
}
|
||||||
|
$skin_dir = $match[1];
|
||||||
} else {
|
} else {
|
||||||
$visit_skin_path = G5_SKIN_PATH.'/visit/'.$skin_dir;
|
if(G5_IS_MOBILE) {
|
||||||
$visit_skin_url = G5_SKIN_URL.'/visit/'.$skin_dir;
|
$visit_skin_path = G5_MOBILE_PATH.'/'.G5_SKIN_DIR.'/visit/'.$skin_dir;
|
||||||
|
$visit_skin_url = G5_MOBILE_URL.'/'.G5_SKIN_DIR.'/visit/'.$skin_dir;
|
||||||
|
} else {
|
||||||
|
$visit_skin_path = G5_SKIN_PATH.'/visit/'.$skin_dir;
|
||||||
|
$visit_skin_url = G5_SKIN_URL.'/visit/'.$skin_dir;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ob_start();
|
||||||
include_once ($visit_skin_path.'/visit.skin.php');
|
include_once ($visit_skin_path.'/visit.skin.php');
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|||||||
+2
-2
@@ -49,8 +49,8 @@ $str = preg_replace($src, $dst, $str);
|
|||||||
if(trim($co['co_mobile_skin']) == '')
|
if(trim($co['co_mobile_skin']) == '')
|
||||||
$co['co_mobile_skin'] = 'basic';
|
$co['co_mobile_skin'] = 'basic';
|
||||||
|
|
||||||
$content_skin_path = G5_MOBILE_PATH .'/'.G5_SKIN_DIR.'/content/'.$co['co_mobile_skin'];
|
$content_skin_path = get_skin_path('content', $co['co_mobile_skin']);
|
||||||
$content_skin_url = G5_MOBILE_URL .'/'.G5_SKIN_DIR.'/content/'.$co['co_mobile_skin'];
|
$content_skin_url = get_skin_url('content', $co['co_mobile_skin']);
|
||||||
$skin_file = $content_skin_path.'/content.skin.php';
|
$skin_file = $content_skin_path.'/content.skin.php';
|
||||||
|
|
||||||
if(is_file($skin_file)) {
|
if(is_file($skin_file)) {
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
|
if(defined('G5_THEME_PATH')) {
|
||||||
|
require_once(G5_THEME_PATH.'/head.php');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
include_once(G5_PATH.'/head.sub.php');
|
include_once(G5_PATH.'/head.sub.php');
|
||||||
include_once(G5_LIB_PATH.'/latest.lib.php');
|
include_once(G5_LIB_PATH.'/latest.lib.php');
|
||||||
include_once(G5_LIB_PATH.'/outlogin.lib.php');
|
include_once(G5_LIB_PATH.'/outlogin.lib.php');
|
||||||
|
|||||||
+7
-2
@@ -1,7 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
include_once(G5_MOBILE_PATH.'/_head.php');
|
if(defined('G5_THEME_PATH')) {
|
||||||
|
require_once(G5_THEME_PATH.'/index.php');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
include_once(G5_MOBILE_PATH.'/head.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- 메인화면 최신글 시작 -->
|
<!-- 메인화면 최신글 시작 -->
|
||||||
@@ -26,5 +31,5 @@ for ($i=0; $row=sql_fetch_array($result); $i++) {
|
|||||||
<!-- 메인화면 최신글 끝 -->
|
<!-- 메인화면 최신글 끝 -->
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
include_once(G5_MOBILE_PATH.'/_tail.php');
|
include_once(G5_MOBILE_PATH.'/tail.php');
|
||||||
?>
|
?>
|
||||||
@@ -179,7 +179,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// 코멘트 입출력
|
// 코멘트 입출력
|
||||||
include_once('./view_comment.php');
|
include_once(G5_BBS_PATH.'/view_comment.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="bo_v_bot">
|
<div id="bo_v_bot">
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$board_skin_url.'/style.css">', 0
|
|||||||
|
|
||||||
<?php
|
<?php
|
||||||
// 코멘트 입출력
|
// 코멘트 입출력
|
||||||
include_once('./view_comment.php');
|
include_once(G5_BBS_PATH.'/view_comment.php');
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div id="bo_v_bot">
|
<div id="bo_v_bot">
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ add_stylesheet('<link rel="stylesheet" href="'.$member_skin_url.'/style.css">',
|
|||||||
<ul id="memo_list_ul">
|
<ul id="memo_list_ul">
|
||||||
<?php for ($i=0; $i<count($list); $i++) { ?>
|
<?php for ($i=0; $i<count($list); $i++) { ?>
|
||||||
<li>
|
<li>
|
||||||
<a href="<?php echo $list[$i]['view_href'] ?>" class="memo_link"><?php echo $list[$i]['send_datetime'] ?> 에 받은 쪽지</a>
|
<a href="<?php echo $list[$i]['view_href'] ?>" class="memo_link"><?php echo $list[$i]['send_datetime'] ?> 에 <?php echo ($kind == "recv") ? "받은" : "보낸"; ?> 쪽지</a>
|
||||||
<span class="memo_read"><?php echo $list[$i]['read_datetime'] ?></span>
|
<span class="memo_read"><?php echo $list[$i]['read_datetime'] ?></span>
|
||||||
<span class="memo_send"><?php echo $list[$i]['name'] ?></span>
|
<span class="memo_send"><?php echo $list[$i]['name'] ?></span>
|
||||||
<a href="<?php echo $list[$i]['del_href'] ?>" onclick="del(this.href); return false;" class="memo_del">삭제</a>
|
<a href="<?php echo $list[$i]['del_href'] ?>" onclick="del(this.href); return false;" class="memo_del">삭제</a>
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
if (!defined('_GNUBOARD_')) exit; // 개별 페이지 접근 불가
|
||||||
|
|
||||||
|
if(defined('G5_THEME_PATH')) {
|
||||||
|
require_once(G5_THEME_PATH.'/tail.php');
|
||||||
|
return;
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ function editor_html($id, $content, $is_dhtml_editor=true)
|
|||||||
$(this).text("단축키 일람 닫기");
|
$(this).text("단축키 일람 닫기");
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$(".btn_cke_sc_close").live("click",function(){
|
$(document).on("click", ".btn_cke_sc_close", function(){
|
||||||
$(this).parent("div.cke_sc_def").remove();
|
$(this).parent("div.cke_sc_def").remove();
|
||||||
});
|
});
|
||||||
});';
|
});';
|
||||||
|
|||||||
@@ -0,0 +1,21 @@
|
|||||||
|
Title: MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
||||||
File diff suppressed because it is too large.
Load diff
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot @VERSION | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/if(!document.createElement("canvas").getContext){(function(){var ab=Math;var n=ab.round;var l=ab.sin;var A=ab.cos;var H=ab.abs;var N=ab.sqrt;var d=10;var f=d/2;var z=+navigator.userAgent.match(/MSIE ([\d.]+)?/)[1];function y(){return this.context_||(this.context_=new D(this))}var t=Array.prototype.slice;function g(j,m,p){var i=t.call(arguments,2);return function(){return j.apply(m,i.concat(t.call(arguments)))}}function af(i){return String(i).replace(/&/g,"&").replace(/"/g,""")}function Y(m,j,i){if(!m.namespaces[j]){m.namespaces.add(j,i,"#default#VML")}}function R(j){Y(j,"g_vml_","urn:schemas-microsoft-com:vml");Y(j,"g_o_","urn:schemas-microsoft-com:office:office");if(!j.styleSheets.ex_canvas_){var i=j.createStyleSheet();i.owningElement.id="ex_canvas_";i.cssText="canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}"}}R(document);var e={init:function(i){var j=i||document;j.createElement("canvas");j.attachEvent("onreadystatechange",g(this.init_,this,j))},init_:function(p){var m=p.getElementsByTagName("canvas");for(var j=0;j<m.length;j++){this.initElement(m[j])}},initElement:function(j){if(!j.getContext){j.getContext=y;R(j.ownerDocument);j.innerHTML="";j.attachEvent("onpropertychange",x);j.attachEvent("onresize",W);var i=j.attributes;if(i.width&&i.width.specified){j.style.width=i.width.nodeValue+"px"}else{j.width=j.clientWidth}if(i.height&&i.height.specified){j.style.height=i.height.nodeValue+"px"}else{j.height=j.clientHeight}}return j},uninitElement:function(j){if(j.getContext){var i=j.getContext();delete i.element_;delete i.canvas;j.innerHTML="";j.context_=null;j.getContext=null;j.detachEvent("onpropertychange",x);j.detachEvent("onresize",W)}}};function x(j){var i=j.srcElement;switch(j.propertyName){case"width":i.getContext().clearRect();i.style.width=i.attributes.width.nodeValue+"px";i.firstChild.style.width=i.clientWidth+"px";break;case"height":i.getContext().clearRect();i.style.height=i.attributes.height.nodeValue+"px";i.firstChild.style.height=i.clientHeight+"px";break}}function W(j){var i=j.srcElement;if(i.firstChild){i.firstChild.style.width=i.clientWidth+"px";i.firstChild.style.height=i.clientHeight+"px"}}e.init();var k=[];for(var ae=0;ae<16;ae++){for(var ad=0;ad<16;ad++){k[ae*16+ad]=ae.toString(16)+ad.toString(16)}}function B(){return[[1,0,0],[0,1,0],[0,0,1]]}function J(p,m){var j=B();for(var i=0;i<3;i++){for(var ah=0;ah<3;ah++){var Z=0;for(var ag=0;ag<3;ag++){Z+=p[i][ag]*m[ag][ah]}j[i][ah]=Z}}return j}function v(j,i){i.fillStyle=j.fillStyle;i.lineCap=j.lineCap;i.lineJoin=j.lineJoin;i.lineWidth=j.lineWidth;i.miterLimit=j.miterLimit;i.shadowBlur=j.shadowBlur;i.shadowColor=j.shadowColor;i.shadowOffsetX=j.shadowOffsetX;i.shadowOffsetY=j.shadowOffsetY;i.strokeStyle=j.strokeStyle;i.globalAlpha=j.globalAlpha;i.font=j.font;i.textAlign=j.textAlign;i.textBaseline=j.textBaseline;i.arcScaleX_=j.arcScaleX_;i.arcScaleY_=j.arcScaleY_;i.lineScale_=j.lineScale_}var b={aliceblue:"#F0F8FF",antiquewhite:"#FAEBD7",aquamarine:"#7FFFD4",azure:"#F0FFFF",beige:"#F5F5DC",bisque:"#FFE4C4",black:"#000000",blanchedalmond:"#FFEBCD",blueviolet:"#8A2BE2",brown:"#A52A2A",burlywood:"#DEB887",cadetblue:"#5F9EA0",chartreuse:"#7FFF00",chocolate:"#D2691E",coral:"#FF7F50",cornflowerblue:"#6495ED",cornsilk:"#FFF8DC",crimson:"#DC143C",cyan:"#00FFFF",darkblue:"#00008B",darkcyan:"#008B8B",darkgoldenrod:"#B8860B",darkgray:"#A9A9A9",darkgreen:"#006400",darkgrey:"#A9A9A9",darkkhaki:"#BDB76B",darkmagenta:"#8B008B",darkolivegreen:"#556B2F",darkorange:"#FF8C00",darkorchid:"#9932CC",darkred:"#8B0000",darksalmon:"#E9967A",darkseagreen:"#8FBC8F",darkslateblue:"#483D8B",darkslategray:"#2F4F4F",darkslategrey:"#2F4F4F",darkturquoise:"#00CED1",darkviolet:"#9400D3",deeppink:"#FF1493",deepskyblue:"#00BFFF",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1E90FF",firebrick:"#B22222",floralwhite:"#FFFAF0",forestgreen:"#228B22",gainsboro:"#DCDCDC",ghostwhite:"#F8F8FF",gold:"#FFD700",goldenrod:"#DAA520",grey:"#808080",greenyellow:"#ADFF2F",honeydew:"#F0FFF0",hotpink:"#FF69B4",indianred:"#CD5C5C",indigo:"#4B0082",ivory:"#FFFFF0",khaki:"#F0E68C",lavender:"#E6E6FA",lavenderblush:"#FFF0F5",lawngreen:"#7CFC00",lemonchiffon:"#FFFACD",lightblue:"#ADD8E6",lightcoral:"#F08080",lightcyan:"#E0FFFF",lightgoldenrodyellow:"#FAFAD2",lightgreen:"#90EE90",lightgrey:"#D3D3D3",lightpink:"#FFB6C1",lightsalmon:"#FFA07A",lightseagreen:"#20B2AA",lightskyblue:"#87CEFA",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#B0C4DE",lightyellow:"#FFFFE0",limegreen:"#32CD32",linen:"#FAF0E6",magenta:"#FF00FF",mediumaquamarine:"#66CDAA",mediumblue:"#0000CD",mediumorchid:"#BA55D3",mediumpurple:"#9370DB",mediumseagreen:"#3CB371",mediumslateblue:"#7B68EE",mediumspringgreen:"#00FA9A",mediumturquoise:"#48D1CC",mediumvioletred:"#C71585",midnightblue:"#191970",mintcream:"#F5FFFA",mistyrose:"#FFE4E1",moccasin:"#FFE4B5",navajowhite:"#FFDEAD",oldlace:"#FDF5E6",olivedrab:"#6B8E23",orange:"#FFA500",orangered:"#FF4500",orchid:"#DA70D6",palegoldeLine truncated
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(d){d.jqplot.BarRenderer=function(){d.jqplot.LineRenderer.call(this)};d.jqplot.BarRenderer.prototype=new d.jqplot.LineRenderer();d.jqplot.BarRenderer.prototype.constructor=d.jqplot.BarRenderer;d.jqplot.BarRenderer.prototype.init=function(o,q){this.barPadding=8;this.barMargin=10;this.barDirection="vertical";this.barWidth=null;this.shadowOffset=2;this.shadowDepth=5;this.shadowAlpha=0.08;this.waterfall=false;this.groups=1;this.varyBarColor=false;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.transposedData=true;this.renderer.animation={show:false,direction:"down",speed:3000,_supported:true};this._type="bar";if(o.highlightMouseDown&&o.highlightMouseOver==null){o.highlightMouseOver=false}d.extend(true,this,o);d.extend(true,this.renderer,o);this.fill=true;if(this.barDirection==="horizontal"&&this.rendererOptions.animation&&this.rendererOptions.animation.direction==null){this.renderer.animation.direction="left"}if(this.waterfall){this.fillToZero=false;this.disableStack=true}if(this.barDirection=="vertical"){this._primaryAxis="_xaxis";this._stackAxis="y";this.fillAxis="y"}else{this._primaryAxis="_yaxis";this._stackAxis="x";this.fillAxis="x"}this._highlightedPoint=null;this._plotSeriesInfo=null;this._dataColors=[];this._barPoints=[];var p={lineJoin:"miter",lineCap:"round",fill:true,isarc:false,strokeStyle:this.color,fillStyle:this.color,closePath:this.fill};this.renderer.shapeRenderer.init(p);var n={lineJoin:"miter",lineCap:"round",fill:true,isarc:false,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,closePath:this.fill};this.renderer.shadowRenderer.init(n);q.postInitHooks.addOnce(h);q.postDrawHooks.addOnce(j);q.eventListenerHooks.addOnce("jqplotMouseMove",b);q.eventListenerHooks.addOnce("jqplotMouseDown",a);q.eventListenerHooks.addOnce("jqplotMouseUp",l);q.eventListenerHooks.addOnce("jqplotClick",e);q.eventListenerHooks.addOnce("jqplotRightClick",m)};function g(t,p,o,w){if(this.rendererOptions.barDirection=="horizontal"){this._stackAxis="x";this._primaryAxis="_yaxis"}if(this.rendererOptions.waterfall==true){this._data=d.extend(true,[],this.data);var s=0;var u=(!this.rendererOptions.barDirection||this.rendererOptions.barDirection==="vertical"||this.transposedData===false)?1:0;for(var q=0;q<this.data.length;q++){s+=this.data[q][u];if(q>0){this.data[q][u]+=this.data[q-1][u]}}this.data[this.data.length]=(u==1)?[this.data.length+1,s]:[s,this.data.length+1];this._data[this._data.length]=(u==1)?[this._data.length+1,s]:[s,this._data.length+1]}if(this.rendererOptions.groups>1){this.breakOnNull=true;var n=this.data.length;var v=parseInt(n/this.rendererOptions.groups,10);var r=0;for(var q=v;q<n;q+=v){this.data.splice(q+r,0,[null,null]);this._plotData.splice(q+r,0,[null,null]);this._stackData.splice(q+r,0,[null,null]);r++}for(q=0;q<this.data.length;q++){if(this._primaryAxis=="_xaxis"){this.data[q][0]=q+1;this._plotData[q][0]=q+1;this._stackData[q][0]=q+1}else{this.data[q][1]=q+1;this._plotData[q][1]=q+1;this._stackData[q][1]=q+1}}}}d.jqplot.preSeriesInitHooks.push(g);d.jqplot.BarRenderer.prototype.calcSeriesNumbers=function(){var r=0;var t=0;var q=this[this._primaryAxis];var p,o,u;for(var n=0;n<q._series.length;n++){o=q._series[n];if(o===this){u=n}if(o.renderer.constructor==d.jqplot.BarRenderer){r+=o.data.length;t+=1}}return[r,t,u]};d.jqplot.BarRenderer.prototype.setBarWidth=function(){var q;var n=0;var o=0;var t=this[this._primaryAxis];var x,r,v;var w=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);n=w[0];o=w[1];var u=t.numberTicks;var p=(u-1)/2;if(t.name=="xaxis"||t.name=="x2axis"){if(this._stack){this.barWidth=(t._offsets.max-t._offsets.min)/n*o-this.barMargin}else{this.barWidth=((t._offsets.max-t._offsets.min)/p-this.barPadding*(o-1)-this.barMargin*2)/o}}else{if(this._stack){this.barWidth=(t._offsets.min-t._offsets.max)/n*o-this.barMargin}else{this.barWidth=((t._offsets.min-t._offsets.max)/p-this.barPadding*(o-1)-this.barMargin*2)/o}}return[n,o]};function f(o){var q=[];for(var s=0;s<o.length;s++){var r=d.jqplot.getColorComponents(o[s]);var n=[r[0],r[1],r[2]];var t=n[0]+n[1]+n[2];for(var p=0;p<3;p++){n[p]=(t>570)?n[p]*0.8:n[p]+0.3*(255-n[p]);n[p]=parseInt(n[p],10)}q.push("rgb("+n[0]+","+n[1]+","+n[2]+")")}return q}function i(v,u,s,t,o){var q=v,w=v-1,n,p,r=(o==="x")?0:1;if(q>0){p=t.series[w]._plotData[u][r];if((s*p)<0){n=i(w,u,s,t,o)}else{n=t.series[w].gridData[u][r]}}else{n=(r===0)?t.series[q]._xaxis.series_u2p(0):t.series[q]._yaxis.series_u2p(0)}return n}d.jqplot.BarRenderer.prototype.draw=function(E,L,q,G){var I;var A=d.extend({},q);var w=(A.shadow!=undefined)?A.shadow:this.shadow;var O=(A.showLine!=undefined)?A.showLine:this.showLine;var F=(A.fill!=undefined)?A.fill:this.fill;var p=this.xaxis;var J=this.yaxis;var y=this._xaxis.series_u2p;var K=this._yaxis.series_u2p;var D,C;this._dataColors=[];this._barPoints=[];if(this.barWidth==null){this.renderer.setBarWidth.call(this)}var N=this._plotSeriesInfo=this.renLine truncated
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(a){a.jqplot.CategoryAxisRenderer=function(b){a.jqplot.LinearAxisRenderer.call(this);this.sortMergedLabels=false};a.jqplot.CategoryAxisRenderer.prototype=new a.jqplot.LinearAxisRenderer();a.jqplot.CategoryAxisRenderer.prototype.constructor=a.jqplot.CategoryAxisRenderer;a.jqplot.CategoryAxisRenderer.prototype.init=function(e){this.groups=1;this.groupLabels=[];this._groupLabels=[];this._grouped=false;this._barsPerGroup=null;this.reverse=false;a.extend(true,this,{tickOptions:{formatString:"%d"}},e);var b=this._dataBounds;for(var f=0;f<this._series.length;f++){var g=this._series[f];if(g.groups){this.groups=g.groups}var h=g.data;for(var c=0;c<h.length;c++){if(this.name=="xaxis"||this.name=="x2axis"){if(h[c][0]<b.min||b.min==null){b.min=h[c][0]}if(h[c][0]>b.max||b.max==null){b.max=h[c][0]}}else{if(h[c][1]<b.min||b.min==null){b.min=h[c][1]}if(h[c][1]>b.max||b.max==null){b.max=h[c][1]}}}}if(this.groupLabels.length){this.groups=this.groupLabels.length}};a.jqplot.CategoryAxisRenderer.prototype.createTicks=function(){var D=this._ticks;var z=this.ticks;var F=this.name;var C=this._dataBounds;var v,A;var q,w;var d,c;var b,x;if(z.length){if(this.groups>1&&!this._grouped){var r=z.length;var p=parseInt(r/this.groups,10);var e=0;for(var x=p;x<r;x+=p){z.splice(x+e,0," ");e++}this._grouped=true}this.min=0.5;this.max=z.length+0.5;var m=this.max-this.min;this.numberTicks=2*z.length+1;for(x=0;x<z.length;x++){b=this.min+2*x*m/(this.numberTicks-1);var h=new this.tickRenderer(this.tickOptions);h.showLabel=false;h.setTick(b,this.name);this._ticks.push(h);var h=new this.tickRenderer(this.tickOptions);h.label=z[x];h.showMark=false;h.showGridline=false;h.setTick(b+0.5,this.name);this._ticks.push(h)}var h=new this.tickRenderer(this.tickOptions);h.showLabel=false;h.setTick(b+1,this.name);this._ticks.push(h)}else{if(F=="xaxis"||F=="x2axis"){v=this._plotDimensions.width}else{v=this._plotDimensions.height}if(this.min!=null&&this.max!=null&&this.numberTicks!=null){this.tickInterval=null}if(this.min!=null&&this.max!=null&&this.tickInterval!=null){if(parseInt((this.max-this.min)/this.tickInterval,10)!=(this.max-this.min)/this.tickInterval){this.tickInterval=null}}var y=[];var B=0;var q=0.5;var w,E;var f=false;for(var x=0;x<this._series.length;x++){var k=this._series[x];for(var u=0;u<k.data.length;u++){if(this.name=="xaxis"||this.name=="x2axis"){E=k.data[u][0]}else{E=k.data[u][1]}if(a.inArray(E,y)==-1){f=true;B+=1;y.push(E)}}}if(f&&this.sortMergedLabels){if(typeof y[0]=="string"){y.sort()}else{y.sort(function(j,i){return j-i})}}this.ticks=y;for(var x=0;x<this._series.length;x++){var k=this._series[x];for(var u=0;u<k.data.length;u++){if(this.name=="xaxis"||this.name=="x2axis"){E=k.data[u][0]}else{E=k.data[u][1]}var n=a.inArray(E,y)+1;if(this.name=="xaxis"||this.name=="x2axis"){k.data[u][0]=n}else{k.data[u][1]=n}}}if(this.groups>1&&!this._grouped){var r=y.length;var p=parseInt(r/this.groups,10);var e=0;for(var x=p;x<r;x+=p+1){y[x]=" "}this._grouped=true}w=B+0.5;if(this.numberTicks==null){this.numberTicks=2*B+1}var m=w-q;this.min=q;this.max=w;var o=0;var g=parseInt(3+v/10,10);var p=parseInt(B/g,10);if(this.tickInterval==null){this.tickInterval=m/(this.numberTicks-1)}for(var x=0;x<this.numberTicks;x++){b=this.min+x*this.tickInterval;var h=new this.tickRenderer(this.tickOptions);if(x/2==parseInt(x/2,10)){h.showLabel=false;h.showMark=true}else{if(p>0&&o<p){h.showLabel=false;o+=1}else{h.showLabel=true;o=0}h.label=h.formatter(h.formatString,y[(x-1)/2]);h.showMark=false;h.showGridline=false}h.setTick(b,this.name);this._ticks.push(h)}}};a.jqplot.CategoryAxisRenderer.prototype.draw=function(b,j){if(this.show){this.renderer.createTicks.call(this);var h=0;var c;if(this._elem){this._elem.emptyForce()}this._elem=this._elem||a('<div class="jqplot-axis jqplot-'+this.name+'" style="position:absolute;"></div>');if(this.name=="xaxis"||this.name=="x2axis"){this._elem.width(this._plotDimensions.width)}else{this._elem.height(this._plotDimensions.height)}this.labelOptions.axis=this.name;this._label=new this.labelRenderer(this.labelOptions);if(this._label.show){var g=this._label.draw(b,j);g.appendTo(this._elem)}var f=this._ticks;for(var e=0;e<f.length;e++){var d=f[e];if(d.showLabel&&(!d.isMinorTick||this.showMinorTicks)){var g=d.draw(b,j);g.appendTo(this._elem)}}this._groupLabels=[];for(var e=0;e<this.groupLabels.length;e++){var g=a('<div style="position:absolute;" class="jqplot-'+this.name+'-groupLabel"></div>');g.html(this.groupLabels[e]);this._groupLabels.push(g);g.appendTo(this._elem)}}return this._elem};a.jqplot.CategoryAxisRenderer.prototype.set=function(){var e=0;var m;var k=0;var f=0;var d=(this._label==null)?false:this._label.show;if(this.show){var n=this._ticks;for(var c=0;c<n.length;c++){var g=n[c];if(g.showLabel&&(!g.isMinorTick||this.showMinorTicks)){if(this.name=="xaxis"||this.name=="x2axis"){m=g._elem.outerHeight(true)}else{m=g._elem.outerWidth(true)}if(m>e){e=m}}}var j=0;for(var c=0;c<this._groupLabels.length;c++){var b=this._groupLabels[c];Line truncated
|
||||||
+3
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(c){c.jqplot.PointLabels=function(e){this.show=c.jqplot.config.enablePlugins;this.location="n";this.labelsFromSeries=false;this.seriesLabelIndex=null;this.labels=[];this._labels=[];this.stackedValue=false;this.ypadding=6;this.xpadding=6;this.escapeHTML=true;this.edgeTolerance=-5;this.formatter=c.jqplot.DefaultTickFormatter;this.formatString="";this.hideZeros=false;this._elems=[];c.extend(true,this,e)};var a=["nw","n","ne","e","se","s","sw","w"];var d={nw:0,n:1,ne:2,e:3,se:4,s:5,sw:6,w:7};var b=["se","s","sw","w","nw","n","ne","e"];c.jqplot.PointLabels.init=function(j,h,f,g,i){var e=c.extend(true,{},f,g);e.pointLabels=e.pointLabels||{};if(this.renderer.constructor===c.jqplot.BarRenderer&&this.barDirection==="horizontal"&&!e.pointLabels.location){e.pointLabels.location="e"}this.plugins.pointLabels=new c.jqplot.PointLabels(e.pointLabels);this.plugins.pointLabels.setLabels.call(this)};c.jqplot.PointLabels.prototype.setLabels=function(){var f=this.plugins.pointLabels;var h;if(f.seriesLabelIndex!=null){h=f.seriesLabelIndex}else{if(this.renderer.constructor===c.jqplot.BarRenderer&&this.barDirection==="horizontal"){h=(this._plotData[0].length<3)?0:this._plotData[0].length-1}else{h=(this._plotData.length===0)?0:this._plotData[0].length-1}}f._labels=[];if(f.labels.length===0||f.labelsFromSeries){if(f.stackedValue){if(this._plotData.length&&this._plotData[0].length){for(var e=0;e<this._plotData.length;e++){f._labels.push(this._plotData[e][h])}}}else{var g=this.data;if(this.renderer.constructor===c.jqplot.BarRenderer&&this.waterfall){g=this._data}if(g.length&&g[0].length){for(var e=0;e<g.length;e++){f._labels.push(g[e][h])}}g=null}}else{if(f.labels.length){f._labels=f.labels}}};c.jqplot.PointLabels.prototype.xOffset=function(f,e,g){e=e||this.location;g=g||this.xpadding;var h;switch(e){case"nw":h=-f.outerWidth(true)-this.xpadding;break;case"n":h=-f.outerWidth(true)/2;break;case"ne":h=this.xpadding;break;case"e":h=this.xpadding;break;case"se":h=this.xpadding;break;case"s":h=-f.outerWidth(true)/2;break;case"sw":h=-f.outerWidth(true)-this.xpadding;break;case"w":h=-f.outerWidth(true)-this.xpadding;break;default:h=-f.outerWidth(true)-this.xpadding;break}return h};c.jqplot.PointLabels.prototype.yOffset=function(f,e,g){e=e||this.location;g=g||this.xpadding;var h;switch(e){case"nw":h=-f.outerHeight(true)-this.ypadding;break;case"n":h=-f.outerHeight(true)-this.ypadding;break;case"ne":h=-f.outerHeight(true)-this.ypadding;break;case"e":h=-f.outerHeight(true)/2;break;case"se":h=this.ypadding;break;case"s":h=this.ypadding;break;case"sw":h=this.ypadding;break;case"w":h=-f.outerHeight(true)/2;break;default:h=-f.outerHeight(true)-this.ypadding;break}return h};c.jqplot.PointLabels.draw=function(x,j,v){var t=this.plugins.pointLabels;t.setLabels.call(this);for(var w=0;w<t._elems.length;w++){t._elems[w].emptyForce()}t._elems.splice(0,t._elems.length);if(t.show){var r="_"+this._stackAxis+"axis";if(!t.formatString){t.formatString=this[r]._ticks[0].formatString;t.formatter=this[r]._ticks[0].formatter}var E=this._plotData;var D=this._prevPlotData;var A=this._xaxis;var q=this._yaxis;var z,f;for(var w=0,u=t._labels.length;w<u;w++){var o=t._labels[w];if(o==null||(t.hideZeros&&parseInt(o,10)==0)){continue}o=t.formatter(t.formatString,o);f=document.createElement("div");t._elems[w]=c(f);z=t._elems[w];z.addClass("jqplot-point-label jqplot-series-"+this.index+" jqplot-point-"+w);z.css("position","absolute");z.insertAfter(x.canvas);if(t.escapeHTML){z.text(o)}else{z.html(o)}var g=t.location;if((this.fillToZero&&E[w][1]<0)||(this.fillToZero&&this._type==="bar"&&this.barDirection==="horizontal"&&E[w][0]<0)||(this.waterfall&&parseInt(o,10))<0){g=b[d[g]]}var n=A.u2p(E[w][0])+t.xOffset(z,g);var h=q.u2p(E[w][1])+t.yOffset(z,g);if(this._stack&&!t.stackedValue){if(this.barDirection==="vertical"){h=(this._barPoints[w][0][1]+this._barPoints[w][1][1])/2+v._gridPadding.top-0.5*z.outerHeight(true)}else{n=(this._barPoints[w][2][0]+this._barPoints[w][0][0])/2+v._gridPadding.left-0.5*z.outerWidth(true)}}if(this.renderer.constructor==c.jqplot.BarRenderer){if(this.barDirection=="vertical"){n+=this._barNudge}else{h-=this._barNudge}}z.css("left",n);z.css("top",h);var k=n+z.width();var s=h+z.height();var C=t.edgeTolerance;var e=c(x.canvas).position().left;var y=c(x.canvas).position().top;var B=x.canvas.width+e;var m=x.canvas.height+y;if(n-C<e||h-C<y||k+C>B||s+C>m){z.remove()}z=null;f=null}}};c.jqplot.postSeriesInitHooks.push(c.jqplot.PointLabels.init);c.jqplot.postDrawSeriesHooks.push(c.jqplot.PointLabels.draw)})(jQuery);
|
||||||
@@ -0,0 +1,261 @@
|
|||||||
|
/*rules for the plot target div. These will be cascaded down to all plot elements according to css rules*/
|
||||||
|
.jqplot-target {
|
||||||
|
position: relative;
|
||||||
|
color: #666666;
|
||||||
|
font-family: "Trebuchet MS", Arial, Helvetica, sans-serif;
|
||||||
|
font-size: 1em;
|
||||||
|
/* height: 300px;
|
||||||
|
width: 400px;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/*rules applied to all axes*/
|
||||||
|
.jqplot-axis {
|
||||||
|
font-size: 0.9em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-xaxis {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-x2axis {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-yaxis {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-y2axis, .jqplot-y3axis, .jqplot-y4axis, .jqplot-y5axis, .jqplot-y6axis, .jqplot-y7axis, .jqplot-y8axis, .jqplot-y9axis, .jqplot-yMidAxis {
|
||||||
|
margin-left: 10px;
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*rules applied to all axis tick divs*/
|
||||||
|
.jqplot-axis-tick, .jqplot-xaxis-tick, .jqplot-yaxis-tick, .jqplot-x2axis-tick, .jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick, .jqplot-yMidAxis-tick {
|
||||||
|
position: absolute;
|
||||||
|
white-space: pre;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.jqplot-xaxis-tick {
|
||||||
|
top: 0px;
|
||||||
|
/* initial position untill tick is drawn in proper place */
|
||||||
|
left: 15px;
|
||||||
|
/* padding-top: 10px;*/
|
||||||
|
vertical-align: top;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-x2axis-tick {
|
||||||
|
bottom: 0px;
|
||||||
|
/* initial position untill tick is drawn in proper place */
|
||||||
|
left: 15px;
|
||||||
|
/* padding-bottom: 10px;*/
|
||||||
|
vertical-align: bottom;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-yaxis-tick {
|
||||||
|
right: 0px;
|
||||||
|
/* initial position untill tick is drawn in proper place */
|
||||||
|
top: 15px;
|
||||||
|
/* padding-right: 10px;*/
|
||||||
|
text-align: right;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-yaxis-tick.jqplot-breakTick {
|
||||||
|
right: -20px;
|
||||||
|
margin-right: 0px;
|
||||||
|
padding:1px 5px 1px 5px;
|
||||||
|
/*background-color: white;*/
|
||||||
|
z-index: 2;
|
||||||
|
font-size: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-y2axis-tick, .jqplot-y3axis-tick, .jqplot-y4axis-tick, .jqplot-y5axis-tick, .jqplot-y6axis-tick, .jqplot-y7axis-tick, .jqplot-y8axis-tick, .jqplot-y9axis-tick {
|
||||||
|
left: 0px;
|
||||||
|
/* initial position untill tick is drawn in proper place */
|
||||||
|
top: 15px;
|
||||||
|
/* padding-left: 10px;*/
|
||||||
|
/* padding-right: 15px;*/
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-yMidAxis-tick {
|
||||||
|
text-align: center;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-xaxis-label {
|
||||||
|
margin-top: 10px;
|
||||||
|
font-size: 11pt;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-x2axis-label {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
font-size: 11pt;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-yaxis-label {
|
||||||
|
margin-right: 10px;
|
||||||
|
/* text-align: center;*/
|
||||||
|
font-size: 11pt;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-yMidAxis-label {
|
||||||
|
font-size: 11pt;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-y2axis-label, .jqplot-y3axis-label, .jqplot-y4axis-label, .jqplot-y5axis-label, .jqplot-y6axis-label, .jqplot-y7axis-label, .jqplot-y8axis-label, .jqplot-y9axis-label {
|
||||||
|
/* text-align: center;*/
|
||||||
|
font-size: 11pt;
|
||||||
|
margin-left: 10px;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-meterGauge-tick {
|
||||||
|
font-size: 0.75em;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-meterGauge-label {
|
||||||
|
font-size: 1em;
|
||||||
|
color: #999999;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.jqplot-table-legend {
|
||||||
|
margin-top: 12px;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
margin-left: 12px;
|
||||||
|
margin-right: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.jqplot-table-legend, table.jqplot-cursor-legend {
|
||||||
|
background-color: rgba(255,255,255,0.6);
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
position: absolute;
|
||||||
|
font-size: 0.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.jqplot-table-legend {
|
||||||
|
vertical-align:middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
These rules could be used instead of assigning
|
||||||
|
element styles and relying on js object properties.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
td.jqplot-table-legend-swatch {
|
||||||
|
padding-top: 0.5em;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
tr.jqplot-table-legend:first td.jqplot-table-legend-swatch {
|
||||||
|
padding-top: 0px;
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
td.jqplot-seriesToggle:hover, td.jqplot-seriesToggle:active {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-table-legend .jqplot-series-hidden {
|
||||||
|
text-decoration: line-through;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.jqplot-table-legend-swatch-outline {
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
padding:1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.jqplot-table-legend-swatch {
|
||||||
|
width:0px;
|
||||||
|
height:0px;
|
||||||
|
border-top-width: 5px;
|
||||||
|
border-bottom-width: 5px;
|
||||||
|
border-left-width: 6px;
|
||||||
|
border-right-width: 6px;
|
||||||
|
border-top-style: solid;
|
||||||
|
border-bottom-style: solid;
|
||||||
|
border-left-style: solid;
|
||||||
|
border-right-style: solid;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-title {
|
||||||
|
top: 0px;
|
||||||
|
left: 0px;
|
||||||
|
padding-bottom: 0.5em;
|
||||||
|
font-size: 1.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
table.jqplot-cursor-tooltip {
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
font-size: 0.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.jqplot-cursor-tooltip {
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
font-size: 0.75em;
|
||||||
|
white-space: nowrap;
|
||||||
|
background: rgba(208,208,208,0.5);
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-highlighter-tooltip, .jqplot-canvasOverlay-tooltip {
|
||||||
|
border: 1px solid #cccccc;
|
||||||
|
font-size: 0.75em;
|
||||||
|
white-space: nowrap;
|
||||||
|
background: rgba(208,208,208,0.5);
|
||||||
|
padding: 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-point-label {
|
||||||
|
font-size: 1em;
|
||||||
|
z-index: 2;
|
||||||
|
font-weight:bold;
|
||||||
|
color:#ff670f;
|
||||||
|
}
|
||||||
|
|
||||||
|
td.jqplot-cursor-legend-swatch {
|
||||||
|
vertical-align: middle;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.jqplot-cursor-legend-swatch {
|
||||||
|
width: 1.2em;
|
||||||
|
height: 0.7em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-error {
|
||||||
|
/* Styles added to the plot target container when there is an error go here.*/
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.jqplot-error-message {
|
||||||
|
/* Styling of the custom error message div goes here.*/
|
||||||
|
position: relative;
|
||||||
|
top: 46%;
|
||||||
|
display: inline-block;
|
||||||
|
}
|
||||||
|
|
||||||
|
div.jqplot-bubble-label {
|
||||||
|
font-size: 0.8em;
|
||||||
|
/* background: rgba(90%, 90%, 90%, 0.15);*/
|
||||||
|
padding-left: 2px;
|
||||||
|
padding-right: 2px;
|
||||||
|
color: rgb(20%, 20%, 20%);
|
||||||
|
}
|
||||||
|
|
||||||
|
div.jqplot-bubble-label.jqplot-bubble-label-highlight {
|
||||||
|
background: rgba(90%, 90%, 90%, 0.7);
|
||||||
|
}
|
||||||
|
|
||||||
|
div.jqplot-noData-container {
|
||||||
|
text-align: center;
|
||||||
|
background-color: rgba(96%, 96%, 96%, 0.3);
|
||||||
|
}
|
||||||
File diff suppressed because it is too large.
Load diff
Vendored
+1
@@ -0,0 +1 @@
|
|||||||
|
.jqplot-target{position:relative;color:#666;font-family:"Trebuchet MS",Arial,Helvetica,sans-serif;font-size:1em}.jqplot-axis{font-size:.75em}.jqplot-xaxis{margin-top:10px}.jqplot-x2axis{margin-bottom:10px}.jqplot-yaxis{margin-right:10px}.jqplot-y2axis,.jqplot-y3axis,.jqplot-y4axis,.jqplot-y5axis,.jqplot-y6axis,.jqplot-y7axis,.jqplot-y8axis,.jqplot-y9axis,.jqplot-yMidAxis{margin-left:10px;margin-right:10px}.jqplot-axis-tick,.jqplot-xaxis-tick,.jqplot-yaxis-tick,.jqplot-x2axis-tick,.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick,.jqplot-yMidAxis-tick{position:absolute;white-space:pre}.jqplot-xaxis-tick{top:0;left:15px;vertical-align:top}.jqplot-x2axis-tick{bottom:0;left:15px;vertical-align:bottom}.jqplot-yaxis-tick{right:0;top:15px;text-align:right}.jqplot-yaxis-tick.jqplot-breakTick{right:-20px;margin-right:0;padding:1px 5px 1px 5px;z-index:2;font-size:1.5em}.jqplot-y2axis-tick,.jqplot-y3axis-tick,.jqplot-y4axis-tick,.jqplot-y5axis-tick,.jqplot-y6axis-tick,.jqplot-y7axis-tick,.jqplot-y8axis-tick,.jqplot-y9axis-tick{left:0;top:15px;text-align:left}.jqplot-yMidAxis-tick{text-align:center;white-space:nowrap}.jqplot-xaxis-label{margin-top:10px;font-size:11pt;position:absolute}.jqplot-x2axis-label{margin-bottom:10px;font-size:11pt;position:absolute}.jqplot-yaxis-label{margin-right:10px;font-size:11pt;position:absolute}.jqplot-yMidAxis-label{font-size:11pt;position:absolute}.jqplot-y2axis-label,.jqplot-y3axis-label,.jqplot-y4axis-label,.jqplot-y5axis-label,.jqplot-y6axis-label,.jqplot-y7axis-label,.jqplot-y8axis-label,.jqplot-y9axis-label{font-size:11pt;margin-left:10px;position:absolute}.jqplot-meterGauge-tick{font-size:.75em;color:#999}.jqplot-meterGauge-label{font-size:1em;color:#999}table.jqplot-table-legend{margin-top:12px;margin-bottom:12px;margin-left:12px;margin-right:12px}table.jqplot-table-legend,table.jqplot-cursor-legend{background-color:rgba(255,255,255,0.6);border:1px solid #ccc;position:absolute;font-size:.75em}td.jqplot-table-legend{vertical-align:middle}td.jqplot-seriesToggle:hover,td.jqplot-seriesToggle:active{cursor:pointer}.jqplot-table-legend .jqplot-series-hidden{text-decoration:line-through}div.jqplot-table-legend-swatch-outline{border:1px solid #ccc;padding:1px}div.jqplot-table-legend-swatch{width:0;height:0;border-top-width:5px;border-bottom-width:5px;border-left-width:6px;border-right-width:6px;border-top-style:solid;border-bottom-style:solid;border-left-style:solid;border-right-style:solid}.jqplot-title{top:0;left:0;padding-bottom:.5em;font-size:1.2em}table.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em}.jqplot-cursor-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-highlighter-tooltip,.jqplot-canvasOverlay-tooltip{border:1px solid #ccc;font-size:.75em;white-space:nowrap;background:rgba(208,208,208,0.5);padding:1px}.jqplot-point-label{font-size:.75em;z-index:2}td.jqplot-cursor-legend-swatch{vertical-align:middle;text-align:center}div.jqplot-cursor-legend-swatch{width:1.2em;height:.7em}.jqplot-error{text-align:center}.jqplot-error-message{position:relative;top:46%;display:inline-block}div.jqplot-bubble-label{font-size:.8em;padding-left:2px;padding-right:2px;color:rgb(20%,20%,20%)}div.jqplot-bubble-label.jqplot-bubble-label-highlight{background:rgba(90%,90%,90%,0.7)}div.jqplot-noData-container{text-align:center;background-color:rgba(96%,96%,96%,0.3)}
|
||||||
Vendored
+3
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(L){var u;L.fn.emptyForce=function(){for(var ah=0,ai;(ai=L(this)[ah])!=null;ah++){if(ai.nodeType===1){L.cleanData(ai.getElementsByTagName("*"))}if(L.jqplot.use_excanvas){ai.outerHTML=""}else{while(ai.firstChild){ai.removeChild(ai.firstChild)}}ai=null}return L(this)};L.fn.removeChildForce=function(ah){while(ah.firstChild){this.removeChildForce(ah.firstChild);ah.removeChild(ah.firstChild)}};L.fn.jqplot=function(){var ah=[];var aj=[];for(var ak=0,ai=arguments.length;ak<ai;ak++){if(L.isArray(arguments[ak])){ah.push(arguments[ak])}else{if(L.isPlainObject(arguments[ak])){aj.push(arguments[ak])}}}return this.each(function(an){var at,ar,aq=L(this),am=ah.length,al=aj.length,ap,ao;if(an<am){ap=ah[an]}else{ap=am?ah[am-1]:null}if(an<al){ao=aj[an]}else{ao=al?aj[al-1]:null}at=aq.attr("id");if(at===u){at="jqplot_target_"+L.jqplot.targetCounter++;aq.attr("id",at)}ar=L.jqplot(at,ap,ao);aq.data("jqplot",ar)})};L.jqplot=function(an,ak,ai){var aj=null,ah=null;if(arguments.length===3){aj=ak;ah=ai}else{if(arguments.length===2){if(L.isArray(ak)){aj=ak}else{if(L.isPlainObject(ak)){ah=ak}}}}if(aj===null&&ah!==null&&ah.data){aj=ah.data}var am=new R();L("#"+an).removeClass("jqplot-error");if(L.jqplot.config.catchErrors){try{am.init(an,aj,ah);am.draw();am.themeEngine.init.call(am);return am}catch(al){var ao=L.jqplot.config.errorMessage||al.message;L("#"+an).append('<div class="jqplot-error-message">'+ao+"</div>");L("#"+an).addClass("jqplot-error");document.getElementById(an).style.background=L.jqplot.config.errorBackground;document.getElementById(an).style.border=L.jqplot.config.errorBorder;document.getElementById(an).style.fontFamily=L.jqplot.config.errorFontFamily;document.getElementById(an).style.fontSize=L.jqplot.config.errorFontSize;document.getElementById(an).style.fontStyle=L.jqplot.config.errorFontStyle;document.getElementById(an).style.fontWeight=L.jqplot.config.errorFontWeight}}else{am.init(an,aj,ah);am.draw();am.themeEngine.init.call(am);return am}};L.jqplot.version="1.0.8";L.jqplot.revision="1250";L.jqplot.targetCounter=1;L.jqplot.CanvasManager=function(){if(typeof L.jqplot.CanvasManager.canvases=="undefined"){L.jqplot.CanvasManager.canvases=[];L.jqplot.CanvasManager.free=[]}var ah=[];this.getCanvas=function(){var ak;var aj=true;if(!L.jqplot.use_excanvas){for(var al=0,ai=L.jqplot.CanvasManager.canvases.length;al<ai;al++){if(L.jqplot.CanvasManager.free[al]===true){aj=false;ak=L.jqplot.CanvasManager.canvases[al];L.jqplot.CanvasManager.free[al]=false;ah.push(al);break}}}if(aj){ak=document.createElement("canvas");ah.push(L.jqplot.CanvasManager.canvases.length);L.jqplot.CanvasManager.canvases.push(ak);L.jqplot.CanvasManager.free.push(false)}return ak};this.initCanvas=function(ai){if(L.jqplot.use_excanvas){return window.G_vmlCanvasManager.initElement(ai)}return ai};this.freeAllCanvases=function(){for(var aj=0,ai=ah.length;aj<ai;aj++){this.freeCanvas(ah[aj])}ah=[]};this.freeCanvas=function(ai){if(L.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==u){window.G_vmlCanvasManager.uninitElement(L.jqplot.CanvasManager.canvases[ai]);L.jqplot.CanvasManager.canvases[ai]=null}else{var aj=L.jqplot.CanvasManager.canvases[ai];aj.getContext("2d").clearRect(0,0,aj.width,aj.height);L(aj).unbind().removeAttr("class").removeAttr("style");L(aj).css({left:"",top:"",position:""});aj.width=0;aj.height=0;L.jqplot.CanvasManager.free[ai]=true}}};L.jqplot.log=function(){if(window.console){window.console.log.apply(window.console,arguments)}};L.jqplot.config={addDomReference:false,enablePlugins:false,defaultHeight:300,defaultWidth:400,UTCAdjust:false,timezoneOffset:new Date(new Date().getTimezoneOffset()*60000),errorMessage:"",errorBackground:"",errorBorder:"",errorFontFamily:"",errorFontSize:"",errorFontStyle:"",errorFontWeight:"",catchErrors:false,defaultTickFormatString:"%.1f",defaultColors:["#4bb2c5","#EAA228","#c5b47f","#579575","#839557","#958c12","#953579","#4b5de4","#d8b83f","#ff5800","#0085cc","#c747a3","#cddf54","#FBD178","#26B4E3","#bd70c7"],defaultNegativeColors:["#498991","#C08840","#9F9274","#546D61","#646C4A","#6F6621","#6E3F5F","#4F64B0","#A89050","#C45923","#187399","#945381","#959E5C","#C7AF7B","#478396","#907294"],dashLength:4,gapLength:4,dotGapLength:2.5,srcLocation:"jqplot/src/",pluginLocation:"jqplot/src/plugins/"};L.jqplot.arrayMax=function(ah){return Math.max.apply(Math,ah)};L.jqplot.arrayMin=function(ah){return Math.min.apply(Math,ah)};L.jqplot.enablePlugins=L.jqplot.config.enablePlugins;L.jqplot.support_canvas=function(){if(typeof L.jqplot.support_canvas.result=="undefined"){L.jqplot.support_canvas.result=!!document.createElement("canvas").getContext}return L.jqplot.support_canvas.result};L.jqplot.support_canvas_text=function(){if(typeof L.jqplot.support_canvas_text.result=="undefined"){if(window.G_vmlCanvasManager!==u&&window.G_vmlCanvasManager._version>887){L.jqplot.support_canvas_text.result=true}else{L.jqplot.support_canvas_text.result=!!(document.createElement("canvas").getContext&&typeof document.creLine truncated
|
||||||
@@ -0,0 +1,314 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
// Class: $.jqplot.BezierCurveRenderer.js
|
||||||
|
// Renderer which draws lines as stacked bezier curves.
|
||||||
|
// Data for the line will not be specified as an array of
|
||||||
|
// [x, y] data point values, but as a an array of [start piont, bezier curve]
|
||||||
|
// So, the line is specified as: [[xstart, ystart], [cp1x, cp1y, cp2x, cp2y, xend, yend]].
|
||||||
|
$.jqplot.BezierCurveRenderer = function(){
|
||||||
|
$.jqplot.LineRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BezierCurveRenderer.prototype = new $.jqplot.LineRenderer();
|
||||||
|
$.jqplot.BezierCurveRenderer.prototype.constructor = $.jqplot.BezierCurveRenderer;
|
||||||
|
|
||||||
|
|
||||||
|
// Method: setGridData
|
||||||
|
// converts the user data values to grid coordinates and stores them
|
||||||
|
// in the gridData array.
|
||||||
|
// Called with scope of a series.
|
||||||
|
$.jqplot.BezierCurveRenderer.prototype.setGridData = function(plot) {
|
||||||
|
// recalculate the grid data
|
||||||
|
var xp = this._xaxis.series_u2p;
|
||||||
|
var yp = this._yaxis.series_u2p;
|
||||||
|
// this._plotData should be same as this.data
|
||||||
|
var data = this.data;
|
||||||
|
this.gridData = [];
|
||||||
|
this._prevGridData = [];
|
||||||
|
// if seriesIndex = 0, fill to x axis.
|
||||||
|
// if seriesIndex > 0, fill to previous series data.
|
||||||
|
var idx = this.index;
|
||||||
|
if (data.length == 2) {
|
||||||
|
if (idx == 0) {
|
||||||
|
this.gridData = [
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||||
|
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||||
|
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
||||||
|
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
||||||
|
[xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, this._yaxis.min)],
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var psd = plot.series[idx-1].data;
|
||||||
|
this.gridData = [
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||||
|
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||||
|
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
||||||
|
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
||||||
|
[xp.call(this._xaxis, psd[1][4]), yp.call(this._yaxis, psd[1][5])],
|
||||||
|
[xp.call(this._xaxis, psd[1][2]), yp.call(this._yaxis, psd[1][3]),
|
||||||
|
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
||||||
|
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (idx == 0) {
|
||||||
|
this.gridData = [
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||||
|
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||||
|
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
||||||
|
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
||||||
|
[xp.call(this._xaxis, data[3][1]), yp.call(this._yaxis, this._yaxis.min)],
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var psd = plot.series[idx-1].data;
|
||||||
|
this.gridData = [
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||||
|
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||||
|
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
||||||
|
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
||||||
|
[xp.call(this._xaxis, psd[3][0]), yp.call(this._yaxis, psd[3][1])],
|
||||||
|
[xp.call(this._xaxis, psd[2][0]), yp.call(this._yaxis, psd[2][1]),
|
||||||
|
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
||||||
|
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Method: makeGridData
|
||||||
|
// converts any arbitrary data values to grid coordinates and
|
||||||
|
// returns them. This method exists so that plugins can use a series'
|
||||||
|
// linerenderer to generate grid data points without overwriting the
|
||||||
|
// grid data associated with that series.
|
||||||
|
// Called with scope of a series.
|
||||||
|
$.jqplot.BezierCurveRenderer.prototype.makeGridData = function(data, plot) {
|
||||||
|
// recalculate the grid data
|
||||||
|
var xp = this._xaxis.series_u2p;
|
||||||
|
var yp = this._yaxis.series_u2p;
|
||||||
|
var gd = [];
|
||||||
|
var pgd = [];
|
||||||
|
// if seriesIndex = 0, fill to x axis.
|
||||||
|
// if seriesIndex > 0, fill to previous series data.
|
||||||
|
var idx = this.index;
|
||||||
|
if (data.length == 2) {
|
||||||
|
if (idx == 0) {
|
||||||
|
gd = [
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||||
|
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||||
|
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
||||||
|
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
||||||
|
[xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, this._yaxis.min)],
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var psd = plot.series[idx-1].data;
|
||||||
|
gd = [
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||||
|
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||||
|
xp.call(this._xaxis, data[1][2]), yp.call(this._yaxis, data[1][3]),
|
||||||
|
xp.call(this._xaxis, data[1][4]), yp.call(this._yaxis, data[1][5])],
|
||||||
|
[xp.call(this._xaxis, psd[1][4]), yp.call(this._yaxis, psd[1][5])],
|
||||||
|
[xp.call(this._xaxis, psd[1][2]), yp.call(this._yaxis, psd[1][3]),
|
||||||
|
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
||||||
|
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (idx == 0) {
|
||||||
|
gd = [
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||||
|
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||||
|
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
||||||
|
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
||||||
|
[xp.call(this._xaxis, data[3][1]), yp.call(this._yaxis, this._yaxis.min)],
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, this._yaxis.min)]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var psd = plot.series[idx-1].data;
|
||||||
|
gd = [
|
||||||
|
[xp.call(this._xaxis, data[0][0]), yp.call(this._yaxis, data[0][1])],
|
||||||
|
[xp.call(this._xaxis, data[1][0]), yp.call(this._yaxis, data[1][1]),
|
||||||
|
xp.call(this._xaxis, data[2][0]), yp.call(this._yaxis, data[2][1]),
|
||||||
|
xp.call(this._xaxis, data[3][0]), yp.call(this._yaxis, data[3][1])],
|
||||||
|
[xp.call(this._xaxis, psd[3][0]), yp.call(this._yaxis, psd[3][1])],
|
||||||
|
[xp.call(this._xaxis, psd[2][0]), yp.call(this._yaxis, psd[2][1]),
|
||||||
|
xp.call(this._xaxis, psd[1][0]), yp.call(this._yaxis, psd[1][1]),
|
||||||
|
xp.call(this._xaxis, psd[0][0]), yp.call(this._yaxis, psd[0][1])]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return gd;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// called within scope of series.
|
||||||
|
$.jqplot.BezierCurveRenderer.prototype.draw = function(ctx, gd, options) {
|
||||||
|
var i;
|
||||||
|
ctx.save();
|
||||||
|
if (gd.length) {
|
||||||
|
if (this.showLine) {
|
||||||
|
ctx.save();
|
||||||
|
var opts = (options != null) ? options : {};
|
||||||
|
ctx.fillStyle = opts.fillStyle || this.color;
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.moveTo(gd[0][0], gd[0][1]);
|
||||||
|
ctx.bezierCurveTo(gd[1][0], gd[1][1], gd[1][2], gd[1][3], gd[1][4], gd[1][5]);
|
||||||
|
ctx.lineTo(gd[2][0], gd[2][1]);
|
||||||
|
if (gd[3].length == 2) {
|
||||||
|
ctx.lineTo(gd[3][0], gd[3][1]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ctx.bezierCurveTo(gd[3][0], gd[3][1], gd[3][2], gd[3][3], gd[3][4], gd[3][5]);
|
||||||
|
}
|
||||||
|
ctx.closePath();
|
||||||
|
ctx.fill();
|
||||||
|
ctx.restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.restore();
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BezierCurveRenderer.prototype.drawShadow = function(ctx, gd, options) {
|
||||||
|
// This is a no-op, shadows drawn with lines.
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BezierAxisRenderer = function() {
|
||||||
|
$.jqplot.LinearAxisRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BezierAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
||||||
|
$.jqplot.BezierAxisRenderer.prototype.constructor = $.jqplot.BezierAxisRenderer;
|
||||||
|
|
||||||
|
|
||||||
|
// Axes on a plot with Bezier Curves
|
||||||
|
$.jqplot.BezierAxisRenderer.prototype.init = function(options){
|
||||||
|
$.extend(true, this, options);
|
||||||
|
var db = this._dataBounds;
|
||||||
|
// Go through all the series attached to this axis and find
|
||||||
|
// the min/max bounds for this axis.
|
||||||
|
for (var i=0; i<this._series.length; i++) {
|
||||||
|
var s = this._series[i];
|
||||||
|
var d = s.data;
|
||||||
|
if (d.length == 4) {
|
||||||
|
for (var j=0; j<d.length; j++) {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
if (d[j][0] < db.min || db.min == null) {
|
||||||
|
db.min = d[j][0];
|
||||||
|
}
|
||||||
|
if (d[j][0] > db.max || db.max == null) {
|
||||||
|
db.max = d[j][0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (d[j][1] < db.min || db.min == null) {
|
||||||
|
db.min = d[j][1];
|
||||||
|
}
|
||||||
|
if (d[j][1] > db.max || db.max == null) {
|
||||||
|
db.max = d[j][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
if (d[0][0] < db.min || db.min == null) {
|
||||||
|
db.min = d[0][0];
|
||||||
|
}
|
||||||
|
if (d[0][0] > db.max || db.max == null) {
|
||||||
|
db.max = d[0][0];
|
||||||
|
}
|
||||||
|
for (var j=0; j<5; j+=2) {
|
||||||
|
if (d[1][j] < db.min || db.min == null) {
|
||||||
|
db.min = d[1][j];
|
||||||
|
}
|
||||||
|
if (d[1][j] > db.max || db.max == null) {
|
||||||
|
db.max = d[1][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (d[0][1] < db.min || db.min == null) {
|
||||||
|
db.min = d[0][1];
|
||||||
|
}
|
||||||
|
if (d[0][1] > db.max || db.max == null) {
|
||||||
|
db.max = d[0][1];
|
||||||
|
}
|
||||||
|
for (var j=1; j<6; j+=2) {
|
||||||
|
if (d[1][j] < db.min || db.min == null) {
|
||||||
|
db.min = d[1][j];
|
||||||
|
}
|
||||||
|
if (d[1][j] > db.max || db.max == null) {
|
||||||
|
db.max = d[1][j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// setup default renderers for axes and legend so user doesn't have to
|
||||||
|
// called with scope of plot
|
||||||
|
function preInit(target, data, options) {
|
||||||
|
options = options || {};
|
||||||
|
options.axesDefaults = $.extend(true, {pad:0}, options.axesDefaults);
|
||||||
|
options.seriesDefaults = options.seriesDefaults || {};
|
||||||
|
options.legend = $.extend(true, {placement:'outside'}, options.legend);
|
||||||
|
// only set these if there is a pie series
|
||||||
|
var setopts = false;
|
||||||
|
if (options.seriesDefaults.renderer == $.jqplot.BezierCurveRenderer) {
|
||||||
|
setopts = true;
|
||||||
|
}
|
||||||
|
else if (options.series) {
|
||||||
|
for (var i=0; i < options.series.length; i++) {
|
||||||
|
if (options.series[i].renderer == $.jqplot.BezierCurveRenderer) {
|
||||||
|
setopts = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setopts) {
|
||||||
|
options.axesDefaults.renderer = $.jqplot.BezierAxisRenderer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.jqplot.preInitHooks.push(preInit);
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(b){b.jqplot.BezierCurveRenderer=function(){b.jqplot.LineRenderer.call(this)};b.jqplot.BezierCurveRenderer.prototype=new b.jqplot.LineRenderer();b.jqplot.BezierCurveRenderer.prototype.constructor=b.jqplot.BezierCurveRenderer;b.jqplot.BezierCurveRenderer.prototype.setGridData=function(h){var e=this._xaxis.series_u2p;var g=this._yaxis.series_u2p;var f=this.data;this.gridData=[];this._prevGridData=[];var d=this.index;if(f.length==2){if(d==0){this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[1][2]),g.call(this._yaxis,f[1][3]),e.call(this._xaxis,f[1][4]),g.call(this._yaxis,f[1][5])],[e.call(this._xaxis,f[1][4]),g.call(this._yaxis,this._yaxis.min)],[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,this._yaxis.min)]]}else{var c=h.series[d-1].data;this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[1][2]),g.call(this._yaxis,f[1][3]),e.call(this._xaxis,f[1][4]),g.call(this._yaxis,f[1][5])],[e.call(this._xaxis,c[1][4]),g.call(this._yaxis,c[1][5])],[e.call(this._xaxis,c[1][2]),g.call(this._yaxis,c[1][3]),e.call(this._xaxis,c[1][0]),g.call(this._yaxis,c[1][1]),e.call(this._xaxis,c[0][0]),g.call(this._yaxis,c[0][1])]]}}else{if(d==0){this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[2][0]),g.call(this._yaxis,f[2][1]),e.call(this._xaxis,f[3][0]),g.call(this._yaxis,f[3][1])],[e.call(this._xaxis,f[3][1]),g.call(this._yaxis,this._yaxis.min)],[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,this._yaxis.min)]]}else{var c=h.series[d-1].data;this.gridData=[[e.call(this._xaxis,f[0][0]),g.call(this._yaxis,f[0][1])],[e.call(this._xaxis,f[1][0]),g.call(this._yaxis,f[1][1]),e.call(this._xaxis,f[2][0]),g.call(this._yaxis,f[2][1]),e.call(this._xaxis,f[3][0]),g.call(this._yaxis,f[3][1])],[e.call(this._xaxis,c[3][0]),g.call(this._yaxis,c[3][1])],[e.call(this._xaxis,c[2][0]),g.call(this._yaxis,c[2][1]),e.call(this._xaxis,c[1][0]),g.call(this._yaxis,c[1][1]),e.call(this._xaxis,c[0][0]),g.call(this._yaxis,c[0][1])]]}}};b.jqplot.BezierCurveRenderer.prototype.makeGridData=function(g,i){var f=this._xaxis.series_u2p;var h=this._yaxis.series_u2p;var e=[];var j=[];var d=this.index;if(g.length==2){if(d==0){e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[1][2]),h.call(this._yaxis,g[1][3]),f.call(this._xaxis,g[1][4]),h.call(this._yaxis,g[1][5])],[f.call(this._xaxis,g[1][4]),h.call(this._yaxis,this._yaxis.min)],[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,this._yaxis.min)]]}else{var c=i.series[d-1].data;e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[1][2]),h.call(this._yaxis,g[1][3]),f.call(this._xaxis,g[1][4]),h.call(this._yaxis,g[1][5])],[f.call(this._xaxis,c[1][4]),h.call(this._yaxis,c[1][5])],[f.call(this._xaxis,c[1][2]),h.call(this._yaxis,c[1][3]),f.call(this._xaxis,c[1][0]),h.call(this._yaxis,c[1][1]),f.call(this._xaxis,c[0][0]),h.call(this._yaxis,c[0][1])]]}}else{if(d==0){e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[2][0]),h.call(this._yaxis,g[2][1]),f.call(this._xaxis,g[3][0]),h.call(this._yaxis,g[3][1])],[f.call(this._xaxis,g[3][1]),h.call(this._yaxis,this._yaxis.min)],[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,this._yaxis.min)]]}else{var c=i.series[d-1].data;e=[[f.call(this._xaxis,g[0][0]),h.call(this._yaxis,g[0][1])],[f.call(this._xaxis,g[1][0]),h.call(this._yaxis,g[1][1]),f.call(this._xaxis,g[2][0]),h.call(this._yaxis,g[2][1]),f.call(this._xaxis,g[3][0]),h.call(this._yaxis,g[3][1])],[f.call(this._xaxis,c[3][0]),h.call(this._yaxis,c[3][1])],[f.call(this._xaxis,c[2][0]),h.call(this._yaxis,c[2][1]),f.call(this._xaxis,c[1][0]),h.call(this._yaxis,c[1][1]),f.call(this._xaxis,c[0][0]),h.call(this._yaxis,c[0][1])]]}}return e};b.jqplot.BezierCurveRenderer.prototype.draw=function(c,g,d){var e;c.save();if(g.length){if(this.showLine){c.save();var f=(d!=null)?d:{};c.fillStyle=f.fillStyle||this.color;c.beginPath();c.moveTo(g[0][0],g[0][1]);c.bezierCurveTo(g[1][0],g[1][1],g[1][2],g[1][3],g[1][4],g[1][5]);c.lineTo(g[2][0],g[2][1]);if(g[3].length==2){c.lineTo(g[3][0],g[3][1])}else{c.bezierCurveTo(g[3][0],g[3][1],g[3][2],g[3][3],g[3][4],g[3][5])}c.closePath();c.fill();c.restore()}}c.restore()};b.jqplot.BezierCurveRenderer.prototype.drawShadow=function(c,e,d){};b.jqplot.BezierAxisRenderer=function(){b.jqplot.LinearAxisRenderer.call(this)};b.jqplot.BezierAxisRenderer.prototype=new b.jqplot.LinearAxisRenderer();b.jqplot.BezierAxisRenderer.prototype.constructor=b.jqplot.BezierAxisRenderer;b.jqplot.BezierAxisRenderer.prototype.init=function(f){b.extend(true,this,f);var c=this.Line truncated
|
||||||
@@ -0,0 +1,801 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
// Class: $.jqplot.BarRenderer
|
||||||
|
// A plugin renderer for jqPlot to draw a bar plot.
|
||||||
|
// Draws series as a line.
|
||||||
|
|
||||||
|
$.jqplot.BarRenderer = function(){
|
||||||
|
$.jqplot.LineRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BarRenderer.prototype = new $.jqplot.LineRenderer();
|
||||||
|
$.jqplot.BarRenderer.prototype.constructor = $.jqplot.BarRenderer;
|
||||||
|
|
||||||
|
// called with scope of series.
|
||||||
|
$.jqplot.BarRenderer.prototype.init = function(options, plot) {
|
||||||
|
// Group: Properties
|
||||||
|
//
|
||||||
|
// prop: barPadding
|
||||||
|
// Number of pixels between adjacent bars at the same axis value.
|
||||||
|
this.barPadding = 8;
|
||||||
|
// prop: barMargin
|
||||||
|
// Number of pixels between groups of bars at adjacent axis values.
|
||||||
|
this.barMargin = 10;
|
||||||
|
// prop: barDirection
|
||||||
|
// 'vertical' = up and down bars, 'horizontal' = side to side bars
|
||||||
|
this.barDirection = 'vertical';
|
||||||
|
// prop: barWidth
|
||||||
|
// Width of the bar in pixels (auto by devaul). null = calculated automatically.
|
||||||
|
this.barWidth = null;
|
||||||
|
// prop: shadowOffset
|
||||||
|
// offset of the shadow from the slice and offset of
|
||||||
|
// each succesive stroke of the shadow from the last.
|
||||||
|
this.shadowOffset = 2;
|
||||||
|
// prop: shadowDepth
|
||||||
|
// number of strokes to apply to the shadow,
|
||||||
|
// each stroke offset shadowOffset from the last.
|
||||||
|
this.shadowDepth = 5;
|
||||||
|
// prop: shadowAlpha
|
||||||
|
// transparency of the shadow (0 = transparent, 1 = opaque)
|
||||||
|
this.shadowAlpha = 0.08;
|
||||||
|
// prop: waterfall
|
||||||
|
// true to enable waterfall plot.
|
||||||
|
this.waterfall = false;
|
||||||
|
// prop: groups
|
||||||
|
// group bars into this many groups
|
||||||
|
this.groups = 1;
|
||||||
|
// prop: varyBarColor
|
||||||
|
// true to color each bar of a series separately rather than
|
||||||
|
// have every bar of a given series the same color.
|
||||||
|
// If used for non-stacked multiple series bar plots, user should
|
||||||
|
// specify a separate 'seriesColors' array for each series.
|
||||||
|
// Otherwise, each series will set their bars to the same color array.
|
||||||
|
// This option has no Effect for stacked bar charts and is disabled.
|
||||||
|
this.varyBarColor = false;
|
||||||
|
// prop: highlightMouseOver
|
||||||
|
// True to highlight slice when moused over.
|
||||||
|
// This must be false to enable highlightMouseDown to highlight when clicking on a slice.
|
||||||
|
this.highlightMouseOver = true;
|
||||||
|
// prop: highlightMouseDown
|
||||||
|
// True to highlight when a mouse button is pressed over a slice.
|
||||||
|
// This will be disabled if highlightMouseOver is true.
|
||||||
|
this.highlightMouseDown = false;
|
||||||
|
// prop: highlightColors
|
||||||
|
// an array of colors to use when highlighting a bar.
|
||||||
|
this.highlightColors = [];
|
||||||
|
// prop: transposedData
|
||||||
|
// NOT IMPLEMENTED YET. True if this is a horizontal bar plot and
|
||||||
|
// x and y values are "transposed". Tranposed, or "swapped", data is
|
||||||
|
// required prior to rev. 894 builds of jqPlot with horizontal bars.
|
||||||
|
// Allows backward compatability of bar renderer horizontal bars with
|
||||||
|
// old style data sets.
|
||||||
|
this.transposedData = true;
|
||||||
|
this.renderer.animation = {
|
||||||
|
show: false,
|
||||||
|
direction: 'down',
|
||||||
|
speed: 3000,
|
||||||
|
_supported: true
|
||||||
|
};
|
||||||
|
this._type = 'bar';
|
||||||
|
|
||||||
|
// if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
|
||||||
|
if (options.highlightMouseDown && options.highlightMouseOver == null) {
|
||||||
|
options.highlightMouseOver = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////
|
||||||
|
// This is probably wrong here.
|
||||||
|
// After going back and forth on whether renderer should be the thing
|
||||||
|
// or extend the thing, it seems that it it best if it is a property
|
||||||
|
// on the thing. This should be something that is commonized
|
||||||
|
// among series renderers in the future.
|
||||||
|
//////
|
||||||
|
$.extend(true, this, options);
|
||||||
|
|
||||||
|
// really should probably do this
|
||||||
|
$.extend(true, this.renderer, options);
|
||||||
|
// fill is still needed to properly draw the legend.
|
||||||
|
// bars have to be filled.
|
||||||
|
this.fill = true;
|
||||||
|
|
||||||
|
// if horizontal bar and animating, reset the default direction
|
||||||
|
if (this.barDirection === 'horizontal' && this.rendererOptions.animation && this.rendererOptions.animation.direction == null) {
|
||||||
|
this.renderer.animation.direction = 'left';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.waterfall) {
|
||||||
|
this.fillToZero = false;
|
||||||
|
this.disableStack = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.barDirection == 'vertical' ) {
|
||||||
|
this._primaryAxis = '_xaxis';
|
||||||
|
this._stackAxis = 'y';
|
||||||
|
this.fillAxis = 'y';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._primaryAxis = '_yaxis';
|
||||||
|
this._stackAxis = 'x';
|
||||||
|
this.fillAxis = 'x';
|
||||||
|
}
|
||||||
|
// index of the currenty highlighted point, if any
|
||||||
|
this._highlightedPoint = null;
|
||||||
|
// total number of values for all bar series, total number of bar series, and position of this series
|
||||||
|
this._plotSeriesInfo = null;
|
||||||
|
// Array of actual data colors used for each data point.
|
||||||
|
this._dataColors = [];
|
||||||
|
this._barPoints = [];
|
||||||
|
|
||||||
|
// set the shape renderer options
|
||||||
|
var opts = {lineJoin:'miter', lineCap:'round', fill:true, isarc:false, strokeStyle:this.color, fillStyle:this.color, closePath:this.fill};
|
||||||
|
this.renderer.shapeRenderer.init(opts);
|
||||||
|
// set the shadow renderer options
|
||||||
|
var sopts = {lineJoin:'miter', lineCap:'round', fill:true, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, closePath:this.fill};
|
||||||
|
this.renderer.shadowRenderer.init(sopts);
|
||||||
|
|
||||||
|
plot.postInitHooks.addOnce(postInit);
|
||||||
|
plot.postDrawHooks.addOnce(postPlotDraw);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with scope of series
|
||||||
|
function barPreInit(target, data, seriesDefaults, options) {
|
||||||
|
if (this.rendererOptions.barDirection == 'horizontal') {
|
||||||
|
this._stackAxis = 'x';
|
||||||
|
this._primaryAxis = '_yaxis';
|
||||||
|
}
|
||||||
|
if (this.rendererOptions.waterfall == true) {
|
||||||
|
this._data = $.extend(true, [], this.data);
|
||||||
|
var sum = 0;
|
||||||
|
var pos = (!this.rendererOptions.barDirection || this.rendererOptions.barDirection === 'vertical' || this.transposedData === false) ? 1 : 0;
|
||||||
|
for(var i=0; i<this.data.length; i++) {
|
||||||
|
sum += this.data[i][pos];
|
||||||
|
if (i>0) {
|
||||||
|
this.data[i][pos] += this.data[i-1][pos];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.data[this.data.length] = (pos == 1) ? [this.data.length+1, sum] : [sum, this.data.length+1];
|
||||||
|
this._data[this._data.length] = (pos == 1) ? [this._data.length+1, sum] : [sum, this._data.length+1];
|
||||||
|
}
|
||||||
|
if (this.rendererOptions.groups > 1) {
|
||||||
|
this.breakOnNull = true;
|
||||||
|
var l = this.data.length;
|
||||||
|
var skip = parseInt(l/this.rendererOptions.groups, 10);
|
||||||
|
var count = 0;
|
||||||
|
for (var i=skip; i<l; i+=skip) {
|
||||||
|
this.data.splice(i+count, 0, [null, null]);
|
||||||
|
this._plotData.splice(i+count, 0, [null, null]);
|
||||||
|
this._stackData.splice(i+count, 0, [null, null]);
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
for (i=0; i<this.data.length; i++) {
|
||||||
|
if (this._primaryAxis == '_xaxis') {
|
||||||
|
this.data[i][0] = i+1;
|
||||||
|
this._plotData[i][0] = i+1;
|
||||||
|
this._stackData[i][0] = i+1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.data[i][1] = i+1;
|
||||||
|
this._plotData[i][1] = i+1;
|
||||||
|
this._stackData[i][1] = i+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.jqplot.preSeriesInitHooks.push(barPreInit);
|
||||||
|
|
||||||
|
// needs to be called with scope of series, not renderer.
|
||||||
|
$.jqplot.BarRenderer.prototype.calcSeriesNumbers = function() {
|
||||||
|
var nvals = 0;
|
||||||
|
var nseries = 0;
|
||||||
|
var paxis = this[this._primaryAxis];
|
||||||
|
var s, series, pos;
|
||||||
|
// loop through all series on this axis
|
||||||
|
for (var i=0; i < paxis._series.length; i++) {
|
||||||
|
series = paxis._series[i];
|
||||||
|
if (series === this) {
|
||||||
|
pos = i;
|
||||||
|
}
|
||||||
|
// is the series rendered as a bar?
|
||||||
|
if (series.renderer.constructor == $.jqplot.BarRenderer) {
|
||||||
|
// gridData may not be computed yet, use data length insted
|
||||||
|
nvals += series.data.length;
|
||||||
|
nseries += 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// return total number of values for all bar series, total number of bar series, and position of this series
|
||||||
|
return [nvals, nseries, pos];
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BarRenderer.prototype.setBarWidth = function() {
|
||||||
|
// need to know how many data values we have on the approprate axis and figure it out.
|
||||||
|
var i;
|
||||||
|
var nvals = 0;
|
||||||
|
var nseries = 0;
|
||||||
|
var paxis = this[this._primaryAxis];
|
||||||
|
var s, series, pos;
|
||||||
|
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
||||||
|
nvals = temp[0];
|
||||||
|
nseries = temp[1];
|
||||||
|
var nticks = paxis.numberTicks;
|
||||||
|
var nbins = (nticks-1)/2;
|
||||||
|
// so, now we have total number of axis values.
|
||||||
|
if (paxis.name == 'xaxis' || paxis.name == 'x2axis') {
|
||||||
|
if (this._stack) {
|
||||||
|
this.barWidth = (paxis._offsets.max - paxis._offsets.min) / nvals * nseries - this.barMargin;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.barWidth = ((paxis._offsets.max - paxis._offsets.min)/nbins - this.barPadding * (nseries-1) - this.barMargin*2)/nseries;
|
||||||
|
// this.barWidth = (paxis._offsets.max - paxis._offsets.min) / nvals - this.barPadding - this.barMargin/nseries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this._stack) {
|
||||||
|
this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals * nseries - this.barMargin;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.barWidth = ((paxis._offsets.min - paxis._offsets.max)/nbins - this.barPadding * (nseries-1) - this.barMargin*2)/nseries;
|
||||||
|
// this.barWidth = (paxis._offsets.min - paxis._offsets.max) / nvals - this.barPadding - this.barMargin/nseries;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return [nvals, nseries];
|
||||||
|
};
|
||||||
|
|
||||||
|
function computeHighlightColors (colors) {
|
||||||
|
var ret = [];
|
||||||
|
for (var i=0; i<colors.length; i++){
|
||||||
|
var rgba = $.jqplot.getColorComponents(colors[i]);
|
||||||
|
var newrgb = [rgba[0], rgba[1], rgba[2]];
|
||||||
|
var sum = newrgb[0] + newrgb[1] + newrgb[2];
|
||||||
|
for (var j=0; j<3; j++) {
|
||||||
|
// when darkening, lowest color component can be is 60.
|
||||||
|
newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
|
||||||
|
newrgb[j] = parseInt(newrgb[j], 10);
|
||||||
|
}
|
||||||
|
ret.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
function getStart(sidx, didx, comp, plot, axis) {
|
||||||
|
// check if sign change
|
||||||
|
var seriesIndex = sidx,
|
||||||
|
prevSeriesIndex = sidx - 1,
|
||||||
|
start,
|
||||||
|
prevVal,
|
||||||
|
aidx = (axis === 'x') ? 0 : 1;
|
||||||
|
|
||||||
|
// is this not the first series?
|
||||||
|
if (seriesIndex > 0) {
|
||||||
|
prevVal = plot.series[prevSeriesIndex]._plotData[didx][aidx];
|
||||||
|
|
||||||
|
// is there a sign change
|
||||||
|
if ((comp * prevVal) < 0) {
|
||||||
|
start = getStart(prevSeriesIndex, didx, comp, plot, axis);
|
||||||
|
}
|
||||||
|
|
||||||
|
// no sign change.
|
||||||
|
else {
|
||||||
|
start = plot.series[prevSeriesIndex].gridData[didx][aidx];
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// if first series, return value at 0
|
||||||
|
else {
|
||||||
|
|
||||||
|
start = (aidx === 0) ? plot.series[seriesIndex]._xaxis.series_u2p(0) : plot.series[seriesIndex]._yaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return start;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$.jqplot.BarRenderer.prototype.draw = function(ctx, gridData, options, plot) {
|
||||||
|
var i;
|
||||||
|
// Ughhh, have to make a copy of options b/c it may be modified later.
|
||||||
|
var opts = $.extend({}, options);
|
||||||
|
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
||||||
|
var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
|
||||||
|
var fill = (opts.fill != undefined) ? opts.fill : this.fill;
|
||||||
|
var xaxis = this.xaxis;
|
||||||
|
var yaxis = this.yaxis;
|
||||||
|
var xp = this._xaxis.series_u2p;
|
||||||
|
var yp = this._yaxis.series_u2p;
|
||||||
|
var pointx, pointy;
|
||||||
|
// clear out data colors.
|
||||||
|
this._dataColors = [];
|
||||||
|
this._barPoints = [];
|
||||||
|
|
||||||
|
if (this.barWidth == null) {
|
||||||
|
this.renderer.setBarWidth.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
||||||
|
var nvals = temp[0];
|
||||||
|
var nseries = temp[1];
|
||||||
|
var pos = temp[2];
|
||||||
|
var points = [];
|
||||||
|
|
||||||
|
if (this._stack) {
|
||||||
|
this._barNudge = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._barNudge = (-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
|
||||||
|
}
|
||||||
|
if (showLine) {
|
||||||
|
var negativeColors = new $.jqplot.ColorGenerator(this.negativeSeriesColors);
|
||||||
|
var positiveColors = new $.jqplot.ColorGenerator(this.seriesColors);
|
||||||
|
var negativeColor = negativeColors.get(this.index);
|
||||||
|
if (! this.useNegativeColors) {
|
||||||
|
negativeColor = opts.fillStyle;
|
||||||
|
}
|
||||||
|
var positiveColor = opts.fillStyle;
|
||||||
|
var base;
|
||||||
|
var xstart;
|
||||||
|
var ystart;
|
||||||
|
|
||||||
|
if (this.barDirection == 'vertical') {
|
||||||
|
for (var i=0; i<gridData.length; i++) {
|
||||||
|
if (!this._stack && this.data[i][1] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
points = [];
|
||||||
|
base = gridData[i][0] + this._barNudge;
|
||||||
|
|
||||||
|
// stacked
|
||||||
|
if (this._stack && this._prevGridData.length) {
|
||||||
|
ystart = getStart(this.index, i, this._plotData[i][1], plot, 'y');
|
||||||
|
}
|
||||||
|
|
||||||
|
// not stacked
|
||||||
|
else {
|
||||||
|
if (this.fillToZero) {
|
||||||
|
ystart = this._yaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
else if (this.waterfall && i > 0 && i < this.gridData.length-1) {
|
||||||
|
ystart = this.gridData[i-1][1];
|
||||||
|
}
|
||||||
|
else if (this.waterfall && i == 0 && i < this.gridData.length-1) {
|
||||||
|
if (this._yaxis.min <= 0 && this._yaxis.max >= 0) {
|
||||||
|
ystart = this._yaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
else if (this._yaxis.min > 0) {
|
||||||
|
ystart = ctx.canvas.height;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ystart = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.waterfall && i == this.gridData.length - 1) {
|
||||||
|
if (this._yaxis.min <= 0 && this._yaxis.max >= 0) {
|
||||||
|
ystart = this._yaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
else if (this._yaxis.min > 0) {
|
||||||
|
ystart = ctx.canvas.height;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ystart = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ystart = ctx.canvas.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((this.fillToZero && this._plotData[i][1] < 0) || (this.waterfall && this._data[i][1] < 0)) {
|
||||||
|
if (this.varyBarColor && !this._stack) {
|
||||||
|
if (this.useNegativeColors) {
|
||||||
|
opts.fillStyle = negativeColors.next();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
opts.fillStyle = positiveColors.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
opts.fillStyle = negativeColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.varyBarColor && !this._stack) {
|
||||||
|
opts.fillStyle = positiveColors.next();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
opts.fillStyle = positiveColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.fillToZero || this._plotData[i][1] >= 0) {
|
||||||
|
points.push([base-this.barWidth/2, ystart]);
|
||||||
|
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||||
|
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||||
|
points.push([base+this.barWidth/2, ystart]);
|
||||||
|
}
|
||||||
|
// for negative bars make sure points are always ordered clockwise
|
||||||
|
else {
|
||||||
|
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||||
|
points.push([base-this.barWidth/2, ystart]);
|
||||||
|
points.push([base+this.barWidth/2, ystart]);
|
||||||
|
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||||
|
}
|
||||||
|
this._barPoints.push(points);
|
||||||
|
// now draw the shadows if not stacked.
|
||||||
|
// for stacked plots, they are predrawn by drawShadow
|
||||||
|
if (shadow && !this._stack) {
|
||||||
|
var sopts = $.extend(true, {}, opts);
|
||||||
|
// need to get rid of fillStyle on shadow.
|
||||||
|
delete sopts.fillStyle;
|
||||||
|
this.renderer.shadowRenderer.draw(ctx, points, sopts);
|
||||||
|
}
|
||||||
|
var clr = opts.fillStyle || this.color;
|
||||||
|
this._dataColors.push(clr);
|
||||||
|
this.renderer.shapeRenderer.draw(ctx, points, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (this.barDirection == 'horizontal'){
|
||||||
|
for (var i=0; i<gridData.length; i++) {
|
||||||
|
if (!this._stack && this.data[i][0] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
points = [];
|
||||||
|
base = gridData[i][1] - this._barNudge;
|
||||||
|
xstart;
|
||||||
|
|
||||||
|
if (this._stack && this._prevGridData.length) {
|
||||||
|
xstart = getStart(this.index, i, this._plotData[i][0], plot, 'x');
|
||||||
|
}
|
||||||
|
// not stacked
|
||||||
|
else {
|
||||||
|
if (this.fillToZero) {
|
||||||
|
xstart = this._xaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
else if (this.waterfall && i > 0 && i < this.gridData.length-1) {
|
||||||
|
xstart = this.gridData[i-1][0];
|
||||||
|
}
|
||||||
|
else if (this.waterfall && i == 0 && i < this.gridData.length-1) {
|
||||||
|
if (this._xaxis.min <= 0 && this._xaxis.max >= 0) {
|
||||||
|
xstart = this._xaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
else if (this._xaxis.min > 0) {
|
||||||
|
xstart = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xstart = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.waterfall && i == this.gridData.length - 1) {
|
||||||
|
if (this._xaxis.min <= 0 && this._xaxis.max >= 0) {
|
||||||
|
xstart = this._xaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
else if (this._xaxis.min > 0) {
|
||||||
|
xstart = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xstart = ctx.canvas.width;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xstart = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((this.fillToZero && this._plotData[i][0] < 0) || (this.waterfall && this._data[i][0] < 0)) {
|
||||||
|
if (this.varyBarColor && !this._stack) {
|
||||||
|
if (this.useNegativeColors) {
|
||||||
|
opts.fillStyle = negativeColors.next();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
opts.fillStyle = positiveColors.next();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
opts.fillStyle = negativeColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.varyBarColor && !this._stack) {
|
||||||
|
opts.fillStyle = positiveColors.next();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
opts.fillStyle = positiveColor;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!this.fillToZero || this._plotData[i][0] >= 0) {
|
||||||
|
points.push([xstart, base + this.barWidth / 2]);
|
||||||
|
points.push([xstart, base - this.barWidth / 2]);
|
||||||
|
points.push([gridData[i][0], base - this.barWidth / 2]);
|
||||||
|
points.push([gridData[i][0], base + this.barWidth / 2]);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
points.push([gridData[i][0], base + this.barWidth / 2]);
|
||||||
|
points.push([gridData[i][0], base - this.barWidth / 2]);
|
||||||
|
points.push([xstart, base - this.barWidth / 2]);
|
||||||
|
points.push([xstart, base + this.barWidth / 2]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._barPoints.push(points);
|
||||||
|
// now draw the shadows if not stacked.
|
||||||
|
// for stacked plots, they are predrawn by drawShadow
|
||||||
|
if (shadow && !this._stack) {
|
||||||
|
var sopts = $.extend(true, {}, opts);
|
||||||
|
delete sopts.fillStyle;
|
||||||
|
this.renderer.shadowRenderer.draw(ctx, points, sopts);
|
||||||
|
}
|
||||||
|
var clr = opts.fillStyle || this.color;
|
||||||
|
this._dataColors.push(clr);
|
||||||
|
this.renderer.shapeRenderer.draw(ctx, points, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.highlightColors.length == 0) {
|
||||||
|
this.highlightColors = $.jqplot.computeHighlightColors(this._dataColors);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (typeof(this.highlightColors) == 'string') {
|
||||||
|
var temp = this.highlightColors;
|
||||||
|
this.highlightColors = [];
|
||||||
|
for (var i=0; i<this._dataColors.length; i++) {
|
||||||
|
this.highlightColors.push(temp);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// for stacked plots, shadows will be pre drawn by drawShadow.
|
||||||
|
$.jqplot.BarRenderer.prototype.drawShadow = function(ctx, gridData, options, plot) {
|
||||||
|
var i;
|
||||||
|
var opts = (options != undefined) ? options : {};
|
||||||
|
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
||||||
|
var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
|
||||||
|
var fill = (opts.fill != undefined) ? opts.fill : this.fill;
|
||||||
|
var xaxis = this.xaxis;
|
||||||
|
var yaxis = this.yaxis;
|
||||||
|
var xp = this._xaxis.series_u2p;
|
||||||
|
var yp = this._yaxis.series_u2p;
|
||||||
|
var pointx, points, pointy, nvals, nseries, pos;
|
||||||
|
|
||||||
|
if (this._stack && this.shadow) {
|
||||||
|
if (this.barWidth == null) {
|
||||||
|
this.renderer.setBarWidth.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
var temp = this._plotSeriesInfo = this.renderer.calcSeriesNumbers.call(this);
|
||||||
|
nvals = temp[0];
|
||||||
|
nseries = temp[1];
|
||||||
|
pos = temp[2];
|
||||||
|
|
||||||
|
if (this._stack) {
|
||||||
|
this._barNudge = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._barNudge = (-Math.abs(nseries/2 - 0.5) + pos) * (this.barWidth + this.barPadding);
|
||||||
|
}
|
||||||
|
if (showLine) {
|
||||||
|
|
||||||
|
if (this.barDirection == 'vertical') {
|
||||||
|
for (var i=0; i<gridData.length; i++) {
|
||||||
|
if (this.data[i][1] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
points = [];
|
||||||
|
var base = gridData[i][0] + this._barNudge;
|
||||||
|
var ystart;
|
||||||
|
|
||||||
|
if (this._stack && this._prevGridData.length) {
|
||||||
|
ystart = getStart(this.index, i, this._plotData[i][1], plot, 'y');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.fillToZero) {
|
||||||
|
ystart = this._yaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ystart = ctx.canvas.height;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
points.push([base-this.barWidth/2, ystart]);
|
||||||
|
points.push([base-this.barWidth/2, gridData[i][1]]);
|
||||||
|
points.push([base+this.barWidth/2, gridData[i][1]]);
|
||||||
|
points.push([base+this.barWidth/2, ystart]);
|
||||||
|
this.renderer.shadowRenderer.draw(ctx, points, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (this.barDirection == 'horizontal'){
|
||||||
|
for (var i=0; i<gridData.length; i++) {
|
||||||
|
if (this.data[i][0] == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
points = [];
|
||||||
|
var base = gridData[i][1] - this._barNudge;
|
||||||
|
var xstart;
|
||||||
|
|
||||||
|
if (this._stack && this._prevGridData.length) {
|
||||||
|
xstart = getStart(this.index, i, this._plotData[i][0], plot, 'x');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (this.fillToZero) {
|
||||||
|
xstart = this._xaxis.series_u2p(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
xstart = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
points.push([xstart, base+this.barWidth/2]);
|
||||||
|
points.push([gridData[i][0], base+this.barWidth/2]);
|
||||||
|
points.push([gridData[i][0], base-this.barWidth/2]);
|
||||||
|
points.push([xstart, base-this.barWidth/2]);
|
||||||
|
this.renderer.shadowRenderer.draw(ctx, points, opts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function postInit(target, data, options) {
|
||||||
|
for (var i=0; i<this.series.length; i++) {
|
||||||
|
if (this.series[i].renderer.constructor == $.jqplot.BarRenderer) {
|
||||||
|
// don't allow mouseover and mousedown at same time.
|
||||||
|
if (this.series[i].highlightMouseOver) {
|
||||||
|
this.series[i].highlightMouseDown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// called within context of plot
|
||||||
|
// create a canvas which we can draw on.
|
||||||
|
// insert it before the eventCanvas, so eventCanvas will still capture events.
|
||||||
|
function postPlotDraw() {
|
||||||
|
// Memory Leaks patch
|
||||||
|
if (this.plugins.barRenderer && this.plugins.barRenderer.highlightCanvas) {
|
||||||
|
|
||||||
|
this.plugins.barRenderer.highlightCanvas.resetCanvas();
|
||||||
|
this.plugins.barRenderer.highlightCanvas = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugins.barRenderer = {highlightedSeriesIndex:null};
|
||||||
|
this.plugins.barRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
|
||||||
|
|
||||||
|
this.eventCanvas._elem.before(this.plugins.barRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-barRenderer-highlight-canvas', this._plotDimensions, this));
|
||||||
|
this.plugins.barRenderer.highlightCanvas.setContext();
|
||||||
|
this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
|
||||||
|
}
|
||||||
|
|
||||||
|
function highlight (plot, sidx, pidx, points) {
|
||||||
|
var s = plot.series[sidx];
|
||||||
|
var canvas = plot.plugins.barRenderer.highlightCanvas;
|
||||||
|
canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
||||||
|
s._highlightedPoint = pidx;
|
||||||
|
plot.plugins.barRenderer.highlightedSeriesIndex = sidx;
|
||||||
|
var opts = {fillStyle: s.highlightColors[pidx]};
|
||||||
|
s.renderer.shapeRenderer.draw(canvas._ctx, points, opts);
|
||||||
|
canvas = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
function unhighlight (plot) {
|
||||||
|
var canvas = plot.plugins.barRenderer.highlightCanvas;
|
||||||
|
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
||||||
|
for (var i=0; i<plot.series.length; i++) {
|
||||||
|
plot.series[i]._highlightedPoint = null;
|
||||||
|
}
|
||||||
|
plot.plugins.barRenderer.highlightedSeriesIndex = null;
|
||||||
|
plot.target.trigger('jqplotDataUnhighlight');
|
||||||
|
canvas = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function handleMove(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||||
|
var evt1 = jQuery.Event('jqplotDataMouseOver');
|
||||||
|
evt1.pageX = ev.pageX;
|
||||||
|
evt1.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt1, ins);
|
||||||
|
if (plot.series[ins[0]].show && plot.series[ins[0]].highlightMouseOver &&
|
||||||
|
!(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||||
|
var evt = jQuery.Event('jqplotDataHighlight');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neighbor == null) {
|
||||||
|
unhighlight (plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||||
|
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.barRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||||
|
var evt = jQuery.Event('jqplotDataHighlight');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
highlight (plot, neighbor.seriesIndex, neighbor.pointIndex, neighbor.points);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neighbor == null) {
|
||||||
|
unhighlight (plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
var idx = plot.plugins.barRenderer.highlightedSeriesIndex;
|
||||||
|
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||||
|
unhighlight(plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClick(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||||
|
var evt = jQuery.Event('jqplotDataClick');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||||
|
var idx = plot.plugins.barRenderer.highlightedSeriesIndex;
|
||||||
|
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||||
|
unhighlight(plot);
|
||||||
|
}
|
||||||
|
var evt = jQuery.Event('jqplotDataRightClick');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(d){d.jqplot.BarRenderer=function(){d.jqplot.LineRenderer.call(this)};d.jqplot.BarRenderer.prototype=new d.jqplot.LineRenderer();d.jqplot.BarRenderer.prototype.constructor=d.jqplot.BarRenderer;d.jqplot.BarRenderer.prototype.init=function(o,q){this.barPadding=8;this.barMargin=10;this.barDirection="vertical";this.barWidth=null;this.shadowOffset=2;this.shadowDepth=5;this.shadowAlpha=0.08;this.waterfall=false;this.groups=1;this.varyBarColor=false;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.transposedData=true;this.renderer.animation={show:false,direction:"down",speed:3000,_supported:true};this._type="bar";if(o.highlightMouseDown&&o.highlightMouseOver==null){o.highlightMouseOver=false}d.extend(true,this,o);d.extend(true,this.renderer,o);this.fill=true;if(this.barDirection==="horizontal"&&this.rendererOptions.animation&&this.rendererOptions.animation.direction==null){this.renderer.animation.direction="left"}if(this.waterfall){this.fillToZero=false;this.disableStack=true}if(this.barDirection=="vertical"){this._primaryAxis="_xaxis";this._stackAxis="y";this.fillAxis="y"}else{this._primaryAxis="_yaxis";this._stackAxis="x";this.fillAxis="x"}this._highlightedPoint=null;this._plotSeriesInfo=null;this._dataColors=[];this._barPoints=[];var p={lineJoin:"miter",lineCap:"round",fill:true,isarc:false,strokeStyle:this.color,fillStyle:this.color,closePath:this.fill};this.renderer.shapeRenderer.init(p);var n={lineJoin:"miter",lineCap:"round",fill:true,isarc:false,angle:this.shadowAngle,offset:this.shadowOffset,alpha:this.shadowAlpha,depth:this.shadowDepth,closePath:this.fill};this.renderer.shadowRenderer.init(n);q.postInitHooks.addOnce(h);q.postDrawHooks.addOnce(j);q.eventListenerHooks.addOnce("jqplotMouseMove",b);q.eventListenerHooks.addOnce("jqplotMouseDown",a);q.eventListenerHooks.addOnce("jqplotMouseUp",l);q.eventListenerHooks.addOnce("jqplotClick",e);q.eventListenerHooks.addOnce("jqplotRightClick",m)};function g(t,p,o,w){if(this.rendererOptions.barDirection=="horizontal"){this._stackAxis="x";this._primaryAxis="_yaxis"}if(this.rendererOptions.waterfall==true){this._data=d.extend(true,[],this.data);var s=0;var u=(!this.rendererOptions.barDirection||this.rendererOptions.barDirection==="vertical"||this.transposedData===false)?1:0;for(var q=0;q<this.data.length;q++){s+=this.data[q][u];if(q>0){this.data[q][u]+=this.data[q-1][u]}}this.data[this.data.length]=(u==1)?[this.data.length+1,s]:[s,this.data.length+1];this._data[this._data.length]=(u==1)?[this._data.length+1,s]:[s,this._data.length+1]}if(this.rendererOptions.groups>1){this.breakOnNull=true;var n=this.data.length;var v=parseInt(n/this.rendererOptions.groups,10);var r=0;for(var q=v;q<n;q+=v){this.data.splice(q+r,0,[null,null]);this._plotData.splice(q+r,0,[null,null]);this._stackData.splice(q+r,0,[null,null]);r++}for(q=0;q<this.data.length;q++){if(this._primaryAxis=="_xaxis"){this.data[q][0]=q+1;this._plotData[q][0]=q+1;this._stackData[q][0]=q+1}else{this.data[q][1]=q+1;this._plotData[q][1]=q+1;this._stackData[q][1]=q+1}}}}d.jqplot.preSeriesInitHooks.push(g);d.jqplot.BarRenderer.prototype.calcSeriesNumbers=function(){var r=0;var t=0;var q=this[this._primaryAxis];var p,o,u;for(var n=0;n<q._series.length;n++){o=q._series[n];if(o===this){u=n}if(o.renderer.constructor==d.jqplot.BarRenderer){r+=o.data.length;t+=1}}return[r,t,u]};d.jqplot.BarRenderer.prototype.setBarWidth=function(){var q;var n=0;var o=0;var t=this[this._primaryAxis];var x,r,v;var w=this._plotSeriesInfo=this.renderer.calcSeriesNumbers.call(this);n=w[0];o=w[1];var u=t.numberTicks;var p=(u-1)/2;if(t.name=="xaxis"||t.name=="x2axis"){if(this._stack){this.barWidth=(t._offsets.max-t._offsets.min)/n*o-this.barMargin}else{this.barWidth=((t._offsets.max-t._offsets.min)/p-this.barPadding*(o-1)-this.barMargin*2)/o}}else{if(this._stack){this.barWidth=(t._offsets.min-t._offsets.max)/n*o-this.barMargin}else{this.barWidth=((t._offsets.min-t._offsets.max)/p-this.barPadding*(o-1)-this.barMargin*2)/o}}return[n,o]};function f(o){var q=[];for(var s=0;s<o.length;s++){var r=d.jqplot.getColorComponents(o[s]);var n=[r[0],r[1],r[2]];var t=n[0]+n[1]+n[2];for(var p=0;p<3;p++){n[p]=(t>570)?n[p]*0.8:n[p]+0.3*(255-n[p]);n[p]=parseInt(n[p],10)}q.push("rgb("+n[0]+","+n[1]+","+n[2]+")")}return q}function i(v,u,s,t,o){var q=v,w=v-1,n,p,r=(o==="x")?0:1;if(q>0){p=t.series[w]._plotData[u][r];if((s*p)<0){n=i(w,u,s,t,o)}else{n=t.series[w].gridData[u][r]}}else{n=(r===0)?t.series[q]._xaxis.series_u2p(0):t.series[q]._yaxis.series_u2p(0)}return n}d.jqplot.BarRenderer.prototype.draw=function(E,L,q,G){var I;var A=d.extend({},q);var w=(A.shadow!=undefined)?A.shadow:this.shadow;var O=(A.showLine!=undefined)?A.showLine:this.showLine;var F=(A.fill!=undefined)?A.fill:this.fill;var p=this.xaxis;var J=this.yaxis;var y=this._xaxis.series_u2p;var K=this._yaxis.series_u2p;var D,C;this._dataColors=[];this._barPoints=[];if(this.barWidth==null){this.renderer.setBarWidth.call(this)}var N=this._plotSeriesInfo=this.renLine truncated
|
||||||
@@ -0,0 +1,235 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.BlockRenderer
|
||||||
|
* Plugin renderer to draw a x-y block chart. A Block chart has data points displayed as
|
||||||
|
* colored squares with a text label inside. Data must be supplied in the form:
|
||||||
|
*
|
||||||
|
* > [[x1, y1, "label 1", {css}], [x2, y2, "label 2", {css}], ...]
|
||||||
|
*
|
||||||
|
* The label and css object are optional. If the label is ommitted, the
|
||||||
|
* box will collapse unless a css height and/or width is specified.
|
||||||
|
*
|
||||||
|
* The css object is an object specifying css properties
|
||||||
|
* such as:
|
||||||
|
*
|
||||||
|
* > {background:'#4f98a5', border:'3px solid gray', padding:'1px'}
|
||||||
|
*
|
||||||
|
* Note that css properties specified with the data point override defaults
|
||||||
|
* specified with the series.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$.jqplot.BlockRenderer = function(){
|
||||||
|
$.jqplot.LineRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BlockRenderer.prototype = new $.jqplot.LineRenderer();
|
||||||
|
$.jqplot.BlockRenderer.prototype.constructor = $.jqplot.BlockRenderer;
|
||||||
|
|
||||||
|
// called with scope of a series
|
||||||
|
$.jqplot.BlockRenderer.prototype.init = function(options) {
|
||||||
|
// Group: Properties
|
||||||
|
//
|
||||||
|
// prop: css
|
||||||
|
// default css styles that will be applied to all data blocks.
|
||||||
|
// these values will be overridden by css styles supplied with the
|
||||||
|
// individulal data points.
|
||||||
|
this.css = {padding:'2px', border:'1px solid #999', textAlign:'center'};
|
||||||
|
// prop: escapeHtml
|
||||||
|
// true to escape html in the box label.
|
||||||
|
this.escapeHtml = false;
|
||||||
|
// prop: insertBreaks
|
||||||
|
// true to turn spaces in data block label into html breaks <br />.
|
||||||
|
this.insertBreaks = true;
|
||||||
|
// prop: varyBlockColors
|
||||||
|
// true to vary the color of each block in this series according to
|
||||||
|
// the seriesColors array. False to set each block to the color
|
||||||
|
// specified on this series. This has no effect if a css background color
|
||||||
|
// option is specified in the renderer css options.
|
||||||
|
this.varyBlockColors = false;
|
||||||
|
$.extend(true, this, options);
|
||||||
|
if (this.css.backgroundColor) {
|
||||||
|
this.color = this.css.backgroundColor;
|
||||||
|
}
|
||||||
|
else if (this.css.background) {
|
||||||
|
this.color = this.css.background;
|
||||||
|
}
|
||||||
|
else if (!this.varyBlockColors) {
|
||||||
|
this.css.background = this.color;
|
||||||
|
}
|
||||||
|
this.canvas = new $.jqplot.BlockCanvas();
|
||||||
|
this.shadowCanvas = new $.jqplot.BlockCanvas();
|
||||||
|
this.canvas._plotDimensions = this._plotDimensions;
|
||||||
|
this.shadowCanvas._plotDimensions = this._plotDimensions;
|
||||||
|
this._type = 'block';
|
||||||
|
|
||||||
|
// group: Methods
|
||||||
|
//
|
||||||
|
// Method: moveBlock
|
||||||
|
// Moves an individual block. More efficient than redrawing
|
||||||
|
// the whole series by calling plot.drawSeries().
|
||||||
|
// Properties:
|
||||||
|
// idx - the 0 based index of the block or point in this series.
|
||||||
|
// x - the x coordinate in data units (value on x axis) to move the block to.
|
||||||
|
// y - the y coordinate in data units (value on the y axis) to move the block to.
|
||||||
|
// duration - optional parameter to create an animated movement. Can be a
|
||||||
|
// number (higher is slower animation) or 'fast', 'normal' or 'slow'. If not
|
||||||
|
// provided, the element is moved without any animation.
|
||||||
|
this.moveBlock = function (idx, x, y, duration) {
|
||||||
|
// update plotData, stackData, data and gridData
|
||||||
|
// x and y are in data coordinates.
|
||||||
|
var el = this.canvas._elem.children(':eq('+idx+')');
|
||||||
|
this.data[idx][0] = x;
|
||||||
|
this.data[idx][1] = y;
|
||||||
|
this._plotData[idx][0] = x;
|
||||||
|
this._plotData[idx][1] = y;
|
||||||
|
this._stackData[idx][0] = x;
|
||||||
|
this._stackData[idx][1] = y;
|
||||||
|
this.gridData[idx][0] = this._xaxis.series_u2p(x);
|
||||||
|
this.gridData[idx][1] = this._yaxis.series_u2p(y);
|
||||||
|
var w = el.outerWidth();
|
||||||
|
var h = el.outerHeight();
|
||||||
|
var left = this.gridData[idx][0] - w/2 + 'px';
|
||||||
|
var top = this.gridData[idx][1] - h/2 + 'px';
|
||||||
|
if (duration) {
|
||||||
|
if (parseInt(duration, 10)) {
|
||||||
|
duration = parseInt(duration, 10);
|
||||||
|
}
|
||||||
|
el.animate({left:left, top:top}, duration);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
el.css({left:left, top:top});
|
||||||
|
}
|
||||||
|
el = null;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with scope of series
|
||||||
|
$.jqplot.BlockRenderer.prototype.draw = function (ctx, gd, options) {
|
||||||
|
if (this.plugins.pointLabels) {
|
||||||
|
this.plugins.pointLabels.show = false;
|
||||||
|
}
|
||||||
|
var i, el, d, gd, t, css, w, h, left, top;
|
||||||
|
var opts = (options != undefined) ? options : {};
|
||||||
|
var colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
|
||||||
|
this.canvas._elem.empty();
|
||||||
|
for (i=0; i<this.gridData.length; i++) {
|
||||||
|
d = this.data[i];
|
||||||
|
gd = this.gridData[i];
|
||||||
|
t = '';
|
||||||
|
css = {};
|
||||||
|
if (typeof d[2] == 'string') {
|
||||||
|
t = d[2];
|
||||||
|
}
|
||||||
|
else if (typeof d[2] == 'object') {
|
||||||
|
css = d[2];
|
||||||
|
}
|
||||||
|
if (typeof d[3] == 'object') {
|
||||||
|
css = d[3];
|
||||||
|
}
|
||||||
|
if (this.insertBreaks){
|
||||||
|
t = t.replace(/ /g, '<br />');
|
||||||
|
}
|
||||||
|
css = $.extend(true, {}, this.css, css);
|
||||||
|
// create a div
|
||||||
|
el = $('<div style="position:absolute;margin-left:auto;margin-right:auto;"></div>');
|
||||||
|
this.canvas._elem.append(el);
|
||||||
|
// set text
|
||||||
|
this.escapeHtml ? el.text(t) : el.html(t);
|
||||||
|
// style it
|
||||||
|
// remove styles we don't want overridden.
|
||||||
|
delete css.position;
|
||||||
|
delete css.marginRight;
|
||||||
|
delete css.marginLeft;
|
||||||
|
if (!css.background && !css.backgroundColor && !css.backgroundImage){
|
||||||
|
css.background = colorGenerator.next();
|
||||||
|
}
|
||||||
|
el.css(css);
|
||||||
|
w = el.outerWidth();
|
||||||
|
h = el.outerHeight();
|
||||||
|
left = gd[0] - w/2 + 'px';
|
||||||
|
top = gd[1] - h/2 + 'px';
|
||||||
|
el.css({left:left, top:top});
|
||||||
|
el = null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BlockCanvas = function() {
|
||||||
|
$.jqplot.ElemContainer.call(this);
|
||||||
|
this._ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BlockCanvas.prototype = new $.jqplot.ElemContainer();
|
||||||
|
$.jqplot.BlockCanvas.prototype.constructor = $.jqplot.BlockCanvas;
|
||||||
|
|
||||||
|
$.jqplot.BlockCanvas.prototype.createElement = function(offsets, clss, plotDimensions) {
|
||||||
|
this._offsets = offsets;
|
||||||
|
var klass = 'jqplot-blockCanvas';
|
||||||
|
if (clss != undefined) {
|
||||||
|
klass = clss;
|
||||||
|
}
|
||||||
|
var elem;
|
||||||
|
// if this canvas already has a dom element, don't make a new one.
|
||||||
|
if (this._elem) {
|
||||||
|
elem = this._elem.get(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
elem = document.createElement('div');
|
||||||
|
}
|
||||||
|
// if new plotDimensions supplied, use them.
|
||||||
|
if (plotDimensions != undefined) {
|
||||||
|
this._plotDimensions = plotDimensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
var w = this._plotDimensions.width - this._offsets.left - this._offsets.right + 'px';
|
||||||
|
var h = this._plotDimensions.height - this._offsets.top - this._offsets.bottom + 'px';
|
||||||
|
this._elem = $(elem);
|
||||||
|
this._elem.css({ position: 'absolute', width:w, height:h, left: this._offsets.left, top: this._offsets.top });
|
||||||
|
|
||||||
|
this._elem.addClass(klass);
|
||||||
|
return this._elem;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BlockCanvas.prototype.setContext = function() {
|
||||||
|
this._ctx = {
|
||||||
|
canvas:{
|
||||||
|
width:0,
|
||||||
|
height:0
|
||||||
|
},
|
||||||
|
clearRect:function(){return null;}
|
||||||
|
};
|
||||||
|
return this._ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(a){a.jqplot.BlockRenderer=function(){a.jqplot.LineRenderer.call(this)};a.jqplot.BlockRenderer.prototype=new a.jqplot.LineRenderer();a.jqplot.BlockRenderer.prototype.constructor=a.jqplot.BlockRenderer;a.jqplot.BlockRenderer.prototype.init=function(b){this.css={padding:"2px",border:"1px solid #999",textAlign:"center"};this.escapeHtml=false;this.insertBreaks=true;this.varyBlockColors=false;a.extend(true,this,b);if(this.css.backgroundColor){this.color=this.css.backgroundColor}else{if(this.css.background){this.color=this.css.background}else{if(!this.varyBlockColors){this.css.background=this.color}}}this.canvas=new a.jqplot.BlockCanvas();this.shadowCanvas=new a.jqplot.BlockCanvas();this.canvas._plotDimensions=this._plotDimensions;this.shadowCanvas._plotDimensions=this._plotDimensions;this._type="block";this.moveBlock=function(l,j,i,e){var c=this.canvas._elem.children(":eq("+l+")");this.data[l][0]=j;this.data[l][1]=i;this._plotData[l][0]=j;this._plotData[l][1]=i;this._stackData[l][0]=j;this._stackData[l][1]=i;this.gridData[l][0]=this._xaxis.series_u2p(j);this.gridData[l][1]=this._yaxis.series_u2p(i);var k=c.outerWidth();var f=c.outerHeight();var d=this.gridData[l][0]-k/2+"px";var g=this.gridData[l][1]-f/2+"px";if(e){if(parseInt(e,10)){e=parseInt(e,10)}c.animate({left:d,top:g},e)}else{c.css({left:d,top:g})}c=null}};a.jqplot.BlockRenderer.prototype.draw=function(q,o,r){if(this.plugins.pointLabels){this.plugins.pointLabels.show=false}var f,c,l,o,p,k,n,g,e,m;var b=(r!=undefined)?r:{};var j=new a.jqplot.ColorGenerator(this.seriesColors);this.canvas._elem.empty();for(f=0;f<this.gridData.length;f++){l=this.data[f];o=this.gridData[f];p="";k={};if(typeof l[2]=="string"){p=l[2]}else{if(typeof l[2]=="object"){k=l[2]}}if(typeof l[3]=="object"){k=l[3]}if(this.insertBreaks){p=p.replace(/ /g,"<br />")}k=a.extend(true,{},this.css,k);c=a('<div style="position:absolute;margin-left:auto;margin-right:auto;"></div>');this.canvas._elem.append(c);this.escapeHtml?c.text(p):c.html(p);delete k.position;delete k.marginRight;delete k.marginLeft;if(!k.background&&!k.backgroundColor&&!k.backgroundImage){k.background=j.next()}c.css(k);n=c.outerWidth();g=c.outerHeight();e=o[0]-n/2+"px";m=o[1]-g/2+"px";c.css({left:e,top:m});c=null}};a.jqplot.BlockCanvas=function(){a.jqplot.ElemContainer.call(this);this._ctx};a.jqplot.BlockCanvas.prototype=new a.jqplot.ElemContainer();a.jqplot.BlockCanvas.prototype.constructor=a.jqplot.BlockCanvas;a.jqplot.BlockCanvas.prototype.createElement=function(i,e,c){this._offsets=i;var b="jqplot-blockCanvas";if(e!=undefined){b=e}var g;if(this._elem){g=this._elem.get(0)}else{g=document.createElement("div")}if(c!=undefined){this._plotDimensions=c}var d=this._plotDimensions.width-this._offsets.left-this._offsets.right+"px";var f=this._plotDimensions.height-this._offsets.top-this._offsets.bottom+"px";this._elem=a(g);this._elem.css({position:"absolute",width:d,height:f,left:this._offsets.left,top:this._offsets.top});this._elem.addClass(b);return this._elem};a.jqplot.BlockCanvas.prototype.setContext=function(){this._ctx={canvas:{width:0,height:0},clearRect:function(){return null}};return this._ctx}})(jQuery);
|
||||||
@@ -0,0 +1,759 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
var arrayMax = function( array ){
|
||||||
|
return Math.max.apply( Math, array );
|
||||||
|
};
|
||||||
|
var arrayMin = function( array ){
|
||||||
|
return Math.min.apply( Math, array );
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.BubbleRenderer
|
||||||
|
* Plugin renderer to draw a bubble chart. A Bubble chart has data points displayed as
|
||||||
|
* colored circles with an optional text label inside. To use
|
||||||
|
* the bubble renderer, you must include the bubble renderer like:
|
||||||
|
*
|
||||||
|
* > <script language="javascript" type="text/javascript" src="../src/plugins/jqplot.bubbleRenderer.js"></script>
|
||||||
|
*
|
||||||
|
* Data must be supplied in
|
||||||
|
* the form:
|
||||||
|
*
|
||||||
|
* > [[x1, y1, r1, <label or {label:'text', color:color}>], ...]
|
||||||
|
*
|
||||||
|
* where the label or options
|
||||||
|
* object is optional.
|
||||||
|
*
|
||||||
|
* Note that all bubble colors will be the same
|
||||||
|
* unless the "varyBubbleColors" option is set to true. Colors can be specified in the data array
|
||||||
|
* or in the seriesColors array option on the series. If no colors are defined, the default jqPlot
|
||||||
|
* series of 16 colors are used. Colors are automatically cycled around again if there are more
|
||||||
|
* bubbles than colors.
|
||||||
|
*
|
||||||
|
* Bubbles are autoscaled by default to fit within the chart area while maintaining
|
||||||
|
* relative sizes. If the "autoscaleBubbles" option is set to false, the r(adius) values
|
||||||
|
* in the data array a treated as literal pixel values for the radii of the bubbles.
|
||||||
|
*
|
||||||
|
* Properties are passed into the bubble renderer in the rendererOptions object of
|
||||||
|
* the series options like:
|
||||||
|
*
|
||||||
|
* > seriesDefaults: {
|
||||||
|
* > renderer: $.jqplot.BubbleRenderer,
|
||||||
|
* > rendererOptions: {
|
||||||
|
* > bubbleAlpha: 0.7,
|
||||||
|
* > varyBubbleColors: false
|
||||||
|
* > }
|
||||||
|
* > }
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$.jqplot.BubbleRenderer = function(){
|
||||||
|
$.jqplot.LineRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BubbleRenderer.prototype = new $.jqplot.LineRenderer();
|
||||||
|
$.jqplot.BubbleRenderer.prototype.constructor = $.jqplot.BubbleRenderer;
|
||||||
|
|
||||||
|
// called with scope of a series
|
||||||
|
$.jqplot.BubbleRenderer.prototype.init = function(options, plot) {
|
||||||
|
// Group: Properties
|
||||||
|
//
|
||||||
|
// prop: varyBubbleColors
|
||||||
|
// True to vary the color of each bubble in this series according to
|
||||||
|
// the seriesColors array. False to set each bubble to the color
|
||||||
|
// specified on this series. This has no effect if a css background color
|
||||||
|
// option is specified in the renderer css options.
|
||||||
|
this.varyBubbleColors = true;
|
||||||
|
// prop: autoscaleBubbles
|
||||||
|
// True to scale the bubble radius based on plot size.
|
||||||
|
// False will use the radius value as provided as a raw pixel value for
|
||||||
|
// bubble radius.
|
||||||
|
this.autoscaleBubbles = true;
|
||||||
|
// prop: autoscaleMultiplier
|
||||||
|
// Multiplier the bubble size if autoscaleBubbles is true.
|
||||||
|
this.autoscaleMultiplier = 1.0;
|
||||||
|
// prop: autoscalePointsFactor
|
||||||
|
// Factor which decreases bubble size based on how many bubbles on on the chart.
|
||||||
|
// 0 means no adjustment for number of bubbles. Negative values will decrease
|
||||||
|
// size of bubbles as more bubbles are added. Values between 0 and -0.2
|
||||||
|
// should work well.
|
||||||
|
this.autoscalePointsFactor = -0.07;
|
||||||
|
// prop: escapeHtml
|
||||||
|
// True to escape html in bubble label text.
|
||||||
|
this.escapeHtml = true;
|
||||||
|
// prop: highlightMouseOver
|
||||||
|
// True to highlight bubbles when moused over.
|
||||||
|
// This must be false to enable highlightMouseDown to highlight when clicking on a slice.
|
||||||
|
this.highlightMouseOver = true;
|
||||||
|
// prop: highlightMouseDown
|
||||||
|
// True to highlight when a mouse button is pressed over a bubble.
|
||||||
|
// This will be disabled if highlightMouseOver is true.
|
||||||
|
this.highlightMouseDown = false;
|
||||||
|
// prop: highlightColors
|
||||||
|
// An array of colors to use when highlighting a slice. Calculated automatically
|
||||||
|
// if not supplied.
|
||||||
|
this.highlightColors = [];
|
||||||
|
// prop: bubbleAlpha
|
||||||
|
// Alpha transparency to apply to all bubbles in this series.
|
||||||
|
this.bubbleAlpha = 1.0;
|
||||||
|
// prop: highlightAlpha
|
||||||
|
// Alpha transparency to apply when highlighting bubble.
|
||||||
|
// Set to value of bubbleAlpha by default.
|
||||||
|
this.highlightAlpha = null;
|
||||||
|
// prop: bubbleGradients
|
||||||
|
// True to color the bubbles with gradient fills instead of flat colors.
|
||||||
|
// NOT AVAILABLE IN IE due to lack of excanvas support for radial gradient fills.
|
||||||
|
// will be ignored in IE.
|
||||||
|
this.bubbleGradients = false;
|
||||||
|
// prop: showLabels
|
||||||
|
// True to show labels on bubbles (if any), false to not show.
|
||||||
|
this.showLabels = true;
|
||||||
|
// array of [point index, radius] which will be sorted in descending order to plot
|
||||||
|
// largest points below smaller points.
|
||||||
|
this.radii = [];
|
||||||
|
this.maxRadius = 0;
|
||||||
|
// index of the currenty highlighted point, if any
|
||||||
|
this._highlightedPoint = null;
|
||||||
|
// array of jQuery labels.
|
||||||
|
this.labels = [];
|
||||||
|
this.bubbleCanvases = [];
|
||||||
|
this._type = 'bubble';
|
||||||
|
|
||||||
|
// if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
|
||||||
|
if (options.highlightMouseDown && options.highlightMouseOver == null) {
|
||||||
|
options.highlightMouseOver = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend(true, this, options);
|
||||||
|
|
||||||
|
if (this.highlightAlpha == null) {
|
||||||
|
this.highlightAlpha = this.bubbleAlpha;
|
||||||
|
if (this.bubbleGradients) {
|
||||||
|
this.highlightAlpha = 0.35;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.autoscaleMultiplier = this.autoscaleMultiplier * Math.pow(this.data.length, this.autoscalePointsFactor);
|
||||||
|
|
||||||
|
// index of the currenty highlighted point, if any
|
||||||
|
this._highlightedPoint = null;
|
||||||
|
|
||||||
|
// adjust the series colors for options colors passed in with data or for alpha.
|
||||||
|
// note, this can leave undefined holes in the seriesColors array.
|
||||||
|
var comps;
|
||||||
|
for (var i=0; i<this.data.length; i++) {
|
||||||
|
var color = null;
|
||||||
|
var d = this.data[i];
|
||||||
|
this.maxRadius = Math.max(this.maxRadius, d[2]);
|
||||||
|
if (d[3]) {
|
||||||
|
if (typeof(d[3]) == 'object') {
|
||||||
|
color = d[3]['color'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (color == null) {
|
||||||
|
if (this.seriesColors[i] != null) {
|
||||||
|
color = this.seriesColors[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (color && this.bubbleAlpha < 1.0) {
|
||||||
|
comps = $.jqplot.getColorComponents(color);
|
||||||
|
color = 'rgba('+comps[0]+', '+comps[1]+', '+comps[2]+', '+this.bubbleAlpha+')';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (color) {
|
||||||
|
this.seriesColors[i] = color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!this.varyBubbleColors) {
|
||||||
|
this.seriesColors = [this.color];
|
||||||
|
}
|
||||||
|
|
||||||
|
this.colorGenerator = new $.jqplot.ColorGenerator(this.seriesColors);
|
||||||
|
|
||||||
|
// set highlight colors if none provided
|
||||||
|
if (this.highlightColors.length == 0) {
|
||||||
|
for (var i=0; i<this.seriesColors.length; i++){
|
||||||
|
var rgba = $.jqplot.getColorComponents(this.seriesColors[i]);
|
||||||
|
var newrgb = [rgba[0], rgba[1], rgba[2]];
|
||||||
|
var sum = newrgb[0] + newrgb[1] + newrgb[2];
|
||||||
|
for (var j=0; j<3; j++) {
|
||||||
|
// when darkening, lowest color component can be is 60.
|
||||||
|
newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
|
||||||
|
newrgb[j] = parseInt(newrgb[j], 10);
|
||||||
|
}
|
||||||
|
this.highlightColors.push('rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+', '+this.highlightAlpha+')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.highlightColorGenerator = new $.jqplot.ColorGenerator(this.highlightColors);
|
||||||
|
|
||||||
|
var sopts = {fill:true, isarc:true, angle:this.shadowAngle, alpha:this.shadowAlpha, closePath:true};
|
||||||
|
|
||||||
|
this.renderer.shadowRenderer.init(sopts);
|
||||||
|
|
||||||
|
this.canvas = new $.jqplot.DivCanvas();
|
||||||
|
this.canvas._plotDimensions = this._plotDimensions;
|
||||||
|
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
|
||||||
|
plot.postDrawHooks.addOnce(postPlotDraw);
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
// converts the user data values to grid coordinates and stores them
|
||||||
|
// in the gridData array.
|
||||||
|
// Called with scope of a series.
|
||||||
|
$.jqplot.BubbleRenderer.prototype.setGridData = function(plot) {
|
||||||
|
// recalculate the grid data
|
||||||
|
var xp = this._xaxis.series_u2p;
|
||||||
|
var yp = this._yaxis.series_u2p;
|
||||||
|
var data = this._plotData;
|
||||||
|
this.gridData = [];
|
||||||
|
var radii = [];
|
||||||
|
this.radii = [];
|
||||||
|
var dim = Math.min(plot._height, plot._width);
|
||||||
|
for (var i=0; i<this.data.length; i++) {
|
||||||
|
if (data[i] != null) {
|
||||||
|
this.gridData.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1]), data[i][2]]);
|
||||||
|
this.radii.push([i, data[i][2]]);
|
||||||
|
radii.push(data[i][2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var r, val, maxr = this.maxRadius = arrayMax(radii);
|
||||||
|
var l = this.gridData.length;
|
||||||
|
if (this.autoscaleBubbles) {
|
||||||
|
for (var i=0; i<l; i++) {
|
||||||
|
val = radii[i]/maxr;
|
||||||
|
r = this.autoscaleMultiplier * dim / 6;
|
||||||
|
this.gridData[i][2] = r * val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.radii.sort(function(a, b) { return b[1] - a[1]; });
|
||||||
|
};
|
||||||
|
|
||||||
|
// converts any arbitrary data values to grid coordinates and
|
||||||
|
// returns them. This method exists so that plugins can use a series'
|
||||||
|
// linerenderer to generate grid data points without overwriting the
|
||||||
|
// grid data associated with that series.
|
||||||
|
// Called with scope of a series.
|
||||||
|
$.jqplot.BubbleRenderer.prototype.makeGridData = function(data, plot) {
|
||||||
|
// recalculate the grid data
|
||||||
|
var xp = this._xaxis.series_u2p;
|
||||||
|
var yp = this._yaxis.series_u2p;
|
||||||
|
var gd = [];
|
||||||
|
var radii = [];
|
||||||
|
this.radii = [];
|
||||||
|
var dim = Math.min(plot._height, plot._width);
|
||||||
|
for (var i=0; i<data.length; i++) {
|
||||||
|
if (data[i] != null) {
|
||||||
|
gd.push([xp.call(this._xaxis, data[i][0]), yp.call(this._yaxis, data[i][1]), data[i][2]]);
|
||||||
|
radii.push(data[i][2]);
|
||||||
|
this.radii.push([i, data[i][2]]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
var r, val, maxr = this.maxRadius = arrayMax(radii);
|
||||||
|
var l = this.gridData.length;
|
||||||
|
if (this.autoscaleBubbles) {
|
||||||
|
for (var i=0; i<l; i++) {
|
||||||
|
val = radii[i]/maxr;
|
||||||
|
r = this.autoscaleMultiplier * dim / 6;
|
||||||
|
gd[i][2] = r * val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.radii.sort(function(a, b) { return b[1] - a[1]; });
|
||||||
|
return gd;
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with scope of series
|
||||||
|
$.jqplot.BubbleRenderer.prototype.draw = function (ctx, gd, options) {
|
||||||
|
if (this.plugins.pointLabels) {
|
||||||
|
this.plugins.pointLabels.show = false;
|
||||||
|
}
|
||||||
|
var opts = (options != undefined) ? options : {};
|
||||||
|
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
||||||
|
this.canvas._elem.empty();
|
||||||
|
for (var i=0; i<this.radii.length; i++) {
|
||||||
|
var idx = this.radii[i][0];
|
||||||
|
var t=null;
|
||||||
|
var color = null;
|
||||||
|
var el = null;
|
||||||
|
var tel = null;
|
||||||
|
var d = this.data[idx];
|
||||||
|
var gd = this.gridData[idx];
|
||||||
|
if (d[3]) {
|
||||||
|
if (typeof(d[3]) == 'object') {
|
||||||
|
t = d[3]['label'];
|
||||||
|
}
|
||||||
|
else if (typeof(d[3]) == 'string') {
|
||||||
|
t = d[3];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// color = (this.varyBubbleColors) ? this.colorGenerator.get(idx) : this.color;
|
||||||
|
color = this.colorGenerator.get(idx);
|
||||||
|
|
||||||
|
// If we're drawing a shadow, expand the canvas dimensions to accomodate.
|
||||||
|
var canvasRadius = gd[2];
|
||||||
|
var offset, depth;
|
||||||
|
if (this.shadow) {
|
||||||
|
offset = (0.7 + gd[2]/40).toFixed(1);
|
||||||
|
depth = 1 + Math.ceil(gd[2]/15);
|
||||||
|
canvasRadius += offset*depth;
|
||||||
|
}
|
||||||
|
this.bubbleCanvases[idx] = new $.jqplot.BubbleCanvas();
|
||||||
|
this.canvas._elem.append(this.bubbleCanvases[idx].createElement(gd[0], gd[1], canvasRadius));
|
||||||
|
this.bubbleCanvases[idx].setContext();
|
||||||
|
var ctx = this.bubbleCanvases[idx]._ctx;
|
||||||
|
var x = ctx.canvas.width/2;
|
||||||
|
var y = ctx.canvas.height/2;
|
||||||
|
if (this.shadow) {
|
||||||
|
this.renderer.shadowRenderer.draw(ctx, [x, y, gd[2], 0, 2*Math.PI], {offset: offset, depth: depth});
|
||||||
|
}
|
||||||
|
this.bubbleCanvases[idx].draw(gd[2], color, this.bubbleGradients, this.shadowAngle/180*Math.PI);
|
||||||
|
|
||||||
|
// now draw label.
|
||||||
|
if (t && this.showLabels) {
|
||||||
|
tel = $('<div style="position:absolute;" class="jqplot-bubble-label"></div>');
|
||||||
|
if (this.escapeHtml) {
|
||||||
|
tel.text(t);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
tel.html(t);
|
||||||
|
}
|
||||||
|
this.canvas._elem.append(tel);
|
||||||
|
var h = $(tel).outerHeight();
|
||||||
|
var w = $(tel).outerWidth();
|
||||||
|
var top = gd[1] - 0.5*h;
|
||||||
|
var left = gd[0] - 0.5*w;
|
||||||
|
tel.css({top: top, left: left});
|
||||||
|
this.labels[idx] = $(tel);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$.jqplot.DivCanvas = function() {
|
||||||
|
$.jqplot.ElemContainer.call(this);
|
||||||
|
this._ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DivCanvas.prototype = new $.jqplot.ElemContainer();
|
||||||
|
$.jqplot.DivCanvas.prototype.constructor = $.jqplot.DivCanvas;
|
||||||
|
|
||||||
|
$.jqplot.DivCanvas.prototype.createElement = function(offsets, clss, plotDimensions) {
|
||||||
|
this._offsets = offsets;
|
||||||
|
var klass = 'jqplot-DivCanvas';
|
||||||
|
if (clss != undefined) {
|
||||||
|
klass = clss;
|
||||||
|
}
|
||||||
|
var elem;
|
||||||
|
// if this canvas already has a dom element, don't make a new one.
|
||||||
|
if (this._elem) {
|
||||||
|
elem = this._elem.get(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
elem = document.createElement('div');
|
||||||
|
}
|
||||||
|
// if new plotDimensions supplied, use them.
|
||||||
|
if (plotDimensions != undefined) {
|
||||||
|
this._plotDimensions = plotDimensions;
|
||||||
|
}
|
||||||
|
|
||||||
|
var w = this._plotDimensions.width - this._offsets.left - this._offsets.right + 'px';
|
||||||
|
var h = this._plotDimensions.height - this._offsets.top - this._offsets.bottom + 'px';
|
||||||
|
this._elem = $(elem);
|
||||||
|
this._elem.css({ position: 'absolute', width:w, height:h, left: this._offsets.left, top: this._offsets.top });
|
||||||
|
|
||||||
|
this._elem.addClass(klass);
|
||||||
|
return this._elem;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DivCanvas.prototype.setContext = function() {
|
||||||
|
this._ctx = {
|
||||||
|
canvas:{
|
||||||
|
width:0,
|
||||||
|
height:0
|
||||||
|
},
|
||||||
|
clearRect:function(){return null;}
|
||||||
|
};
|
||||||
|
return this._ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BubbleCanvas = function() {
|
||||||
|
$.jqplot.ElemContainer.call(this);
|
||||||
|
this._ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BubbleCanvas.prototype = new $.jqplot.ElemContainer();
|
||||||
|
$.jqplot.BubbleCanvas.prototype.constructor = $.jqplot.BubbleCanvas;
|
||||||
|
|
||||||
|
// initialize with the x,y pont of bubble center and the bubble radius.
|
||||||
|
$.jqplot.BubbleCanvas.prototype.createElement = function(x, y, r) {
|
||||||
|
var klass = 'jqplot-bubble-point';
|
||||||
|
|
||||||
|
var elem;
|
||||||
|
// if this canvas already has a dom element, don't make a new one.
|
||||||
|
if (this._elem) {
|
||||||
|
elem = this._elem.get(0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
elem = document.createElement('canvas');
|
||||||
|
}
|
||||||
|
|
||||||
|
elem.width = (r != null) ? 2*r : elem.width;
|
||||||
|
elem.height = (r != null) ? 2*r : elem.height;
|
||||||
|
this._elem = $(elem);
|
||||||
|
var l = (x != null && r != null) ? x - r : this._elem.css('left');
|
||||||
|
var t = (y != null && r != null) ? y - r : this._elem.css('top');
|
||||||
|
this._elem.css({ position: 'absolute', left: l, top: t });
|
||||||
|
|
||||||
|
this._elem.addClass(klass);
|
||||||
|
if ($.jqplot.use_excanvas) {
|
||||||
|
window.G_vmlCanvasManager.init_(document);
|
||||||
|
elem = window.G_vmlCanvasManager.initElement(elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
return this._elem;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BubbleCanvas.prototype.draw = function(r, color, gradients, angle) {
|
||||||
|
var ctx = this._ctx;
|
||||||
|
// r = Math.floor(r*1.04);
|
||||||
|
// var x = Math.round(ctx.canvas.width/2);
|
||||||
|
// var y = Math.round(ctx.canvas.height/2);
|
||||||
|
var x = ctx.canvas.width/2;
|
||||||
|
var y = ctx.canvas.height/2;
|
||||||
|
ctx.save();
|
||||||
|
if (gradients && !$.jqplot.use_excanvas) {
|
||||||
|
r = r*1.04;
|
||||||
|
var comps = $.jqplot.getColorComponents(color);
|
||||||
|
var colorinner = 'rgba('+Math.round(comps[0]+0.8*(255-comps[0]))+', '+Math.round(comps[1]+0.8*(255-comps[1]))+', '+Math.round(comps[2]+0.8*(255-comps[2]))+', '+comps[3]+')';
|
||||||
|
var colorend = 'rgba('+comps[0]+', '+comps[1]+', '+comps[2]+', 0)';
|
||||||
|
// var rinner = Math.round(0.35 * r);
|
||||||
|
// var xinner = Math.round(x - Math.cos(angle) * 0.33 * r);
|
||||||
|
// var yinner = Math.round(y - Math.sin(angle) * 0.33 * r);
|
||||||
|
var rinner = 0.35 * r;
|
||||||
|
var xinner = x - Math.cos(angle) * 0.33 * r;
|
||||||
|
var yinner = y - Math.sin(angle) * 0.33 * r;
|
||||||
|
var radgrad = ctx.createRadialGradient(xinner, yinner, rinner, x, y, r);
|
||||||
|
radgrad.addColorStop(0, colorinner);
|
||||||
|
radgrad.addColorStop(0.93, color);
|
||||||
|
radgrad.addColorStop(0.96, colorend);
|
||||||
|
radgrad.addColorStop(1, colorend);
|
||||||
|
// radgrad.addColorStop(.98, colorend);
|
||||||
|
ctx.fillStyle = radgrad;
|
||||||
|
ctx.fillRect(0,0, ctx.canvas.width, ctx.canvas.height);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ctx.fillStyle = color;
|
||||||
|
ctx.strokeStyle = color;
|
||||||
|
ctx.lineWidth = 1;
|
||||||
|
ctx.beginPath();
|
||||||
|
var ang = 2*Math.PI;
|
||||||
|
ctx.arc(x, y, r, 0, ang, 0);
|
||||||
|
ctx.closePath();
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
ctx.restore();
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BubbleCanvas.prototype.setContext = function() {
|
||||||
|
this._ctx = this._elem.get(0).getContext("2d");
|
||||||
|
return this._ctx;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BubbleAxisRenderer = function() {
|
||||||
|
$.jqplot.LinearAxisRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.BubbleAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
||||||
|
$.jqplot.BubbleAxisRenderer.prototype.constructor = $.jqplot.BubbleAxisRenderer;
|
||||||
|
|
||||||
|
// called with scope of axis object.
|
||||||
|
$.jqplot.BubbleAxisRenderer.prototype.init = function(options){
|
||||||
|
$.extend(true, this, options);
|
||||||
|
var db = this._dataBounds;
|
||||||
|
var minsidx = 0,
|
||||||
|
minpidx = 0,
|
||||||
|
maxsidx = 0,
|
||||||
|
maxpidx = 0,
|
||||||
|
maxr = 0,
|
||||||
|
minr = 0,
|
||||||
|
minMaxRadius = 0,
|
||||||
|
maxMaxRadius = 0,
|
||||||
|
maxMult = 0,
|
||||||
|
minMult = 0;
|
||||||
|
// Go through all the series attached to this axis and find
|
||||||
|
// the min/max bounds for this axis.
|
||||||
|
for (var i=0; i<this._series.length; i++) {
|
||||||
|
var s = this._series[i];
|
||||||
|
var d = s._plotData;
|
||||||
|
|
||||||
|
for (var j=0; j<d.length; j++) {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
if (d[j][0] < db.min || db.min == null) {
|
||||||
|
db.min = d[j][0];
|
||||||
|
minsidx=i;
|
||||||
|
minpidx=j;
|
||||||
|
minr = d[j][2];
|
||||||
|
minMaxRadius = s.maxRadius;
|
||||||
|
minMult = s.autoscaleMultiplier;
|
||||||
|
}
|
||||||
|
if (d[j][0] > db.max || db.max == null) {
|
||||||
|
db.max = d[j][0];
|
||||||
|
maxsidx=i;
|
||||||
|
maxpidx=j;
|
||||||
|
maxr = d[j][2];
|
||||||
|
maxMaxRadius = s.maxRadius;
|
||||||
|
maxMult = s.autoscaleMultiplier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (d[j][1] < db.min || db.min == null) {
|
||||||
|
db.min = d[j][1];
|
||||||
|
minsidx=i;
|
||||||
|
minpidx=j;
|
||||||
|
minr = d[j][2];
|
||||||
|
minMaxRadius = s.maxRadius;
|
||||||
|
minMult = s.autoscaleMultiplier;
|
||||||
|
}
|
||||||
|
if (d[j][1] > db.max || db.max == null) {
|
||||||
|
db.max = d[j][1];
|
||||||
|
maxsidx=i;
|
||||||
|
maxpidx=j;
|
||||||
|
maxr = d[j][2];
|
||||||
|
maxMaxRadius = s.maxRadius;
|
||||||
|
maxMult = s.autoscaleMultiplier;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var minRatio = minr/minMaxRadius;
|
||||||
|
var maxRatio = maxr/maxMaxRadius;
|
||||||
|
|
||||||
|
// need to estimate the effect of the radius on total axis span and adjust axis accordingly.
|
||||||
|
var span = db.max - db.min;
|
||||||
|
// var dim = (this.name == 'xaxis' || this.name == 'x2axis') ? this._plotDimensions.width : this._plotDimensions.height;
|
||||||
|
var dim = Math.min(this._plotDimensions.width, this._plotDimensions.height);
|
||||||
|
|
||||||
|
var minfact = minRatio * minMult/3 * span;
|
||||||
|
var maxfact = maxRatio * maxMult/3 * span;
|
||||||
|
db.max += maxfact;
|
||||||
|
db.min -= minfact;
|
||||||
|
};
|
||||||
|
|
||||||
|
function highlight (plot, sidx, pidx) {
|
||||||
|
plot.plugins.bubbleRenderer.highlightLabelCanvas.empty();
|
||||||
|
var s = plot.series[sidx];
|
||||||
|
var canvas = plot.plugins.bubbleRenderer.highlightCanvas;
|
||||||
|
var ctx = canvas._ctx;
|
||||||
|
ctx.clearRect(0,0,ctx.canvas.width, ctx.canvas.height);
|
||||||
|
s._highlightedPoint = pidx;
|
||||||
|
plot.plugins.bubbleRenderer.highlightedSeriesIndex = sidx;
|
||||||
|
|
||||||
|
var color = s.highlightColorGenerator.get(pidx);
|
||||||
|
var x = s.gridData[pidx][0],
|
||||||
|
y = s.gridData[pidx][1],
|
||||||
|
r = s.gridData[pidx][2];
|
||||||
|
ctx.save();
|
||||||
|
ctx.fillStyle = color;
|
||||||
|
ctx.strokeStyle = color;
|
||||||
|
ctx.lineWidth = 1;
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.arc(x, y, r, 0, 2*Math.PI, 0);
|
||||||
|
ctx.closePath();
|
||||||
|
ctx.fill();
|
||||||
|
ctx.restore();
|
||||||
|
// bring label to front
|
||||||
|
if (s.labels[pidx]) {
|
||||||
|
plot.plugins.bubbleRenderer.highlightLabel = s.labels[pidx].clone();
|
||||||
|
plot.plugins.bubbleRenderer.highlightLabel.appendTo(plot.plugins.bubbleRenderer.highlightLabelCanvas);
|
||||||
|
plot.plugins.bubbleRenderer.highlightLabel.addClass('jqplot-bubble-label-highlight');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function unhighlight (plot) {
|
||||||
|
var canvas = plot.plugins.bubbleRenderer.highlightCanvas;
|
||||||
|
var sidx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
|
||||||
|
plot.plugins.bubbleRenderer.highlightLabelCanvas.empty();
|
||||||
|
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
||||||
|
for (var i=0; i<plot.series.length; i++) {
|
||||||
|
plot.series[i]._highlightedPoint = null;
|
||||||
|
}
|
||||||
|
plot.plugins.bubbleRenderer.highlightedSeriesIndex = null;
|
||||||
|
plot.target.trigger('jqplotDataUnhighlight');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function handleMove(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var si = neighbor.seriesIndex;
|
||||||
|
var pi = neighbor.pointIndex;
|
||||||
|
var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
|
||||||
|
var evt1 = jQuery.Event('jqplotDataMouseOver');
|
||||||
|
evt1.pageX = ev.pageX;
|
||||||
|
evt1.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt1, ins);
|
||||||
|
if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.bubbleRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||||
|
var evt = jQuery.Event('jqplotDataHighlight');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
highlight (plot, ins[0], ins[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neighbor == null) {
|
||||||
|
unhighlight (plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var si = neighbor.seriesIndex;
|
||||||
|
var pi = neighbor.pointIndex;
|
||||||
|
var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
|
||||||
|
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.bubbleRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||||
|
var evt = jQuery.Event('jqplotDataHighlight');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
highlight (plot, ins[0], ins[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neighbor == null) {
|
||||||
|
unhighlight (plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
var idx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
|
||||||
|
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||||
|
unhighlight(plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClick(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var si = neighbor.seriesIndex;
|
||||||
|
var pi = neighbor.pointIndex;
|
||||||
|
var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
|
||||||
|
var evt = jQuery.Event('jqplotDataClick');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var si = neighbor.seriesIndex;
|
||||||
|
var pi = neighbor.pointIndex;
|
||||||
|
var ins = [si, pi, neighbor.data, plot.series[si].gridData[pi][2]];
|
||||||
|
var idx = plot.plugins.bubbleRenderer.highlightedSeriesIndex;
|
||||||
|
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||||
|
unhighlight(plot);
|
||||||
|
}
|
||||||
|
var evt = jQuery.Event('jqplotDataRightClick');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// called within context of plot
|
||||||
|
// create a canvas which we can draw on.
|
||||||
|
// insert it before the eventCanvas, so eventCanvas will still capture events.
|
||||||
|
function postPlotDraw() {
|
||||||
|
// Memory Leaks patch
|
||||||
|
if (this.plugins.bubbleRenderer && this.plugins.bubbleRenderer.highlightCanvas) {
|
||||||
|
this.plugins.bubbleRenderer.highlightCanvas.resetCanvas();
|
||||||
|
this.plugins.bubbleRenderer.highlightCanvas = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugins.bubbleRenderer = {highlightedSeriesIndex:null};
|
||||||
|
this.plugins.bubbleRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
|
||||||
|
this.plugins.bubbleRenderer.highlightLabel = null;
|
||||||
|
this.plugins.bubbleRenderer.highlightLabelCanvas = $('<div style="position:absolute;"></div>');
|
||||||
|
var top = this._gridPadding.top;
|
||||||
|
var left = this._gridPadding.left;
|
||||||
|
var width = this._plotDimensions.width - this._gridPadding.left - this._gridPadding.right;
|
||||||
|
var height = this._plotDimensions.height - this._gridPadding.top - this._gridPadding.bottom;
|
||||||
|
this.plugins.bubbleRenderer.highlightLabelCanvas.css({top:top, left:left, width:width+'px', height:height+'px'});
|
||||||
|
|
||||||
|
this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-bubbleRenderer-highlight-canvas', this._plotDimensions, this));
|
||||||
|
this.eventCanvas._elem.before(this.plugins.bubbleRenderer.highlightLabelCanvas);
|
||||||
|
|
||||||
|
var hctx = this.plugins.bubbleRenderer.highlightCanvas.setContext();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// setup default renderers for axes and legend so user doesn't have to
|
||||||
|
// called with scope of plot
|
||||||
|
function preInit(target, data, options) {
|
||||||
|
options = options || {};
|
||||||
|
options.axesDefaults = options.axesDefaults || {};
|
||||||
|
options.seriesDefaults = options.seriesDefaults || {};
|
||||||
|
// only set these if there is a Bubble series
|
||||||
|
var setopts = false;
|
||||||
|
if (options.seriesDefaults.renderer == $.jqplot.BubbleRenderer) {
|
||||||
|
setopts = true;
|
||||||
|
}
|
||||||
|
else if (options.series) {
|
||||||
|
for (var i=0; i < options.series.length; i++) {
|
||||||
|
if (options.series[i].renderer == $.jqplot.BubbleRenderer) {
|
||||||
|
setopts = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setopts) {
|
||||||
|
options.axesDefaults.renderer = $.jqplot.BubbleAxisRenderer;
|
||||||
|
options.sortData = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$.jqplot.preInitHooks.push(preInit);
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(f){var d=function(m){return Math.max.apply(Math,m)};var j=function(m){return Math.min.apply(Math,m)};f.jqplot.BubbleRenderer=function(){f.jqplot.LineRenderer.call(this)};f.jqplot.BubbleRenderer.prototype=new f.jqplot.LineRenderer();f.jqplot.BubbleRenderer.prototype.constructor=f.jqplot.BubbleRenderer;f.jqplot.BubbleRenderer.prototype.init=function(w,t){this.varyBubbleColors=true;this.autoscaleBubbles=true;this.autoscaleMultiplier=1;this.autoscalePointsFactor=-0.07;this.escapeHtml=true;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.bubbleAlpha=1;this.highlightAlpha=null;this.bubbleGradients=false;this.showLabels=true;this.radii=[];this.maxRadius=0;this._highlightedPoint=null;this.labels=[];this.bubbleCanvases=[];this._type="bubble";if(w.highlightMouseDown&&w.highlightMouseOver==null){w.highlightMouseOver=false}f.extend(true,this,w);if(this.highlightAlpha==null){this.highlightAlpha=this.bubbleAlpha;if(this.bubbleGradients){this.highlightAlpha=0.35}}this.autoscaleMultiplier=this.autoscaleMultiplier*Math.pow(this.data.length,this.autoscalePointsFactor);this._highlightedPoint=null;var n;for(var r=0;r<this.data.length;r++){var p=null;var v=this.data[r];this.maxRadius=Math.max(this.maxRadius,v[2]);if(v[3]){if(typeof(v[3])=="object"){p=v[3]["color"]}}if(p==null){if(this.seriesColors[r]!=null){p=this.seriesColors[r]}}if(p&&this.bubbleAlpha<1){n=f.jqplot.getColorComponents(p);p="rgba("+n[0]+", "+n[1]+", "+n[2]+", "+this.bubbleAlpha+")"}if(p){this.seriesColors[r]=p}}if(!this.varyBubbleColors){this.seriesColors=[this.color]}this.colorGenerator=new f.jqplot.ColorGenerator(this.seriesColors);if(this.highlightColors.length==0){for(var r=0;r<this.seriesColors.length;r++){var o=f.jqplot.getColorComponents(this.seriesColors[r]);var u=[o[0],o[1],o[2]];var s=u[0]+u[1]+u[2];for(var q=0;q<3;q++){u[q]=(s>570)?u[q]*0.8:u[q]+0.3*(255-u[q]);u[q]=parseInt(u[q],10)}this.highlightColors.push("rgba("+u[0]+","+u[1]+","+u[2]+", "+this.highlightAlpha+")")}}this.highlightColorGenerator=new f.jqplot.ColorGenerator(this.highlightColors);var m={fill:true,isarc:true,angle:this.shadowAngle,alpha:this.shadowAlpha,closePath:true};this.renderer.shadowRenderer.init(m);this.canvas=new f.jqplot.DivCanvas();this.canvas._plotDimensions=this._plotDimensions;t.eventListenerHooks.addOnce("jqplotMouseMove",a);t.eventListenerHooks.addOnce("jqplotMouseDown",b);t.eventListenerHooks.addOnce("jqplotMouseUp",k);t.eventListenerHooks.addOnce("jqplotClick",g);t.eventListenerHooks.addOnce("jqplotRightClick",l);t.postDrawHooks.addOnce(h)};f.jqplot.BubbleRenderer.prototype.setGridData=function(w){var q=this._xaxis.series_u2p;var m=this._yaxis.series_u2p;var t=this._plotData;this.gridData=[];var s=[];this.radii=[];var v=Math.min(w._height,w._width);for(var u=0;u<this.data.length;u++){if(t[u]!=null){this.gridData.push([q.call(this._xaxis,t[u][0]),m.call(this._yaxis,t[u][1]),t[u][2]]);this.radii.push([u,t[u][2]]);s.push(t[u][2])}}var n,o,x=this.maxRadius=d(s);var p=this.gridData.length;if(this.autoscaleBubbles){for(var u=0;u<p;u++){o=s[u]/x;n=this.autoscaleMultiplier*v/6;this.gridData[u][2]=n*o}}this.radii.sort(function(y,r){return r[1]-y[1]})};f.jqplot.BubbleRenderer.prototype.makeGridData=function(t,w){var q=this._xaxis.series_u2p;var n=this._yaxis.series_u2p;var x=[];var s=[];this.radii=[];var v=Math.min(w._height,w._width);for(var u=0;u<t.length;u++){if(t[u]!=null){x.push([q.call(this._xaxis,t[u][0]),n.call(this._yaxis,t[u][1]),t[u][2]]);s.push(t[u][2]);this.radii.push([u,t[u][2]])}}var m,o,y=this.maxRadius=d(s);var p=this.gridData.length;if(this.autoscaleBubbles){for(var u=0;u<p;u++){o=s[u]/y;m=this.autoscaleMultiplier*v/6;x[u][2]=m*o}}this.radii.sort(function(z,r){return r[1]-z[1]});return x};f.jqplot.BubbleRenderer.prototype.draw=function(D,J,n){if(this.plugins.pointLabels){this.plugins.pointLabels.show=false}var A=(n!=undefined)?n:{};var r=(A.shadow!=undefined)?A.shadow:this.shadow;this.canvas._elem.empty();for(var G=0;G<this.radii.length;G++){var C=this.radii[G][0];var z=null;var F=null;var m=null;var p=null;var I=this.data[C];var J=this.gridData[C];if(I[3]){if(typeof(I[3])=="object"){z=I[3]["label"]}else{if(typeof(I[3])=="string"){z=I[3]}}}F=this.colorGenerator.get(C);var E=J[2];var q,K;if(this.shadow){q=(0.7+J[2]/40).toFixed(1);K=1+Math.ceil(J[2]/15);E+=q*K}this.bubbleCanvases[C]=new f.jqplot.BubbleCanvas();this.canvas._elem.append(this.bubbleCanvases[C].createElement(J[0],J[1],E));this.bubbleCanvases[C].setContext();var D=this.bubbleCanvases[C]._ctx;var u=D.canvas.width/2;var s=D.canvas.height/2;if(this.shadow){this.renderer.shadowRenderer.draw(D,[u,s,J[2],0,2*Math.PI],{offset:q,depth:K})}this.bubbleCanvases[C].draw(J[2],F,this.bubbleGradients,this.shadowAngle/180*Math.PI);if(z&&this.showLabels){p=f('<div style="position:absolute;" class="jqplot-bubble-label"></div>');if(this.escapeHtml){p.text(z)}else{p.html(z)}this.canvas._elem.append(p);var H=f(p).outerHeight();var v=f(p).outerWidth();var B=J[1]-0.5*H;vLine truncated
|
||||||
@@ -0,0 +1,203 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.CanvasAxisLabelRenderer
|
||||||
|
* Renderer to draw axis labels with a canvas element to support advanced
|
||||||
|
* featrues such as rotated text. This renderer uses a separate rendering engine
|
||||||
|
* to draw the text on the canvas. Two modes of rendering the text are available.
|
||||||
|
* If the browser has native font support for canvas fonts (currently Mozila 3.5
|
||||||
|
* and Safari 4), you can enable text rendering with the canvas fillText method.
|
||||||
|
* You do so by setting the "enableFontSupport" option to true.
|
||||||
|
*
|
||||||
|
* Browsers lacking native font support will have the text drawn on the canvas
|
||||||
|
* using the Hershey font metrics. Even if the "enableFontSupport" option is true
|
||||||
|
* non-supporting browsers will still render with the Hershey font.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$.jqplot.CanvasAxisLabelRenderer = function(options) {
|
||||||
|
// Group: Properties
|
||||||
|
|
||||||
|
// prop: angle
|
||||||
|
// angle of text, measured clockwise from x axis.
|
||||||
|
this.angle = 0;
|
||||||
|
// name of the axis associated with this tick
|
||||||
|
this.axis;
|
||||||
|
// prop: show
|
||||||
|
// whether or not to show the tick (mark and label).
|
||||||
|
this.show = true;
|
||||||
|
// prop: showLabel
|
||||||
|
// whether or not to show the label.
|
||||||
|
this.showLabel = true;
|
||||||
|
// prop: label
|
||||||
|
// label for the axis.
|
||||||
|
this.label = '';
|
||||||
|
// prop: fontFamily
|
||||||
|
// CSS spec for the font-family css attribute.
|
||||||
|
// Applies only to browsers supporting native font rendering in the
|
||||||
|
// canvas tag. Currently Mozilla 3.5 and Safari 4.
|
||||||
|
this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
|
||||||
|
// prop: fontSize
|
||||||
|
// CSS spec for font size.
|
||||||
|
this.fontSize = '11pt';
|
||||||
|
// prop: fontWeight
|
||||||
|
// CSS spec for fontWeight: normal, bold, bolder, lighter or a number 100 - 900
|
||||||
|
this.fontWeight = 'normal';
|
||||||
|
// prop: fontStretch
|
||||||
|
// Multiplier to condense or expand font width.
|
||||||
|
// Applies only to browsers which don't support canvas native font rendering.
|
||||||
|
this.fontStretch = 1.0;
|
||||||
|
// prop: textColor
|
||||||
|
// css spec for the color attribute.
|
||||||
|
this.textColor = '#666666';
|
||||||
|
// prop: enableFontSupport
|
||||||
|
// true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
|
||||||
|
// If true, label will be drawn with canvas tag native support for fonts.
|
||||||
|
// If false, label will be drawn with Hershey font metrics.
|
||||||
|
this.enableFontSupport = true;
|
||||||
|
// prop: pt2px
|
||||||
|
// Point to pixel scaling factor, used for computing height of bounding box
|
||||||
|
// around a label. The labels text renderer has a default setting of 1.4, which
|
||||||
|
// should be suitable for most fonts. Leave as null to use default. If tops of
|
||||||
|
// letters appear clipped, increase this. If bounding box seems too big, decrease.
|
||||||
|
// This is an issue only with the native font renderering capabilities of Mozilla
|
||||||
|
// 3.5 and Safari 4 since they do not provide a method to determine the font height.
|
||||||
|
this.pt2px = null;
|
||||||
|
|
||||||
|
this._elem;
|
||||||
|
this._ctx;
|
||||||
|
this._plotWidth;
|
||||||
|
this._plotHeight;
|
||||||
|
this._plotDimensions = {height:null, width:null};
|
||||||
|
|
||||||
|
$.extend(true, this, options);
|
||||||
|
|
||||||
|
if (options.angle == null && this.axis != 'xaxis' && this.axis != 'x2axis') {
|
||||||
|
this.angle = -90;
|
||||||
|
}
|
||||||
|
|
||||||
|
var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
|
||||||
|
if (this.pt2px) {
|
||||||
|
ropts.pt2px = this.pt2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.enableFontSupport) {
|
||||||
|
if ($.jqplot.support_canvas_text()) {
|
||||||
|
this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisLabelRenderer.prototype.init = function(options) {
|
||||||
|
$.extend(true, this, options);
|
||||||
|
this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
|
||||||
|
};
|
||||||
|
|
||||||
|
// return width along the x axis
|
||||||
|
// will check first to see if an element exists.
|
||||||
|
// if not, will return the computed text box width.
|
||||||
|
$.jqplot.CanvasAxisLabelRenderer.prototype.getWidth = function(ctx) {
|
||||||
|
if (this._elem) {
|
||||||
|
return this._elem.outerWidth(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var tr = this._textRenderer;
|
||||||
|
var l = tr.getWidth(ctx);
|
||||||
|
var h = tr.getHeight(ctx);
|
||||||
|
var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// return height along the y axis.
|
||||||
|
$.jqplot.CanvasAxisLabelRenderer.prototype.getHeight = function(ctx) {
|
||||||
|
if (this._elem) {
|
||||||
|
return this._elem.outerHeight(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var tr = this._textRenderer;
|
||||||
|
var l = tr.getWidth(ctx);
|
||||||
|
var h = tr.getHeight(ctx);
|
||||||
|
var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad = function() {
|
||||||
|
var a = this.angle * Math.PI/180;
|
||||||
|
return a;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisLabelRenderer.prototype.draw = function(ctx, plot) {
|
||||||
|
// Memory Leaks patch
|
||||||
|
if (this._elem) {
|
||||||
|
if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
|
||||||
|
window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._elem.emptyForce();
|
||||||
|
this._elem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a canvas here, but can't draw on it untill it is appended
|
||||||
|
// to dom for IE compatability.
|
||||||
|
var elem = plot.canvasManager.getCanvas();
|
||||||
|
|
||||||
|
this._textRenderer.setText(this.label, ctx);
|
||||||
|
var w = this.getWidth(ctx);
|
||||||
|
var h = this.getHeight(ctx);
|
||||||
|
elem.width = w;
|
||||||
|
elem.height = h;
|
||||||
|
elem.style.width = w;
|
||||||
|
elem.style.height = h;
|
||||||
|
|
||||||
|
elem = plot.canvasManager.initCanvas(elem);
|
||||||
|
|
||||||
|
this._elem = $(elem);
|
||||||
|
this._elem.css({ position: 'absolute'});
|
||||||
|
this._elem.addClass('jqplot-'+this.axis+'-label');
|
||||||
|
|
||||||
|
elem = null;
|
||||||
|
return this._elem;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisLabelRenderer.prototype.pack = function() {
|
||||||
|
this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(a){a.jqplot.CanvasAxisLabelRenderer=function(b){this.angle=0;this.axis;this.show=true;this.showLabel=true;this.label="";this.fontFamily='"Trebuchet MS", Arial, Helvetica, sans-serif';this.fontSize="11pt";this.fontWeight="normal";this.fontStretch=1;this.textColor="#666666";this.enableFontSupport=true;this.pt2px=null;this._elem;this._ctx;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null};a.extend(true,this,b);if(b.angle==null&&this.axis!="xaxis"&&this.axis!="x2axis"){this.angle=-90}var c={fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily};if(this.pt2px){c.pt2px=this.pt2px}if(this.enableFontSupport){if(a.jqplot.support_canvas_text()){this._textRenderer=new a.jqplot.CanvasFontRenderer(c)}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}};a.jqplot.CanvasAxisLabelRenderer.prototype.init=function(b){a.extend(true,this,b);this._textRenderer.init({fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily})};a.jqplot.CanvasAxisLabelRenderer.prototype.getWidth=function(d){if(this._elem){return this._elem.outerWidth(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.sin(f.angle)*e)+Math.abs(Math.cos(f.angle)*c);return b}};a.jqplot.CanvasAxisLabelRenderer.prototype.getHeight=function(d){if(this._elem){return this._elem.outerHeight(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.cos(f.angle)*e)+Math.abs(Math.sin(f.angle)*c);return b}};a.jqplot.CanvasAxisLabelRenderer.prototype.getAngleRad=function(){var b=this.angle*Math.PI/180;return b};a.jqplot.CanvasAxisLabelRenderer.prototype.draw=function(c,f){if(this._elem){if(a.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}this._elem.emptyForce();this._elem=null}var e=f.canvasManager.getCanvas();this._textRenderer.setText(this.label,c);var b=this.getWidth(c);var d=this.getHeight(c);e.width=b;e.height=d;e.style.width=b;e.style.height=d;e=f.canvasManager.initCanvas(e);this._elem=a(e);this._elem.css({position:"absolute"});this._elem.addClass("jqplot-"+this.axis+"-label");e=null;return this._elem};a.jqplot.CanvasAxisLabelRenderer.prototype.pack=function(){this._textRenderer.draw(this._elem.get(0).getContext("2d"),this.label)}})(jQuery);
|
||||||
@@ -0,0 +1,253 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.CanvasAxisTickRenderer
|
||||||
|
* Renderer to draw axis ticks with a canvas element to support advanced
|
||||||
|
* featrues such as rotated text. This renderer uses a separate rendering engine
|
||||||
|
* to draw the text on the canvas. Two modes of rendering the text are available.
|
||||||
|
* If the browser has native font support for canvas fonts (currently Mozila 3.5
|
||||||
|
* and Safari 4), you can enable text rendering with the canvas fillText method.
|
||||||
|
* You do so by setting the "enableFontSupport" option to true.
|
||||||
|
*
|
||||||
|
* Browsers lacking native font support will have the text drawn on the canvas
|
||||||
|
* using the Hershey font metrics. Even if the "enableFontSupport" option is true
|
||||||
|
* non-supporting browsers will still render with the Hershey font.
|
||||||
|
*/
|
||||||
|
$.jqplot.CanvasAxisTickRenderer = function(options) {
|
||||||
|
// Group: Properties
|
||||||
|
|
||||||
|
// prop: mark
|
||||||
|
// tick mark on the axis. One of 'inside', 'outside', 'cross', '' or null.
|
||||||
|
this.mark = 'outside';
|
||||||
|
// prop: showMark
|
||||||
|
// whether or not to show the mark on the axis.
|
||||||
|
this.showMark = true;
|
||||||
|
// prop: showGridline
|
||||||
|
// whether or not to draw the gridline on the grid at this tick.
|
||||||
|
this.showGridline = true;
|
||||||
|
// prop: isMinorTick
|
||||||
|
// if this is a minor tick.
|
||||||
|
this.isMinorTick = false;
|
||||||
|
// prop: angle
|
||||||
|
// angle of text, measured clockwise from x axis.
|
||||||
|
this.angle = 0;
|
||||||
|
// prop: markSize
|
||||||
|
// Length of the tick marks in pixels. For 'cross' style, length
|
||||||
|
// will be stoked above and below axis, so total length will be twice this.
|
||||||
|
this.markSize = 4;
|
||||||
|
// prop: show
|
||||||
|
// whether or not to show the tick (mark and label).
|
||||||
|
this.show = true;
|
||||||
|
// prop: showLabel
|
||||||
|
// whether or not to show the label.
|
||||||
|
this.showLabel = true;
|
||||||
|
// prop: labelPosition
|
||||||
|
// 'auto', 'start', 'middle' or 'end'.
|
||||||
|
// Whether tick label should be positioned so the start, middle, or end
|
||||||
|
// of the tick mark.
|
||||||
|
this.labelPosition = 'auto';
|
||||||
|
this.label = '';
|
||||||
|
this.value = null;
|
||||||
|
this._styles = {};
|
||||||
|
// prop: formatter
|
||||||
|
// A class of a formatter for the tick text.
|
||||||
|
// The default $.jqplot.DefaultTickFormatter uses sprintf.
|
||||||
|
this.formatter = $.jqplot.DefaultTickFormatter;
|
||||||
|
// prop: formatString
|
||||||
|
// string passed to the formatter.
|
||||||
|
this.formatString = '';
|
||||||
|
// prop: prefix
|
||||||
|
// String to prepend to the tick label.
|
||||||
|
// Prefix is prepended to the formatted tick label.
|
||||||
|
this.prefix = '';
|
||||||
|
// prop: fontFamily
|
||||||
|
// css spec for the font-family css attribute.
|
||||||
|
this.fontFamily = '"Trebuchet MS", Arial, Helvetica, sans-serif';
|
||||||
|
// prop: fontSize
|
||||||
|
// CSS spec for font size.
|
||||||
|
this.fontSize = '10pt';
|
||||||
|
// prop: fontWeight
|
||||||
|
// CSS spec for fontWeight
|
||||||
|
this.fontWeight = 'normal';
|
||||||
|
// prop: fontStretch
|
||||||
|
// Multiplier to condense or expand font width.
|
||||||
|
// Applies only to browsers which don't support canvas native font rendering.
|
||||||
|
this.fontStretch = 1.0;
|
||||||
|
// prop: textColor
|
||||||
|
// css spec for the color attribute.
|
||||||
|
this.textColor = '#666666';
|
||||||
|
// prop: enableFontSupport
|
||||||
|
// true to turn on native canvas font support in Mozilla 3.5+ and Safari 4+.
|
||||||
|
// If true, tick label will be drawn with canvas tag native support for fonts.
|
||||||
|
// If false, tick label will be drawn with Hershey font metrics.
|
||||||
|
this.enableFontSupport = true;
|
||||||
|
// prop: pt2px
|
||||||
|
// Point to pixel scaling factor, used for computing height of bounding box
|
||||||
|
// around a label. The labels text renderer has a default setting of 1.4, which
|
||||||
|
// should be suitable for most fonts. Leave as null to use default. If tops of
|
||||||
|
// letters appear clipped, increase this. If bounding box seems too big, decrease.
|
||||||
|
// This is an issue only with the native font renderering capabilities of Mozilla
|
||||||
|
// 3.5 and Safari 4 since they do not provide a method to determine the font height.
|
||||||
|
this.pt2px = null;
|
||||||
|
|
||||||
|
this._elem;
|
||||||
|
this._ctx;
|
||||||
|
this._plotWidth;
|
||||||
|
this._plotHeight;
|
||||||
|
this._plotDimensions = {height:null, width:null};
|
||||||
|
|
||||||
|
$.extend(true, this, options);
|
||||||
|
|
||||||
|
var ropts = {fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily};
|
||||||
|
if (this.pt2px) {
|
||||||
|
ropts.pt2px = this.pt2px;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.enableFontSupport) {
|
||||||
|
if ($.jqplot.support_canvas_text()) {
|
||||||
|
this._textRenderer = new $.jqplot.CanvasFontRenderer(ropts);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._textRenderer = new $.jqplot.CanvasTextRenderer(ropts);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisTickRenderer.prototype.init = function(options) {
|
||||||
|
$.extend(true, this, options);
|
||||||
|
this._textRenderer.init({fontSize:this.fontSize, fontWeight:this.fontWeight, fontStretch:this.fontStretch, fillStyle:this.textColor, angle:this.getAngleRad(), fontFamily:this.fontFamily});
|
||||||
|
};
|
||||||
|
|
||||||
|
// return width along the x axis
|
||||||
|
// will check first to see if an element exists.
|
||||||
|
// if not, will return the computed text box width.
|
||||||
|
$.jqplot.CanvasAxisTickRenderer.prototype.getWidth = function(ctx) {
|
||||||
|
if (this._elem) {
|
||||||
|
return this._elem.outerWidth(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var tr = this._textRenderer;
|
||||||
|
var l = tr.getWidth(ctx);
|
||||||
|
var h = tr.getHeight(ctx);
|
||||||
|
var w = Math.abs(Math.sin(tr.angle)*h) + Math.abs(Math.cos(tr.angle)*l);
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// return height along the y axis.
|
||||||
|
$.jqplot.CanvasAxisTickRenderer.prototype.getHeight = function(ctx) {
|
||||||
|
if (this._elem) {
|
||||||
|
return this._elem.outerHeight(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
var tr = this._textRenderer;
|
||||||
|
var l = tr.getWidth(ctx);
|
||||||
|
var h = tr.getHeight(ctx);
|
||||||
|
var w = Math.abs(Math.cos(tr.angle)*h) + Math.abs(Math.sin(tr.angle)*l);
|
||||||
|
return w;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// return top.
|
||||||
|
$.jqplot.CanvasAxisTickRenderer.prototype.getTop = function(ctx) {
|
||||||
|
if (this._elem) {
|
||||||
|
return this._elem.position().top;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad = function() {
|
||||||
|
var a = this.angle * Math.PI/180;
|
||||||
|
return a;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisTickRenderer.prototype.setTick = function(value, axisName, isMinor) {
|
||||||
|
this.value = value;
|
||||||
|
if (isMinor) {
|
||||||
|
this.isMinorTick = true;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisTickRenderer.prototype.draw = function(ctx, plot) {
|
||||||
|
if (!this.label) {
|
||||||
|
this.label = this.prefix + this.formatter(this.formatString, this.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Memory Leaks patch
|
||||||
|
if (this._elem) {
|
||||||
|
if ($.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== undefined) {
|
||||||
|
window.G_vmlCanvasManager.uninitElement(this._elem.get(0));
|
||||||
|
}
|
||||||
|
|
||||||
|
this._elem.emptyForce();
|
||||||
|
this._elem = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a canvas here, but can't draw on it untill it is appended
|
||||||
|
// to dom for IE compatability.
|
||||||
|
|
||||||
|
var elem = plot.canvasManager.getCanvas();
|
||||||
|
|
||||||
|
this._textRenderer.setText(this.label, ctx);
|
||||||
|
var w = this.getWidth(ctx);
|
||||||
|
var h = this.getHeight(ctx);
|
||||||
|
// canvases seem to need to have width and heigh attributes directly set.
|
||||||
|
elem.width = w;
|
||||||
|
elem.height = h;
|
||||||
|
elem.style.width = w;
|
||||||
|
elem.style.height = h;
|
||||||
|
elem.style.textAlign = 'left';
|
||||||
|
elem.style.position = 'absolute';
|
||||||
|
|
||||||
|
elem = plot.canvasManager.initCanvas(elem);
|
||||||
|
|
||||||
|
this._elem = $(elem);
|
||||||
|
this._elem.css(this._styles);
|
||||||
|
this._elem.addClass('jqplot-'+this.axis+'-tick');
|
||||||
|
|
||||||
|
elem = null;
|
||||||
|
return this._elem;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasAxisTickRenderer.prototype.pack = function() {
|
||||||
|
this._textRenderer.draw(this._elem.get(0).getContext("2d"), this.label);
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(a){a.jqplot.CanvasAxisTickRenderer=function(b){this.mark="outside";this.showMark=true;this.showGridline=true;this.isMinorTick=false;this.angle=0;this.markSize=4;this.show=true;this.showLabel=true;this.labelPosition="auto";this.label="";this.value=null;this._styles={};this.formatter=a.jqplot.DefaultTickFormatter;this.formatString="";this.prefix="";this.fontFamily='"Trebuchet MS", Arial, Helvetica, sans-serif';this.fontSize="10pt";this.fontWeight="normal";this.fontStretch=1;this.textColor="#666666";this.enableFontSupport=true;this.pt2px=null;this._elem;this._ctx;this._plotWidth;this._plotHeight;this._plotDimensions={height:null,width:null};a.extend(true,this,b);var c={fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily};if(this.pt2px){c.pt2px=this.pt2px}if(this.enableFontSupport){if(a.jqplot.support_canvas_text()){this._textRenderer=new a.jqplot.CanvasFontRenderer(c)}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}}else{this._textRenderer=new a.jqplot.CanvasTextRenderer(c)}};a.jqplot.CanvasAxisTickRenderer.prototype.init=function(b){a.extend(true,this,b);this._textRenderer.init({fontSize:this.fontSize,fontWeight:this.fontWeight,fontStretch:this.fontStretch,fillStyle:this.textColor,angle:this.getAngleRad(),fontFamily:this.fontFamily})};a.jqplot.CanvasAxisTickRenderer.prototype.getWidth=function(d){if(this._elem){return this._elem.outerWidth(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.sin(f.angle)*e)+Math.abs(Math.cos(f.angle)*c);return b}};a.jqplot.CanvasAxisTickRenderer.prototype.getHeight=function(d){if(this._elem){return this._elem.outerHeight(true)}else{var f=this._textRenderer;var c=f.getWidth(d);var e=f.getHeight(d);var b=Math.abs(Math.cos(f.angle)*e)+Math.abs(Math.sin(f.angle)*c);return b}};a.jqplot.CanvasAxisTickRenderer.prototype.getTop=function(b){if(this._elem){return this._elem.position().top}else{return null}};a.jqplot.CanvasAxisTickRenderer.prototype.getAngleRad=function(){var b=this.angle*Math.PI/180;return b};a.jqplot.CanvasAxisTickRenderer.prototype.setTick=function(b,d,c){this.value=b;if(c){this.isMinorTick=true}return this};a.jqplot.CanvasAxisTickRenderer.prototype.draw=function(c,f){if(!this.label){this.label=this.prefix+this.formatter(this.formatString,this.value)}if(this._elem){if(a.jqplot.use_excanvas&&window.G_vmlCanvasManager.uninitElement!==undefined){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))}this._elem.emptyForce();this._elem=null}var e=f.canvasManager.getCanvas();this._textRenderer.setText(this.label,c);var b=this.getWidth(c);var d=this.getHeight(c);e.width=b;e.height=d;e.style.width=b;e.style.height=d;e.style.textAlign="left";e.style.position="absolute";e=f.canvasManager.initCanvas(e);this._elem=a(e);this._elem.css(this._styles);this._elem.addClass("jqplot-"+this.axis+"-tick");e=null;return this._elem};a.jqplot.CanvasAxisTickRenderer.prototype.pack=function(){this._textRenderer.draw(this._elem.get(0).getContext("2d"),this.label)}})(jQuery);
|
||||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(d){var f=0;d.jqplot.CanvasOverlay=function(q){var o=q||{};this.options={show:d.jqplot.config.enablePlugins,deferDraw:false};this.objects=[];this.objectNames=[];this.canvas=null;this.markerRenderer=new d.jqplot.MarkerRenderer({style:"line"});this.markerRenderer.init();this.highlightObjectIndex=null;if(o.objects){var s=o.objects,r;for(var p=0;p<s.length;p++){r=s[p];for(var t in r){switch(t){case"line":this.addLine(r[t]);break;case"horizontalLine":this.addHorizontalLine(r[t]);break;case"dashedHorizontalLine":this.addDashedHorizontalLine(r[t]);break;case"verticalLine":this.addVerticalLine(r[t]);break;case"dashedVerticalLine":this.addDashedVerticalLine(r[t]);break;case"rectangle":this.addRectangle(r[t]);break;default:break}}}}d.extend(true,this.options,o)};d.jqplot.CanvasOverlay.postPlotInit=function(q,p,o){var n=o||{};this.plugins.canvasOverlay=new d.jqplot.CanvasOverlay(n.canvasOverlay)};function i(){this.uid=null;this.type=null;this.gridStart=null;this.gridStop=null;this.tooltipWidthFactor=0;this.options={name:null,show:true,lineWidth:2,lineCap:"round",color:"#666666",shadow:true,shadowAngle:45,shadowOffset:1,shadowDepth:3,shadowAlpha:"0.07",xaxis:"xaxis",yaxis:"yaxis",showTooltip:false,showTooltipPrecision:0.6,tooltipLocation:"nw",fadeTooltip:true,tooltipFadeSpeed:"fast",tooltipOffset:4,tooltipFormatString:"%d, %d"}}function m(n){i.call(this);this.type="rectangle";var o={xmin:null,xmax:null,xOffset:"6px",xminOffset:null,xmaxOffset:null,ymin:null,ymax:null,yOffset:"6px",yminOffset:null,ymaxOffset:null};d.extend(true,this.options,o,n);if(this.options.showTooltipPrecision<0.01){this.options.showTooltipPrecision=0.01}}m.prototype=new i();m.prototype.constructor=m;function b(n){i.call(this);this.type="line";var o={start:[],stop:[]};d.extend(true,this.options,o,n);if(this.options.showTooltipPrecision<0.01){this.options.showTooltipPrecision=0.01}}b.prototype=new i();b.prototype.constructor=b;function e(n){i.call(this);this.type="horizontalLine";var o={y:null,xmin:null,xmax:null,xOffset:"6px",xminOffset:null,xmaxOffset:null};d.extend(true,this.options,o,n);if(this.options.showTooltipPrecision<0.01){this.options.showTooltipPrecision=0.01}}e.prototype=new i();e.prototype.constructor=e;function j(n){i.call(this);this.type="dashedHorizontalLine";var o={y:null,xmin:null,xmax:null,xOffset:"6px",xminOffset:null,xmaxOffset:null,dashPattern:[8,8]};d.extend(true,this.options,o,n);if(this.options.showTooltipPrecision<0.01){this.options.showTooltipPrecision=0.01}}j.prototype=new i();j.prototype.constructor=j;function c(n){i.call(this);this.type="verticalLine";var o={x:null,ymin:null,ymax:null,yOffset:"6px",yminOffset:null,ymaxOffset:null};d.extend(true,this.options,o,n);if(this.options.showTooltipPrecision<0.01){this.options.showTooltipPrecision=0.01}}c.prototype=new i();c.prototype.constructor=c;function l(n){i.call(this);this.type="dashedVerticalLine";this.start=null;this.stop=null;var o={x:null,ymin:null,ymax:null,yOffset:"6px",yminOffset:null,ymaxOffset:null,dashPattern:[8,8]};d.extend(true,this.options,o,n);if(this.options.showTooltipPrecision<0.01){this.options.showTooltipPrecision=0.01}}l.prototype=new i();l.prototype.constructor=l;d.jqplot.CanvasOverlay.prototype.addLine=function(o){var n=new b(o);n.uid=f++;this.objects.push(n);this.objectNames.push(n.options.name)};d.jqplot.CanvasOverlay.prototype.addHorizontalLine=function(o){var n=new e(o);n.uid=f++;this.objects.push(n);this.objectNames.push(n.options.name)};d.jqplot.CanvasOverlay.prototype.addDashedHorizontalLine=function(o){var n=new j(o);n.uid=f++;this.objects.push(n);this.objectNames.push(n.options.name)};d.jqplot.CanvasOverlay.prototype.addVerticalLine=function(o){var n=new c(o);n.uid=f++;this.objects.push(n);this.objectNames.push(n.options.name)};d.jqplot.CanvasOverlay.prototype.addDashedVerticalLine=function(o){var n=new l(o);n.uid=f++;this.objects.push(n);this.objectNames.push(n.options.name)};d.jqplot.CanvasOverlay.prototype.addRectangle=function(o){var n=new m(o);n.uid=f++;this.objects.push(n);this.objectNames.push(n.options.name)};d.jqplot.CanvasOverlay.prototype.removeObject=function(n){if(d.type(n)=="number"){this.objects.splice(n,1);this.objectNames.splice(n,1)}else{var o=d.inArray(n,this.objectNames);if(o!=-1){this.objects.splice(o,1);this.objectNames.splice(o,1)}}};d.jqplot.CanvasOverlay.prototype.getObject=function(n){if(d.type(n)=="number"){return this.objects[n]}else{var o=d.inArray(n,this.objectNames);if(o!=-1){return this.objects[o]}}};d.jqplot.CanvasOverlay.prototype.get=d.jqplot.CanvasOverlay.prototype.getObject;d.jqplot.CanvasOverlay.prototype.clear=function(n){this.canvas._ctx.clearRect(0,0,this.canvas.getWidth(),this.canvas.getHeight())};d.jqplot.CanvasOverlay.prototype.draw=function(K){var A,v=this.objects,F=this.markerRenderer,s,G;if(this.options.show){this.canvas._ctx.clearRect(0,0,this.canvas.getWidth(),this.canvas.getHeight());for(var H=0;H<v.length;H++){A=v[H];var B=d.extend(true,{},A.options);if(A.options.show){F.shadow=Line truncated
|
||||||
@@ -0,0 +1,449 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
* included jsDate library by Chris Leonello:
|
||||||
|
*
|
||||||
|
* Copyright (c) 2010-2013 Chris Leonello
|
||||||
|
*
|
||||||
|
* jsDate is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT and GPL version 2.0 licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* jsDate borrows many concepts and ideas from the Date Instance
|
||||||
|
* Methods by Ken Snyder along with some parts of Ken's actual code.
|
||||||
|
*
|
||||||
|
* Ken's original Date Instance Methods and copyright notice:
|
||||||
|
*
|
||||||
|
* Ken Snyder (ken d snyder at gmail dot com)
|
||||||
|
* 2008-09-10
|
||||||
|
* version 2.0.2 (http://kendsnyder.com/sandbox/date/)
|
||||||
|
* Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/)
|
||||||
|
*
|
||||||
|
* jqplotToImage function based on Larry Siden's export-jqplot-to-png.js.
|
||||||
|
* Larry has generously given permission to adapt his code for inclusion
|
||||||
|
* into jqPlot.
|
||||||
|
*
|
||||||
|
* Larry's original code can be found here:
|
||||||
|
*
|
||||||
|
* https://github.com/lsiden/export-jqplot-to-png
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function($) {
|
||||||
|
// This code is a modified version of the canvastext.js code, copyright below:
|
||||||
|
//
|
||||||
|
// This code is released to the public domain by Jim Studt, 2007.
|
||||||
|
// He may keep some sort of up to date copy at http://www.federated.com/~jim/canvastext/
|
||||||
|
//
|
||||||
|
$.jqplot.CanvasTextRenderer = function(options){
|
||||||
|
this.fontStyle = 'normal'; // normal, italic, oblique [not implemented]
|
||||||
|
this.fontVariant = 'normal'; // normal, small caps [not implemented]
|
||||||
|
this.fontWeight = 'normal'; // normal, bold, bolder, lighter, 100 - 900
|
||||||
|
this.fontSize = '10px';
|
||||||
|
this.fontFamily = 'sans-serif';
|
||||||
|
this.fontStretch = 1.0;
|
||||||
|
this.fillStyle = '#666666';
|
||||||
|
this.angle = 0;
|
||||||
|
this.textAlign = 'start';
|
||||||
|
this.textBaseline = 'alphabetic';
|
||||||
|
this.text;
|
||||||
|
this.width;
|
||||||
|
this.height;
|
||||||
|
this.pt2px = 1.28;
|
||||||
|
|
||||||
|
$.extend(true, this, options);
|
||||||
|
this.normalizedFontSize = this.normalizeFontSize(this.fontSize);
|
||||||
|
this.setHeight();
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.init = function(options) {
|
||||||
|
$.extend(true, this, options);
|
||||||
|
this.normalizedFontSize = this.normalizeFontSize(this.fontSize);
|
||||||
|
this.setHeight();
|
||||||
|
};
|
||||||
|
|
||||||
|
// convert css spec into point size
|
||||||
|
// returns float
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.normalizeFontSize = function(sz) {
|
||||||
|
sz = String(sz);
|
||||||
|
var n = parseFloat(sz);
|
||||||
|
if (sz.indexOf('px') > -1) {
|
||||||
|
return n/this.pt2px;
|
||||||
|
}
|
||||||
|
else if (sz.indexOf('pt') > -1) {
|
||||||
|
return n;
|
||||||
|
}
|
||||||
|
else if (sz.indexOf('em') > -1) {
|
||||||
|
return n*12;
|
||||||
|
}
|
||||||
|
else if (sz.indexOf('%') > -1) {
|
||||||
|
return n*12/100;
|
||||||
|
}
|
||||||
|
// default to pixels;
|
||||||
|
else {
|
||||||
|
return n/this.pt2px;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.fontWeight2Float = function(w) {
|
||||||
|
// w = normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900
|
||||||
|
// return values adjusted for Hershey font.
|
||||||
|
if (Number(w)) {
|
||||||
|
return w/400;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
switch (w) {
|
||||||
|
case 'normal':
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
case 'bold':
|
||||||
|
return 1.75;
|
||||||
|
break;
|
||||||
|
case 'bolder':
|
||||||
|
return 2.25;
|
||||||
|
break;
|
||||||
|
case 'lighter':
|
||||||
|
return 0.75;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
return 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.getText = function() {
|
||||||
|
return this.text;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.setText = function(t, ctx) {
|
||||||
|
this.text = t;
|
||||||
|
this.setWidth(ctx);
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.getWidth = function(ctx) {
|
||||||
|
return this.width;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.setWidth = function(ctx, w) {
|
||||||
|
if (!w) {
|
||||||
|
this.width = this.measure(ctx, this.text);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.width = w;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
// return height in pixels.
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.getHeight = function(ctx) {
|
||||||
|
return this.height;
|
||||||
|
};
|
||||||
|
|
||||||
|
// w - height in pt
|
||||||
|
// set heigh in px
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.setHeight = function(w) {
|
||||||
|
if (!w) {
|
||||||
|
//height = this.fontSize /0.75;
|
||||||
|
this.height = this.normalizedFontSize * this.pt2px;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.height = w;
|
||||||
|
}
|
||||||
|
return this;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.letter = function (ch)
|
||||||
|
{
|
||||||
|
return this.letters[ch];
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.ascent = function()
|
||||||
|
{
|
||||||
|
return this.normalizedFontSize;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.descent = function()
|
||||||
|
{
|
||||||
|
return 7.0*this.normalizedFontSize/25.0;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.measure = function(ctx, str)
|
||||||
|
{
|
||||||
|
var total = 0;
|
||||||
|
var len = str.length;
|
||||||
|
|
||||||
|
for (var i = 0; i < len; i++) {
|
||||||
|
var c = this.letter(str.charAt(i));
|
||||||
|
if (c) {
|
||||||
|
total += c.width * this.normalizedFontSize / 25.0 * this.fontStretch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return total;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.draw = function(ctx,str)
|
||||||
|
{
|
||||||
|
var x = 0;
|
||||||
|
// leave room at bottom for descenders.
|
||||||
|
var y = this.height*0.72;
|
||||||
|
var total = 0;
|
||||||
|
var len = str.length;
|
||||||
|
var mag = this.normalizedFontSize / 25.0;
|
||||||
|
|
||||||
|
ctx.save();
|
||||||
|
var tx, ty;
|
||||||
|
|
||||||
|
// 1st quadrant
|
||||||
|
if ((-Math.PI/2 <= this.angle && this.angle <= 0) || (Math.PI*3/2 <= this.angle && this.angle <= Math.PI*2)) {
|
||||||
|
tx = 0;
|
||||||
|
ty = -Math.sin(this.angle) * this.width;
|
||||||
|
}
|
||||||
|
// 4th quadrant
|
||||||
|
else if ((0 < this.angle && this.angle <= Math.PI/2) || (-Math.PI*2 <= this.angle && this.angle <= -Math.PI*3/2)) {
|
||||||
|
tx = Math.sin(this.angle) * this.height;
|
||||||
|
ty = 0;
|
||||||
|
}
|
||||||
|
// 2nd quadrant
|
||||||
|
else if ((-Math.PI < this.angle && this.angle < -Math.PI/2) || (Math.PI <= this.angle && this.angle <= Math.PI*3/2)) {
|
||||||
|
tx = -Math.cos(this.angle) * this.width;
|
||||||
|
ty = -Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height;
|
||||||
|
}
|
||||||
|
// 3rd quadrant
|
||||||
|
else if ((-Math.PI*3/2 < this.angle && this.angle < Math.PI) || (Math.PI/2 < this.angle && this.angle < Math.PI)) {
|
||||||
|
tx = Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width;
|
||||||
|
ty = -Math.cos(this.angle) * this.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.strokeStyle = this.fillStyle;
|
||||||
|
ctx.fillStyle = this.fillStyle;
|
||||||
|
ctx.translate(tx, ty);
|
||||||
|
ctx.rotate(this.angle);
|
||||||
|
ctx.lineCap = "round";
|
||||||
|
// multiplier was 2.0
|
||||||
|
var fact = (this.normalizedFontSize > 30) ? 2.0 : 2 + (30 - this.normalizedFontSize)/20;
|
||||||
|
ctx.lineWidth = fact * mag * this.fontWeight2Float(this.fontWeight);
|
||||||
|
|
||||||
|
for ( var i = 0; i < len; i++) {
|
||||||
|
var c = this.letter( str.charAt(i));
|
||||||
|
if ( !c) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.beginPath();
|
||||||
|
|
||||||
|
var penUp = 1;
|
||||||
|
var needStroke = 0;
|
||||||
|
for ( var j = 0; j < c.points.length; j++) {
|
||||||
|
var a = c.points[j];
|
||||||
|
if ( a[0] == -1 && a[1] == -1) {
|
||||||
|
penUp = 1;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if ( penUp) {
|
||||||
|
ctx.moveTo( x + a[0]*mag*this.fontStretch, y - a[1]*mag);
|
||||||
|
penUp = false;
|
||||||
|
} else {
|
||||||
|
ctx.lineTo( x + a[0]*mag*this.fontStretch, y - a[1]*mag);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ctx.stroke();
|
||||||
|
x += c.width*mag*this.fontStretch;
|
||||||
|
}
|
||||||
|
ctx.restore();
|
||||||
|
return total;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasTextRenderer.prototype.letters = {
|
||||||
|
' ': { width: 16, points: [] },
|
||||||
|
'!': { width: 10, points: [[5,21],[5,7],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] },
|
||||||
|
'"': { width: 16, points: [[4,21],[4,14],[-1,-1],[12,21],[12,14]] },
|
||||||
|
'#': { width: 21, points: [[11,25],[4,-7],[-1,-1],[17,25],[10,-7],[-1,-1],[4,12],[18,12],[-1,-1],[3,6],[17,6]] },
|
||||||
|
'$': { width: 20, points: [[8,25],[8,-4],[-1,-1],[12,25],[12,-4],[-1,-1],[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
|
||||||
|
'%': { width: 24, points: [[21,21],[3,0],[-1,-1],[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],[10,20],[13,19],[16,19],[19,20],[21,21],[-1,-1],[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]] },
|
||||||
|
'&': { width: 26, points: [[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]] },
|
||||||
|
'\'': { width: 10, points: [[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]] },
|
||||||
|
'(': { width: 14, points: [[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]] },
|
||||||
|
')': { width: 14, points: [[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]] },
|
||||||
|
'*': { width: 16, points: [[8,21],[8,9],[-1,-1],[3,18],[13,12],[-1,-1],[13,18],[3,12]] },
|
||||||
|
'+': { width: 26, points: [[13,18],[13,0],[-1,-1],[4,9],[22,9]] },
|
||||||
|
',': { width: 10, points: [[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
|
||||||
|
'-': { width: 18, points: [[6,9],[12,9]] },
|
||||||
|
'.': { width: 10, points: [[5,2],[4,1],[5,0],[6,1],[5,2]] },
|
||||||
|
'/': { width: 22, points: [[20,25],[2,-7]] },
|
||||||
|
'0': { width: 20, points: [[9,21],[6,20],[4,17],[3,12],[3,9],[4,4],[6,1],[9,0],[11,0],[14,1],[16,4],[17,9],[17,12],[16,17],[14,20],[11,21],[9,21]] },
|
||||||
|
'1': { width: 20, points: [[6,17],[8,18],[11,21],[11,0]] },
|
||||||
|
'2': { width: 20, points: [[4,16],[4,17],[5,19],[6,20],[8,21],[12,21],[14,20],[15,19],[16,17],[16,15],[15,13],[13,10],[3,0],[17,0]] },
|
||||||
|
'3': { width: 20, points: [[5,21],[16,21],[10,13],[13,13],[15,12],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
|
||||||
|
'4': { width: 20, points: [[13,21],[3,7],[18,7],[-1,-1],[13,21],[13,0]] },
|
||||||
|
'5': { width: 20, points: [[15,21],[5,21],[4,12],[5,13],[8,14],[11,14],[14,13],[16,11],[17,8],[17,6],[16,3],[14,1],[11,0],[8,0],[5,1],[4,2],[3,4]] },
|
||||||
|
'6': { width: 20, points: [[16,18],[15,20],[12,21],[10,21],[7,20],[5,17],[4,12],[4,7],[5,3],[7,1],[10,0],[11,0],[14,1],[16,3],[17,6],[17,7],[16,10],[14,12],[11,13],[10,13],[7,12],[5,10],[4,7]] },
|
||||||
|
'7': { width: 20, points: [[17,21],[7,0],[-1,-1],[3,21],[17,21]] },
|
||||||
|
'8': { width: 20, points: [[8,21],[5,20],[4,18],[4,16],[5,14],[7,13],[11,12],[14,11],[16,9],[17,7],[17,4],[16,2],[15,1],[12,0],[8,0],[5,1],[4,2],[3,4],[3,7],[4,9],[6,11],[9,12],[13,13],[15,14],[16,16],[16,18],[15,20],[12,21],[8,21]] },
|
||||||
|
'9': { width: 20, points: [[16,14],[15,11],[13,9],[10,8],[9,8],[6,9],[4,11],[3,14],[3,15],[4,18],[6,20],[9,21],[10,21],[13,20],[15,18],[16,14],[16,9],[15,4],[13,1],[10,0],[8,0],[5,1],[4,3]] },
|
||||||
|
':': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]] },
|
||||||
|
';': { width: 10, points: [[5,14],[4,13],[5,12],[6,13],[5,14],[-1,-1],[6,1],[5,0],[4,1],[5,2],[6,1],[6,-1],[5,-3],[4,-4]] },
|
||||||
|
'<': { width: 24, points: [[20,18],[4,9],[20,0]] },
|
||||||
|
'=': { width: 26, points: [[4,12],[22,12],[-1,-1],[4,6],[22,6]] },
|
||||||
|
'>': { width: 24, points: [[4,18],[20,9],[4,0]] },
|
||||||
|
'?': { width: 18, points: [[3,16],[3,17],[4,19],[5,20],[7,21],[11,21],[13,20],[14,19],[15,17],[15,15],[14,13],[13,12],[9,10],[9,7],[-1,-1],[9,2],[8,1],[9,0],[10,1],[9,2]] },
|
||||||
|
'@': { width: 27, points: [[18,13],[17,15],[15,16],[12,16],[10,15],[9,14],[8,11],[8,8],[9,6],[11,5],[14,5],[16,6],[17,8],[-1,-1],[12,16],[10,14],[9,11],[9,8],[10,6],[11,5],[-1,-1],[18,16],[17,8],[17,6],[19,5],[21,5],[23,7],[24,10],[24,12],[23,15],[22,17],[20,19],[18,20],[15,21],[12,21],[9,20],[7,19],[5,17],[4,15],[3,12],[3,9],[4,6],[5,4],[7,2],[9,1],[12,0],[15,0],[18,1],[20,2],[21,3],[-1,-1],[19,16],[18,8],[18,6],[19,5]] },
|
||||||
|
'A': { width: 18, points: [[9,21],[1,0],[-1,-1],[9,21],[17,0],[-1,-1],[4,7],[14,7]] },
|
||||||
|
'B': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[-1,-1],[4,11],[13,11],[16,10],[17,9],[18,7],[18,4],[17,2],[16,1],[13,0],[4,0]] },
|
||||||
|
'C': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5]] },
|
||||||
|
'D': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[11,21],[14,20],[16,18],[17,16],[18,13],[18,8],[17,5],[16,3],[14,1],[11,0],[4,0]] },
|
||||||
|
'E': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11],[-1,-1],[4,0],[17,0]] },
|
||||||
|
'F': { width: 18, points: [[4,21],[4,0],[-1,-1],[4,21],[17,21],[-1,-1],[4,11],[12,11]] },
|
||||||
|
'G': { width: 21, points: [[18,16],[17,18],[15,20],[13,21],[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[18,8],[-1,-1],[13,8],[18,8]] },
|
||||||
|
'H': { width: 22, points: [[4,21],[4,0],[-1,-1],[18,21],[18,0],[-1,-1],[4,11],[18,11]] },
|
||||||
|
'I': { width: 8, points: [[4,21],[4,0]] },
|
||||||
|
'J': { width: 16, points: [[12,21],[12,5],[11,2],[10,1],[8,0],[6,0],[4,1],[3,2],[2,5],[2,7]] },
|
||||||
|
'K': { width: 21, points: [[4,21],[4,0],[-1,-1],[18,21],[4,7],[-1,-1],[9,12],[18,0]] },
|
||||||
|
'L': { width: 17, points: [[4,21],[4,0],[-1,-1],[4,0],[16,0]] },
|
||||||
|
'M': { width: 24, points: [[4,21],[4,0],[-1,-1],[4,21],[12,0],[-1,-1],[20,21],[12,0],[-1,-1],[20,21],[20,0]] },
|
||||||
|
'N': { width: 22, points: [[4,21],[4,0],[-1,-1],[4,21],[18,0],[-1,-1],[18,21],[18,0]] },
|
||||||
|
'O': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21]] },
|
||||||
|
'P': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,14],[17,12],[16,11],[13,10],[4,10]] },
|
||||||
|
'Q': { width: 22, points: [[9,21],[7,20],[5,18],[4,16],[3,13],[3,8],[4,5],[5,3],[7,1],[9,0],[13,0],[15,1],[17,3],[18,5],[19,8],[19,13],[18,16],[17,18],[15,20],[13,21],[9,21],[-1,-1],[12,4],[18,-2]] },
|
||||||
|
'R': { width: 21, points: [[4,21],[4,0],[-1,-1],[4,21],[13,21],[16,20],[17,19],[18,17],[18,15],[17,13],[16,12],[13,11],[4,11],[-1,-1],[11,11],[18,0]] },
|
||||||
|
'S': { width: 20, points: [[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]] },
|
||||||
|
'T': { width: 16, points: [[8,21],[8,0],[-1,-1],[1,21],[15,21]] },
|
||||||
|
'U': { width: 22, points: [[4,21],[4,6],[5,3],[7,1],[10,0],[12,0],[15,1],[17,3],[18,6],[18,21]] },
|
||||||
|
'V': { width: 18, points: [[1,21],[9,0],[-1,-1],[17,21],[9,0]] },
|
||||||
|
'W': { width: 24, points: [[2,21],[7,0],[-1,-1],[12,21],[7,0],[-1,-1],[12,21],[17,0],[-1,-1],[22,21],[17,0]] },
|
||||||
|
'X': { width: 20, points: [[3,21],[17,0],[-1,-1],[17,21],[3,0]] },
|
||||||
|
'Y': { width: 18, points: [[1,21],[9,11],[9,0],[-1,-1],[17,21],[9,11]] },
|
||||||
|
'Z': { width: 20, points: [[17,21],[3,0],[-1,-1],[3,21],[17,21],[-1,-1],[3,0],[17,0]] },
|
||||||
|
'[': { width: 14, points: [[4,25],[4,-7],[-1,-1],[5,25],[5,-7],[-1,-1],[4,25],[11,25],[-1,-1],[4,-7],[11,-7]] },
|
||||||
|
'\\': { width: 14, points: [[0,21],[14,-3]] },
|
||||||
|
']': { width: 14, points: [[9,25],[9,-7],[-1,-1],[10,25],[10,-7],[-1,-1],[3,25],[10,25],[-1,-1],[3,-7],[10,-7]] },
|
||||||
|
'^': { width: 16, points: [[6,15],[8,18],[10,15],[-1,-1],[3,12],[8,17],[13,12],[-1,-1],[8,17],[8,0]] },
|
||||||
|
'_': { width: 16, points: [[0,-2],[16,-2]] },
|
||||||
|
'`': { width: 10, points: [[6,21],[5,20],[4,18],[4,16],[5,15],[6,16],[5,17]] },
|
||||||
|
'a': { width: 19, points: [[15,14],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||||
|
'b': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] },
|
||||||
|
'c': { width: 18, points: [[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||||
|
'd': { width: 19, points: [[15,21],[15,0],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||||
|
'e': { width: 18, points: [[3,8],[15,8],[15,10],[14,12],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||||
|
'f': { width: 12, points: [[10,21],[8,21],[6,20],[5,17],[5,0],[-1,-1],[2,14],[9,14]] },
|
||||||
|
'g': { width: 19, points: [[15,14],[15,-2],[14,-5],[13,-6],[11,-7],[8,-7],[6,-6],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||||
|
'h': { width: 19, points: [[4,21],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] },
|
||||||
|
'i': { width: 8, points: [[3,21],[4,20],[5,21],[4,22],[3,21],[-1,-1],[4,14],[4,0]] },
|
||||||
|
'j': { width: 10, points: [[5,21],[6,20],[7,21],[6,22],[5,21],[-1,-1],[6,14],[6,-3],[5,-6],[3,-7],[1,-7]] },
|
||||||
|
'k': { width: 17, points: [[4,21],[4,0],[-1,-1],[14,14],[4,4],[-1,-1],[8,8],[15,0]] },
|
||||||
|
'l': { width: 8, points: [[4,21],[4,0]] },
|
||||||
|
'm': { width: 30, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0],[-1,-1],[15,10],[18,13],[20,14],[23,14],[25,13],[26,10],[26,0]] },
|
||||||
|
'n': { width: 19, points: [[4,14],[4,0],[-1,-1],[4,10],[7,13],[9,14],[12,14],[14,13],[15,10],[15,0]] },
|
||||||
|
'o': { width: 19, points: [[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3],[16,6],[16,8],[15,11],[13,13],[11,14],[8,14]] },
|
||||||
|
'p': { width: 19, points: [[4,14],[4,-7],[-1,-1],[4,11],[6,13],[8,14],[11,14],[13,13],[15,11],[16,8],[16,6],[15,3],[13,1],[11,0],[8,0],[6,1],[4,3]] },
|
||||||
|
'q': { width: 19, points: [[15,14],[15,-7],[-1,-1],[15,11],[13,13],[11,14],[8,14],[6,13],[4,11],[3,8],[3,6],[4,3],[6,1],[8,0],[11,0],[13,1],[15,3]] },
|
||||||
|
'r': { width: 13, points: [[4,14],[4,0],[-1,-1],[4,8],[5,11],[7,13],[9,14],[12,14]] },
|
||||||
|
's': { width: 17, points: [[14,11],[13,13],[10,14],[7,14],[4,13],[3,11],[4,9],[6,8],[11,7],[13,6],[14,4],[14,3],[13,1],[10,0],[7,0],[4,1],[3,3]] },
|
||||||
|
't': { width: 12, points: [[5,21],[5,4],[6,1],[8,0],[10,0],[-1,-1],[2,14],[9,14]] },
|
||||||
|
'u': { width: 19, points: [[4,14],[4,4],[5,1],[7,0],[10,0],[12,1],[15,4],[-1,-1],[15,14],[15,0]] },
|
||||||
|
'v': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0]] },
|
||||||
|
'w': { width: 22, points: [[3,14],[7,0],[-1,-1],[11,14],[7,0],[-1,-1],[11,14],[15,0],[-1,-1],[19,14],[15,0]] },
|
||||||
|
'x': { width: 17, points: [[3,14],[14,0],[-1,-1],[14,14],[3,0]] },
|
||||||
|
'y': { width: 16, points: [[2,14],[8,0],[-1,-1],[14,14],[8,0],[6,-4],[4,-6],[2,-7],[1,-7]] },
|
||||||
|
'z': { width: 17, points: [[14,14],[3,0],[-1,-1],[3,14],[14,14],[-1,-1],[3,0],[14,0]] },
|
||||||
|
'{': { width: 14, points: [[9,25],[7,24],[6,23],[5,21],[5,19],[6,17],[7,16],[8,14],[8,12],[6,10],[-1,-1],[7,24],[6,22],[6,20],[7,18],[8,17],[9,15],[9,13],[8,11],[4,9],[8,7],[9,5],[9,3],[8,1],[7,0],[6,-2],[6,-4],[7,-6],[-1,-1],[6,8],[8,6],[8,4],[7,2],[6,1],[5,-1],[5,-3],[6,-5],[7,-6],[9,-7]] },
|
||||||
|
'|': { width: 8, points: [[4,25],[4,-7]] },
|
||||||
|
'}': { width: 14, points: [[5,25],[7,24],[8,23],[9,21],[9,19],[8,17],[7,16],[6,14],[6,12],[8,10],[-1,-1],[7,24],[8,22],[8,20],[7,18],[6,17],[5,15],[5,13],[6,11],[10,9],[6,7],[5,5],[5,3],[6,1],[7,0],[8,-2],[8,-4],[7,-6],[-1,-1],[8,8],[6,6],[6,4],[7,2],[8,1],[9,-1],[9,-3],[8,-5],[7,-6],[5,-7]] },
|
||||||
|
'~': { width: 24, points: [[3,6],[3,8],[4,11],[6,12],[8,12],[10,11],[14,8],[16,7],[18,7],[20,8],[21,10],[-1,-1],[3,8],[4,10],[6,11],[8,11],[10,10],[14,7],[16,6],[18,6],[20,7],[21,10],[21,12]] }
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasFontRenderer = function(options) {
|
||||||
|
options = options || {};
|
||||||
|
if (!options.pt2px) {
|
||||||
|
options.pt2px = 1.5;
|
||||||
|
}
|
||||||
|
$.jqplot.CanvasTextRenderer.call(this, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasFontRenderer.prototype = new $.jqplot.CanvasTextRenderer({});
|
||||||
|
$.jqplot.CanvasFontRenderer.prototype.constructor = $.jqplot.CanvasFontRenderer;
|
||||||
|
|
||||||
|
$.jqplot.CanvasFontRenderer.prototype.measure = function(ctx, str)
|
||||||
|
{
|
||||||
|
// var fstyle = this.fontStyle+' '+this.fontVariant+' '+this.fontWeight+' '+this.fontSize+' '+this.fontFamily;
|
||||||
|
var fstyle = this.fontSize+' '+this.fontFamily;
|
||||||
|
ctx.save();
|
||||||
|
ctx.font = fstyle;
|
||||||
|
var w = ctx.measureText(str).width;
|
||||||
|
ctx.restore();
|
||||||
|
return w;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CanvasFontRenderer.prototype.draw = function(ctx, str)
|
||||||
|
{
|
||||||
|
var x = 0;
|
||||||
|
// leave room at bottom for descenders.
|
||||||
|
var y = this.height*0.72;
|
||||||
|
//var y = 12;
|
||||||
|
|
||||||
|
ctx.save();
|
||||||
|
var tx, ty;
|
||||||
|
|
||||||
|
// 1st quadrant
|
||||||
|
if ((-Math.PI/2 <= this.angle && this.angle <= 0) || (Math.PI*3/2 <= this.angle && this.angle <= Math.PI*2)) {
|
||||||
|
tx = 0;
|
||||||
|
ty = -Math.sin(this.angle) * this.width;
|
||||||
|
}
|
||||||
|
// 4th quadrant
|
||||||
|
else if ((0 < this.angle && this.angle <= Math.PI/2) || (-Math.PI*2 <= this.angle && this.angle <= -Math.PI*3/2)) {
|
||||||
|
tx = Math.sin(this.angle) * this.height;
|
||||||
|
ty = 0;
|
||||||
|
}
|
||||||
|
// 2nd quadrant
|
||||||
|
else if ((-Math.PI < this.angle && this.angle < -Math.PI/2) || (Math.PI <= this.angle && this.angle <= Math.PI*3/2)) {
|
||||||
|
tx = -Math.cos(this.angle) * this.width;
|
||||||
|
ty = -Math.sin(this.angle) * this.width - Math.cos(this.angle) * this.height;
|
||||||
|
}
|
||||||
|
// 3rd quadrant
|
||||||
|
else if ((-Math.PI*3/2 < this.angle && this.angle < Math.PI) || (Math.PI/2 < this.angle && this.angle < Math.PI)) {
|
||||||
|
tx = Math.sin(this.angle) * this.height - Math.cos(this.angle)*this.width;
|
||||||
|
ty = -Math.cos(this.angle) * this.height;
|
||||||
|
}
|
||||||
|
ctx.strokeStyle = this.fillStyle;
|
||||||
|
ctx.fillStyle = this.fillStyle;
|
||||||
|
// var fstyle = this.fontStyle+' '+this.fontVariant+' '+this.fontWeight+' '+this.fontSize+' '+this.fontFamily;
|
||||||
|
var fstyle = this.fontSize+' '+this.fontFamily;
|
||||||
|
ctx.font = fstyle;
|
||||||
|
ctx.translate(tx, ty);
|
||||||
|
ctx.rotate(this.angle);
|
||||||
|
ctx.fillText(str, x, y);
|
||||||
|
// ctx.strokeText(str, x, y);
|
||||||
|
|
||||||
|
ctx.restore();
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(a){a.jqplot.CanvasTextRenderer=function(b){this.fontStyle="normal";this.fontVariant="normal";this.fontWeight="normal";this.fontSize="10px";this.fontFamily="sans-serif";this.fontStretch=1;this.fillStyle="#666666";this.angle=0;this.textAlign="start";this.textBaseline="alphabetic";this.text;this.width;this.height;this.pt2px=1.28;a.extend(true,this,b);this.normalizedFontSize=this.normalizeFontSize(this.fontSize);this.setHeight()};a.jqplot.CanvasTextRenderer.prototype.init=function(b){a.extend(true,this,b);this.normalizedFontSize=this.normalizeFontSize(this.fontSize);this.setHeight()};a.jqplot.CanvasTextRenderer.prototype.normalizeFontSize=function(b){b=String(b);var c=parseFloat(b);if(b.indexOf("px")>-1){return c/this.pt2px}else{if(b.indexOf("pt")>-1){return c}else{if(b.indexOf("em")>-1){return c*12}else{if(b.indexOf("%")>-1){return c*12/100}else{return c/this.pt2px}}}}};a.jqplot.CanvasTextRenderer.prototype.fontWeight2Float=function(b){if(Number(b)){return b/400}else{switch(b){case"normal":return 1;break;case"bold":return 1.75;break;case"bolder":return 2.25;break;case"lighter":return 0.75;break;default:return 1;break}}};a.jqplot.CanvasTextRenderer.prototype.getText=function(){return this.text};a.jqplot.CanvasTextRenderer.prototype.setText=function(c,b){this.text=c;this.setWidth(b);return this};a.jqplot.CanvasTextRenderer.prototype.getWidth=function(b){return this.width};a.jqplot.CanvasTextRenderer.prototype.setWidth=function(c,b){if(!b){this.width=this.measure(c,this.text)}else{this.width=b}return this};a.jqplot.CanvasTextRenderer.prototype.getHeight=function(b){return this.height};a.jqplot.CanvasTextRenderer.prototype.setHeight=function(b){if(!b){this.height=this.normalizedFontSize*this.pt2px}else{this.height=b}return this};a.jqplot.CanvasTextRenderer.prototype.letter=function(b){return this.letters[b]};a.jqplot.CanvasTextRenderer.prototype.ascent=function(){return this.normalizedFontSize};a.jqplot.CanvasTextRenderer.prototype.descent=function(){return 7*this.normalizedFontSize/25};a.jqplot.CanvasTextRenderer.prototype.measure=function(d,g){var f=0;var b=g.length;for(var e=0;e<b;e++){var h=this.letter(g.charAt(e));if(h){f+=h.width*this.normalizedFontSize/25*this.fontStretch}}return f};a.jqplot.CanvasTextRenderer.prototype.draw=function(s,n){var r=0;var o=this.height*0.72;var p=0;var l=n.length;var k=this.normalizedFontSize/25;s.save();var h,f;if((-Math.PI/2<=this.angle&&this.angle<=0)||(Math.PI*3/2<=this.angle&&this.angle<=Math.PI*2)){h=0;f=-Math.sin(this.angle)*this.width}else{if((0<this.angle&&this.angle<=Math.PI/2)||(-Math.PI*2<=this.angle&&this.angle<=-Math.PI*3/2)){h=Math.sin(this.angle)*this.height;f=0}else{if((-Math.PI<this.angle&&this.angle<-Math.PI/2)||(Math.PI<=this.angle&&this.angle<=Math.PI*3/2)){h=-Math.cos(this.angle)*this.width;f=-Math.sin(this.angle)*this.width-Math.cos(this.angle)*this.height}else{if((-Math.PI*3/2<this.angle&&this.angle<Math.PI)||(Math.PI/2<this.angle&&this.angle<Math.PI)){h=Math.sin(this.angle)*this.height-Math.cos(this.angle)*this.width;f=-Math.cos(this.angle)*this.height}}}}s.strokeStyle=this.fillStyle;s.fillStyle=this.fillStyle;s.translate(h,f);s.rotate(this.angle);s.lineCap="round";var t=(this.normalizedFontSize>30)?2:2+(30-this.normalizedFontSize)/20;s.lineWidth=t*k*this.fontWeight2Float(this.fontWeight);for(var g=0;g<l;g++){var m=this.letter(n.charAt(g));if(!m){continue}s.beginPath();var e=1;var b=0;for(var d=0;d<m.points.length;d++){var q=m.points[d];if(q[0]==-1&&q[1]==-1){e=1;continue}if(e){s.moveTo(r+q[0]*k*this.fontStretch,o-q[1]*k);e=false}else{s.lineTo(r+q[0]*k*this.fontStretch,o-q[1]*k)}}s.stroke();r+=m.width*k*this.fontStretch}s.restore();return p};a.jqplot.CanvasTextRenderer.prototype.letters={" ":{width:16,points:[]},"!":{width:10,points:[[5,21],[5,7],[-1,-1],[5,2],[4,1],[5,0],[6,1],[5,2]]},'"':{width:16,points:[[4,21],[4,14],[-1,-1],[12,21],[12,14]]},"#":{width:21,points:[[11,25],[4,-7],[-1,-1],[17,25],[10,-7],[-1,-1],[4,12],[18,12],[-1,-1],[3,6],[17,6]]},"$":{width:20,points:[[8,25],[8,-4],[-1,-1],[12,25],[12,-4],[-1,-1],[17,18],[15,20],[12,21],[8,21],[5,20],[3,18],[3,16],[4,14],[5,13],[7,12],[13,10],[15,9],[16,8],[17,6],[17,3],[15,1],[12,0],[8,0],[5,1],[3,3]]},"%":{width:24,points:[[21,21],[3,0],[-1,-1],[8,21],[10,19],[10,17],[9,15],[7,14],[5,14],[3,16],[3,18],[4,20],[6,21],[8,21],[10,20],[13,19],[16,19],[19,20],[21,21],[-1,-1],[17,7],[15,6],[14,4],[14,2],[16,0],[18,0],[20,1],[21,3],[21,5],[19,7],[17,7]]},"&":{width:26,points:[[23,12],[23,13],[22,14],[21,14],[20,13],[19,11],[17,6],[15,3],[13,1],[11,0],[7,0],[5,1],[4,2],[3,4],[3,6],[4,8],[5,9],[12,13],[13,14],[14,16],[14,18],[13,20],[11,21],[9,20],[8,18],[8,16],[9,13],[11,10],[16,3],[18,1],[20,0],[22,0],[23,1],[23,2]]},"'":{width:10,points:[[5,19],[4,20],[5,21],[6,20],[6,18],[5,16],[4,15]]},"(":{width:14,points:[[11,25],[9,23],[7,20],[5,16],[4,11],[4,7],[5,2],[7,-2],[9,-5],[11,-7]]},")":{width:14,points:[[3,25],[5,23],[7,20],[9,16],[10,11],[10,7],[9,2],[7,-2],[5,-5],[3,-7]]},"*":{width:16,poinLine truncated
|
||||||
@@ -0,0 +1,679 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
/**
|
||||||
|
* class: $.jqplot.CategoryAxisRenderer
|
||||||
|
* A plugin for jqPlot to render a category style axis, with equal pixel spacing between y data values of a series.
|
||||||
|
*
|
||||||
|
* To use this renderer, include the plugin in your source
|
||||||
|
* > <script type="text/javascript" language="javascript" src="plugins/jqplot.categoryAxisRenderer.js"></script>
|
||||||
|
*
|
||||||
|
* and supply the appropriate options to your plot
|
||||||
|
*
|
||||||
|
* > {axes:{xaxis:{renderer:$.jqplot.CategoryAxisRenderer}}}
|
||||||
|
**/
|
||||||
|
$.jqplot.CategoryAxisRenderer = function(options) {
|
||||||
|
$.jqplot.LinearAxisRenderer.call(this);
|
||||||
|
// prop: sortMergedLabels
|
||||||
|
// True to sort tick labels when labels are created by merging
|
||||||
|
// x axis values from multiple series. That is, say you have
|
||||||
|
// two series like:
|
||||||
|
// > line1 = [[2006, 4], [2008, 9], [2009, 16]];
|
||||||
|
// > line2 = [[2006, 3], [2007, 7], [2008, 6]];
|
||||||
|
// If no label array is specified, tick labels will be collected
|
||||||
|
// from the x values of the series. With sortMergedLabels
|
||||||
|
// set to true, tick labels will be:
|
||||||
|
// > [2006, 2007, 2008, 2009]
|
||||||
|
// With sortMergedLabels set to false, tick labels will be:
|
||||||
|
// > [2006, 2008, 2009, 2007]
|
||||||
|
//
|
||||||
|
// Note, this property is specified on the renderOptions for the
|
||||||
|
// axes when creating a plot:
|
||||||
|
// > axes:{xaxis:{renderer:$.jqplot.CategoryAxisRenderer, rendererOptions:{sortMergedLabels:true}}}
|
||||||
|
this.sortMergedLabels = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.CategoryAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
||||||
|
$.jqplot.CategoryAxisRenderer.prototype.constructor = $.jqplot.CategoryAxisRenderer;
|
||||||
|
|
||||||
|
$.jqplot.CategoryAxisRenderer.prototype.init = function(options){
|
||||||
|
this.groups = 1;
|
||||||
|
this.groupLabels = [];
|
||||||
|
this._groupLabels = [];
|
||||||
|
this._grouped = false;
|
||||||
|
this._barsPerGroup = null;
|
||||||
|
this.reverse = false;
|
||||||
|
// prop: tickRenderer
|
||||||
|
// A class of a rendering engine for creating the ticks labels displayed on the plot,
|
||||||
|
// See <$.jqplot.AxisTickRenderer>.
|
||||||
|
// this.tickRenderer = $.jqplot.AxisTickRenderer;
|
||||||
|
// this.labelRenderer = $.jqplot.AxisLabelRenderer;
|
||||||
|
$.extend(true, this, {tickOptions:{formatString:'%d'}}, options);
|
||||||
|
var db = this._dataBounds;
|
||||||
|
// Go through all the series attached to this axis and find
|
||||||
|
// the min/max bounds for this axis.
|
||||||
|
for (var i=0; i<this._series.length; i++) {
|
||||||
|
var s = this._series[i];
|
||||||
|
if (s.groups) {
|
||||||
|
this.groups = s.groups;
|
||||||
|
}
|
||||||
|
var d = s.data;
|
||||||
|
|
||||||
|
for (var j=0; j<d.length; j++) {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
if (d[j][0] < db.min || db.min == null) {
|
||||||
|
db.min = d[j][0];
|
||||||
|
}
|
||||||
|
if (d[j][0] > db.max || db.max == null) {
|
||||||
|
db.max = d[j][0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (d[j][1] < db.min || db.min == null) {
|
||||||
|
db.min = d[j][1];
|
||||||
|
}
|
||||||
|
if (d[j][1] > db.max || db.max == null) {
|
||||||
|
db.max = d[j][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.groupLabels.length) {
|
||||||
|
this.groups = this.groupLabels.length;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
$.jqplot.CategoryAxisRenderer.prototype.createTicks = function() {
|
||||||
|
// we're are operating on an axis here
|
||||||
|
var ticks = this._ticks;
|
||||||
|
var userTicks = this.ticks;
|
||||||
|
var name = this.name;
|
||||||
|
// databounds were set on axis initialization.
|
||||||
|
var db = this._dataBounds;
|
||||||
|
var dim, interval;
|
||||||
|
var min, max;
|
||||||
|
var pos1, pos2;
|
||||||
|
var tt, i;
|
||||||
|
|
||||||
|
// if we already have ticks, use them.
|
||||||
|
if (userTicks.length) {
|
||||||
|
// adjust with blanks if we have groups
|
||||||
|
if (this.groups > 1 && !this._grouped) {
|
||||||
|
var l = userTicks.length;
|
||||||
|
var skip = parseInt(l/this.groups, 10);
|
||||||
|
var count = 0;
|
||||||
|
for (var i=skip; i<l; i+=skip) {
|
||||||
|
userTicks.splice(i+count, 0, ' ');
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
this._grouped = true;
|
||||||
|
}
|
||||||
|
this.min = 0.5;
|
||||||
|
this.max = userTicks.length + 0.5;
|
||||||
|
var range = this.max - this.min;
|
||||||
|
this.numberTicks = 2*userTicks.length + 1;
|
||||||
|
for (i=0; i<userTicks.length; i++){
|
||||||
|
tt = this.min + 2 * i * range / (this.numberTicks-1);
|
||||||
|
// need a marker before and after the tick
|
||||||
|
var t = new this.tickRenderer(this.tickOptions);
|
||||||
|
t.showLabel = false;
|
||||||
|
// t.showMark = true;
|
||||||
|
t.setTick(tt, this.name);
|
||||||
|
this._ticks.push(t);
|
||||||
|
var t = new this.tickRenderer(this.tickOptions);
|
||||||
|
t.label = userTicks[i];
|
||||||
|
// t.showLabel = true;
|
||||||
|
t.showMark = false;
|
||||||
|
t.showGridline = false;
|
||||||
|
t.setTick(tt+0.5, this.name);
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
// now add the last tick at the end
|
||||||
|
var t = new this.tickRenderer(this.tickOptions);
|
||||||
|
t.showLabel = false;
|
||||||
|
// t.showMark = true;
|
||||||
|
t.setTick(tt+1, this.name);
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
// we don't have any ticks yet, let's make some!
|
||||||
|
else {
|
||||||
|
if (name == 'xaxis' || name == 'x2axis') {
|
||||||
|
dim = this._plotDimensions.width;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dim = this._plotDimensions.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if min, max and number of ticks specified, user can't specify interval.
|
||||||
|
if (this.min != null && this.max != null && this.numberTicks != null) {
|
||||||
|
this.tickInterval = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if max, min, and interval specified and interval won't fit, ignore interval.
|
||||||
|
if (this.min != null && this.max != null && this.tickInterval != null) {
|
||||||
|
if (parseInt((this.max-this.min)/this.tickInterval, 10) != (this.max-this.min)/this.tickInterval) {
|
||||||
|
this.tickInterval = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// find out how many categories are in the lines and collect labels
|
||||||
|
var labels = [];
|
||||||
|
var numcats = 0;
|
||||||
|
var min = 0.5;
|
||||||
|
var max, val;
|
||||||
|
var isMerged = false;
|
||||||
|
for (var i=0; i<this._series.length; i++) {
|
||||||
|
var s = this._series[i];
|
||||||
|
for (var j=0; j<s.data.length; j++) {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
val = s.data[j][0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
val = s.data[j][1];
|
||||||
|
}
|
||||||
|
if ($.inArray(val, labels) == -1) {
|
||||||
|
isMerged = true;
|
||||||
|
numcats += 1;
|
||||||
|
labels.push(val);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isMerged && this.sortMergedLabels) {
|
||||||
|
if (typeof labels[0] == "string") {
|
||||||
|
labels.sort();
|
||||||
|
} else {
|
||||||
|
labels.sort(function(a,b) { return a - b; });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// keep a reference to these tick labels to use for redrawing plot (see bug #57)
|
||||||
|
this.ticks = labels;
|
||||||
|
|
||||||
|
// now bin the data values to the right lables.
|
||||||
|
for (var i=0; i<this._series.length; i++) {
|
||||||
|
var s = this._series[i];
|
||||||
|
for (var j=0; j<s.data.length; j++) {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
val = s.data[j][0];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
val = s.data[j][1];
|
||||||
|
}
|
||||||
|
// for category axis, force the values into category bins.
|
||||||
|
// we should have the value in the label array now.
|
||||||
|
var idx = $.inArray(val, labels)+1;
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
s.data[j][0] = idx;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
s.data[j][1] = idx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// adjust with blanks if we have groups
|
||||||
|
if (this.groups > 1 && !this._grouped) {
|
||||||
|
var l = labels.length;
|
||||||
|
var skip = parseInt(l/this.groups, 10);
|
||||||
|
var count = 0;
|
||||||
|
for (var i=skip; i<l; i+=skip+1) {
|
||||||
|
labels[i] = ' ';
|
||||||
|
}
|
||||||
|
this._grouped = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
max = numcats + 0.5;
|
||||||
|
if (this.numberTicks == null) {
|
||||||
|
this.numberTicks = 2*numcats + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var range = max - min;
|
||||||
|
this.min = min;
|
||||||
|
this.max = max;
|
||||||
|
var track = 0;
|
||||||
|
|
||||||
|
// todo: adjust this so more ticks displayed.
|
||||||
|
var maxVisibleTicks = parseInt(3+dim/10, 10);
|
||||||
|
var skip = parseInt(numcats/maxVisibleTicks, 10);
|
||||||
|
|
||||||
|
if (this.tickInterval == null) {
|
||||||
|
|
||||||
|
this.tickInterval = range / (this.numberTicks-1);
|
||||||
|
|
||||||
|
}
|
||||||
|
// if tickInterval is specified, we will ignore any computed maximum.
|
||||||
|
for (var i=0; i<this.numberTicks; i++){
|
||||||
|
tt = this.min + i * this.tickInterval;
|
||||||
|
var t = new this.tickRenderer(this.tickOptions);
|
||||||
|
// if even tick, it isn't a category, it's a divider
|
||||||
|
if (i/2 == parseInt(i/2, 10)) {
|
||||||
|
t.showLabel = false;
|
||||||
|
t.showMark = true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (skip>0 && track<skip) {
|
||||||
|
t.showLabel = false;
|
||||||
|
track += 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
t.showLabel = true;
|
||||||
|
track = 0;
|
||||||
|
}
|
||||||
|
t.label = t.formatter(t.formatString, labels[(i-1)/2]);
|
||||||
|
t.showMark = false;
|
||||||
|
t.showGridline = false;
|
||||||
|
}
|
||||||
|
t.setTick(tt, this.name);
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with scope of axis
|
||||||
|
$.jqplot.CategoryAxisRenderer.prototype.draw = function(ctx, plot) {
|
||||||
|
if (this.show) {
|
||||||
|
// populate the axis label and value properties.
|
||||||
|
// createTicks is a method on the renderer, but
|
||||||
|
// call it within the scope of the axis.
|
||||||
|
this.renderer.createTicks.call(this);
|
||||||
|
// fill a div with axes labels in the right direction.
|
||||||
|
// Need to pregenerate each axis to get its bounds and
|
||||||
|
// position it and the labels correctly on the plot.
|
||||||
|
var dim=0;
|
||||||
|
var temp;
|
||||||
|
// Added for theming.
|
||||||
|
if (this._elem) {
|
||||||
|
// this._elem.empty();
|
||||||
|
// Memory Leaks patch
|
||||||
|
this._elem.emptyForce();
|
||||||
|
}
|
||||||
|
|
||||||
|
this._elem = this._elem || $('<div class="jqplot-axis jqplot-'+this.name+'" style="position:absolute;"></div>');
|
||||||
|
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
this._elem.width(this._plotDimensions.width);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._elem.height(this._plotDimensions.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// create a _label object.
|
||||||
|
this.labelOptions.axis = this.name;
|
||||||
|
this._label = new this.labelRenderer(this.labelOptions);
|
||||||
|
if (this._label.show) {
|
||||||
|
var elem = this._label.draw(ctx, plot);
|
||||||
|
elem.appendTo(this._elem);
|
||||||
|
}
|
||||||
|
|
||||||
|
var t = this._ticks;
|
||||||
|
for (var i=0; i<t.length; i++) {
|
||||||
|
var tick = t[i];
|
||||||
|
if (tick.showLabel && (!tick.isMinorTick || this.showMinorTicks)) {
|
||||||
|
var elem = tick.draw(ctx, plot);
|
||||||
|
elem.appendTo(this._elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this._groupLabels = [];
|
||||||
|
// now make group labels
|
||||||
|
for (var i=0; i<this.groupLabels.length; i++)
|
||||||
|
{
|
||||||
|
var elem = $('<div style="position:absolute;" class="jqplot-'+this.name+'-groupLabel"></div>');
|
||||||
|
elem.html(this.groupLabels[i]);
|
||||||
|
this._groupLabels.push(elem);
|
||||||
|
elem.appendTo(this._elem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this._elem;
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with scope of axis
|
||||||
|
$.jqplot.CategoryAxisRenderer.prototype.set = function() {
|
||||||
|
var dim = 0;
|
||||||
|
var temp;
|
||||||
|
var w = 0;
|
||||||
|
var h = 0;
|
||||||
|
var lshow = (this._label == null) ? false : this._label.show;
|
||||||
|
if (this.show) {
|
||||||
|
var t = this._ticks;
|
||||||
|
for (var i=0; i<t.length; i++) {
|
||||||
|
var tick = t[i];
|
||||||
|
if (tick.showLabel && (!tick.isMinorTick || this.showMinorTicks)) {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
temp = tick._elem.outerHeight(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
temp = tick._elem.outerWidth(true);
|
||||||
|
}
|
||||||
|
if (temp > dim) {
|
||||||
|
dim = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var dim2 = 0;
|
||||||
|
for (var i=0; i<this._groupLabels.length; i++) {
|
||||||
|
var l = this._groupLabels[i];
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
temp = l.outerHeight(true);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
temp = l.outerWidth(true);
|
||||||
|
}
|
||||||
|
if (temp > dim2) {
|
||||||
|
dim2 = temp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (lshow) {
|
||||||
|
w = this._label._elem.outerWidth(true);
|
||||||
|
h = this._label._elem.outerHeight(true);
|
||||||
|
}
|
||||||
|
if (this.name == 'xaxis') {
|
||||||
|
dim += dim2 + h;
|
||||||
|
this._elem.css({'height':dim+'px', left:'0px', bottom:'0px'});
|
||||||
|
}
|
||||||
|
else if (this.name == 'x2axis') {
|
||||||
|
dim += dim2 + h;
|
||||||
|
this._elem.css({'height':dim+'px', left:'0px', top:'0px'});
|
||||||
|
}
|
||||||
|
else if (this.name == 'yaxis') {
|
||||||
|
dim += dim2 + w;
|
||||||
|
this._elem.css({'width':dim+'px', left:'0px', top:'0px'});
|
||||||
|
if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
|
||||||
|
this._label._elem.css('width', w+'px');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dim += dim2 + w;
|
||||||
|
this._elem.css({'width':dim+'px', right:'0px', top:'0px'});
|
||||||
|
if (lshow && this._label.constructor == $.jqplot.AxisLabelRenderer) {
|
||||||
|
this._label._elem.css('width', w+'px');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with scope of axis
|
||||||
|
$.jqplot.CategoryAxisRenderer.prototype.pack = function(pos, offsets) {
|
||||||
|
var ticks = this._ticks;
|
||||||
|
var max = this.max;
|
||||||
|
var min = this.min;
|
||||||
|
var offmax = offsets.max;
|
||||||
|
var offmin = offsets.min;
|
||||||
|
var lshow = (this._label == null) ? false : this._label.show;
|
||||||
|
var i;
|
||||||
|
|
||||||
|
for (var p in pos) {
|
||||||
|
this._elem.css(p, pos[p]);
|
||||||
|
}
|
||||||
|
|
||||||
|
this._offsets = offsets;
|
||||||
|
// pixellength will be + for x axes and - for y axes becasue pixels always measured from top left.
|
||||||
|
var pixellength = offmax - offmin;
|
||||||
|
var unitlength = max - min;
|
||||||
|
|
||||||
|
if (!this.reverse) {
|
||||||
|
// point to unit and unit to point conversions references to Plot DOM element top left corner.
|
||||||
|
|
||||||
|
this.u2p = function(u){
|
||||||
|
return (u - min) * pixellength / unitlength + offmin;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.p2u = function(p){
|
||||||
|
return (p - offmin) * unitlength / pixellength + min;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis'){
|
||||||
|
this.series_u2p = function(u){
|
||||||
|
return (u - min) * pixellength / unitlength;
|
||||||
|
};
|
||||||
|
this.series_p2u = function(p){
|
||||||
|
return p * unitlength / pixellength + min;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
this.series_u2p = function(u){
|
||||||
|
return (u - max) * pixellength / unitlength;
|
||||||
|
};
|
||||||
|
this.series_p2u = function(p){
|
||||||
|
return p * unitlength / pixellength + max;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
// point to unit and unit to point conversions references to Plot DOM element top left corner.
|
||||||
|
|
||||||
|
this.u2p = function(u){
|
||||||
|
return offmin + (max - u) * pixellength / unitlength;
|
||||||
|
};
|
||||||
|
|
||||||
|
this.p2u = function(p){
|
||||||
|
return min + (p - offmin) * unitlength / pixellength;
|
||||||
|
};
|
||||||
|
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis'){
|
||||||
|
this.series_u2p = function(u){
|
||||||
|
return (max - u) * pixellength / unitlength;
|
||||||
|
};
|
||||||
|
this.series_p2u = function(p){
|
||||||
|
return p * unitlength / pixellength + max;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
this.series_u2p = function(u){
|
||||||
|
return (min - u) * pixellength / unitlength;
|
||||||
|
};
|
||||||
|
this.series_p2u = function(p){
|
||||||
|
return p * unitlength / pixellength + min;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (this.show) {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
for (i=0; i<ticks.length; i++) {
|
||||||
|
var t = ticks[i];
|
||||||
|
if (t.show && t.showLabel) {
|
||||||
|
var shim;
|
||||||
|
|
||||||
|
if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
|
||||||
|
// will need to adjust auto positioning based on which axis this is.
|
||||||
|
var temp = (this.name == 'xaxis') ? 1 : -1;
|
||||||
|
switch (t.labelPosition) {
|
||||||
|
case 'auto':
|
||||||
|
// position at end
|
||||||
|
if (temp * t.angle < 0) {
|
||||||
|
shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||||
|
}
|
||||||
|
// position at start
|
||||||
|
else {
|
||||||
|
shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'end':
|
||||||
|
shim = -t.getWidth() + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||||
|
break;
|
||||||
|
case 'start':
|
||||||
|
shim = -t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
||||||
|
break;
|
||||||
|
case 'middle':
|
||||||
|
shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
shim = -t.getWidth()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shim = -t.getWidth()/2;
|
||||||
|
}
|
||||||
|
var val = this.u2p(t.value) + shim + 'px';
|
||||||
|
t._elem.css('left', val);
|
||||||
|
t.pack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var labeledge=['bottom', 0];
|
||||||
|
if (lshow) {
|
||||||
|
var w = this._label._elem.outerWidth(true);
|
||||||
|
this._label._elem.css('left', offmin + pixellength/2 - w/2 + 'px');
|
||||||
|
if (this.name == 'xaxis') {
|
||||||
|
this._label._elem.css('bottom', '0px');
|
||||||
|
labeledge = ['bottom', this._label._elem.outerHeight(true)];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._label._elem.css('top', '0px');
|
||||||
|
labeledge = ['top', this._label._elem.outerHeight(true)];
|
||||||
|
}
|
||||||
|
this._label.pack();
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the group labels
|
||||||
|
var step = parseInt(this._ticks.length/this.groups, 10) + 1;
|
||||||
|
for (i=0; i<this._groupLabels.length; i++) {
|
||||||
|
var mid = 0;
|
||||||
|
var count = 0;
|
||||||
|
for (var j=i*step; j<(i+1)*step; j++) {
|
||||||
|
if (j >= this._ticks.length-1) continue; // the last tick does not exist as there is no other group in order to have an empty one.
|
||||||
|
if (this._ticks[j]._elem && this._ticks[j].label != " ") {
|
||||||
|
var t = this._ticks[j]._elem;
|
||||||
|
var p = t.position();
|
||||||
|
mid += p.left + t.outerWidth(true)/2;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mid = mid/count;
|
||||||
|
this._groupLabels[i].css({'left':(mid - this._groupLabels[i].outerWidth(true)/2)});
|
||||||
|
this._groupLabels[i].css(labeledge[0], labeledge[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (i=0; i<ticks.length; i++) {
|
||||||
|
var t = ticks[i];
|
||||||
|
if (t.show && t.showLabel) {
|
||||||
|
var shim;
|
||||||
|
if (t.constructor == $.jqplot.CanvasAxisTickRenderer && t.angle) {
|
||||||
|
// will need to adjust auto positioning based on which axis this is.
|
||||||
|
var temp = (this.name == 'yaxis') ? 1 : -1;
|
||||||
|
switch (t.labelPosition) {
|
||||||
|
case 'auto':
|
||||||
|
// position at end
|
||||||
|
case 'end':
|
||||||
|
if (temp * t.angle < 0) {
|
||||||
|
shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'start':
|
||||||
|
if (t.angle > 0) {
|
||||||
|
shim = -t._textRenderer.height * Math.cos(-t._textRenderer.angle) / 2;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shim = -t.getHeight() + t._textRenderer.height * Math.cos(t._textRenderer.angle) / 2;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'middle':
|
||||||
|
// if (t.angle > 0) {
|
||||||
|
// shim = -t.getHeight()/2 + t._textRenderer.height * Math.sin(-t._textRenderer.angle) / 2;
|
||||||
|
// }
|
||||||
|
// else {
|
||||||
|
// shim = -t.getHeight()/2 - t._textRenderer.height * Math.sin(t._textRenderer.angle) / 2;
|
||||||
|
// }
|
||||||
|
shim = -t.getHeight()/2;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
shim = -t.getHeight()/2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
shim = -t.getHeight()/2;
|
||||||
|
}
|
||||||
|
|
||||||
|
var val = this.u2p(t.value) + shim + 'px';
|
||||||
|
t._elem.css('top', val);
|
||||||
|
t.pack();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var labeledge=['left', 0];
|
||||||
|
if (lshow) {
|
||||||
|
var h = this._label._elem.outerHeight(true);
|
||||||
|
this._label._elem.css('top', offmax - pixellength/2 - h/2 + 'px');
|
||||||
|
if (this.name == 'yaxis') {
|
||||||
|
this._label._elem.css('left', '0px');
|
||||||
|
labeledge = ['left', this._label._elem.outerWidth(true)];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._label._elem.css('right', '0px');
|
||||||
|
labeledge = ['right', this._label._elem.outerWidth(true)];
|
||||||
|
}
|
||||||
|
this._label.pack();
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw the group labels, position top here, do left after label position.
|
||||||
|
var step = parseInt(this._ticks.length/this.groups, 10) + 1; // step is one more than before as we don't want to have overlaps in loops
|
||||||
|
for (i=0; i<this._groupLabels.length; i++) {
|
||||||
|
var mid = 0;
|
||||||
|
var count = 0;
|
||||||
|
for (var j=i*step; j<(i+1)*step; j++) { // j must never reach (i+1)*step as we don't want to have overlap between loops
|
||||||
|
if (j >= this._ticks.length-1) continue; // the last tick does not exist as there is no other group in order to have an empty one.
|
||||||
|
if (this._ticks[j]._elem && this._ticks[j].label != " ") {
|
||||||
|
var t = this._ticks[j]._elem;
|
||||||
|
var p = t.position();
|
||||||
|
mid += p.top + t.outerHeight()/2;
|
||||||
|
count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mid = mid/count;
|
||||||
|
this._groupLabels[i].css({'top':mid - this._groupLabels[i].outerHeight()/2});
|
||||||
|
this._groupLabels[i].css(labeledge[0], labeledge[1]);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(a){a.jqplot.CategoryAxisRenderer=function(b){a.jqplot.LinearAxisRenderer.call(this);this.sortMergedLabels=false};a.jqplot.CategoryAxisRenderer.prototype=new a.jqplot.LinearAxisRenderer();a.jqplot.CategoryAxisRenderer.prototype.constructor=a.jqplot.CategoryAxisRenderer;a.jqplot.CategoryAxisRenderer.prototype.init=function(e){this.groups=1;this.groupLabels=[];this._groupLabels=[];this._grouped=false;this._barsPerGroup=null;this.reverse=false;a.extend(true,this,{tickOptions:{formatString:"%d"}},e);var b=this._dataBounds;for(var f=0;f<this._series.length;f++){var g=this._series[f];if(g.groups){this.groups=g.groups}var h=g.data;for(var c=0;c<h.length;c++){if(this.name=="xaxis"||this.name=="x2axis"){if(h[c][0]<b.min||b.min==null){b.min=h[c][0]}if(h[c][0]>b.max||b.max==null){b.max=h[c][0]}}else{if(h[c][1]<b.min||b.min==null){b.min=h[c][1]}if(h[c][1]>b.max||b.max==null){b.max=h[c][1]}}}}if(this.groupLabels.length){this.groups=this.groupLabels.length}};a.jqplot.CategoryAxisRenderer.prototype.createTicks=function(){var D=this._ticks;var z=this.ticks;var F=this.name;var C=this._dataBounds;var v,A;var q,w;var d,c;var b,x;if(z.length){if(this.groups>1&&!this._grouped){var r=z.length;var p=parseInt(r/this.groups,10);var e=0;for(var x=p;x<r;x+=p){z.splice(x+e,0," ");e++}this._grouped=true}this.min=0.5;this.max=z.length+0.5;var m=this.max-this.min;this.numberTicks=2*z.length+1;for(x=0;x<z.length;x++){b=this.min+2*x*m/(this.numberTicks-1);var h=new this.tickRenderer(this.tickOptions);h.showLabel=false;h.setTick(b,this.name);this._ticks.push(h);var h=new this.tickRenderer(this.tickOptions);h.label=z[x];h.showMark=false;h.showGridline=false;h.setTick(b+0.5,this.name);this._ticks.push(h)}var h=new this.tickRenderer(this.tickOptions);h.showLabel=false;h.setTick(b+1,this.name);this._ticks.push(h)}else{if(F=="xaxis"||F=="x2axis"){v=this._plotDimensions.width}else{v=this._plotDimensions.height}if(this.min!=null&&this.max!=null&&this.numberTicks!=null){this.tickInterval=null}if(this.min!=null&&this.max!=null&&this.tickInterval!=null){if(parseInt((this.max-this.min)/this.tickInterval,10)!=(this.max-this.min)/this.tickInterval){this.tickInterval=null}}var y=[];var B=0;var q=0.5;var w,E;var f=false;for(var x=0;x<this._series.length;x++){var k=this._series[x];for(var u=0;u<k.data.length;u++){if(this.name=="xaxis"||this.name=="x2axis"){E=k.data[u][0]}else{E=k.data[u][1]}if(a.inArray(E,y)==-1){f=true;B+=1;y.push(E)}}}if(f&&this.sortMergedLabels){if(typeof y[0]=="string"){y.sort()}else{y.sort(function(j,i){return j-i})}}this.ticks=y;for(var x=0;x<this._series.length;x++){var k=this._series[x];for(var u=0;u<k.data.length;u++){if(this.name=="xaxis"||this.name=="x2axis"){E=k.data[u][0]}else{E=k.data[u][1]}var n=a.inArray(E,y)+1;if(this.name=="xaxis"||this.name=="x2axis"){k.data[u][0]=n}else{k.data[u][1]=n}}}if(this.groups>1&&!this._grouped){var r=y.length;var p=parseInt(r/this.groups,10);var e=0;for(var x=p;x<r;x+=p+1){y[x]=" "}this._grouped=true}w=B+0.5;if(this.numberTicks==null){this.numberTicks=2*B+1}var m=w-q;this.min=q;this.max=w;var o=0;var g=parseInt(3+v/10,10);var p=parseInt(B/g,10);if(this.tickInterval==null){this.tickInterval=m/(this.numberTicks-1)}for(var x=0;x<this.numberTicks;x++){b=this.min+x*this.tickInterval;var h=new this.tickRenderer(this.tickOptions);if(x/2==parseInt(x/2,10)){h.showLabel=false;h.showMark=true}else{if(p>0&&o<p){h.showLabel=false;o+=1}else{h.showLabel=true;o=0}h.label=h.formatter(h.formatString,y[(x-1)/2]);h.showMark=false;h.showGridline=false}h.setTick(b,this.name);this._ticks.push(h)}}};a.jqplot.CategoryAxisRenderer.prototype.draw=function(b,j){if(this.show){this.renderer.createTicks.call(this);var h=0;var c;if(this._elem){this._elem.emptyForce()}this._elem=this._elem||a('<div class="jqplot-axis jqplot-'+this.name+'" style="position:absolute;"></div>');if(this.name=="xaxis"||this.name=="x2axis"){this._elem.width(this._plotDimensions.width)}else{this._elem.height(this._plotDimensions.height)}this.labelOptions.axis=this.name;this._label=new this.labelRenderer(this.labelOptions);if(this._label.show){var g=this._label.draw(b,j);g.appendTo(this._elem)}var f=this._ticks;for(var e=0;e<f.length;e++){var d=f[e];if(d.showLabel&&(!d.isMinorTick||this.showMinorTicks)){var g=d.draw(b,j);g.appendTo(this._elem)}}this._groupLabels=[];for(var e=0;e<this.groupLabels.length;e++){var g=a('<div style="position:absolute;" class="jqplot-'+this.name+'-groupLabel"></div>');g.html(this.groupLabels[e]);this._groupLabels.push(g);g.appendTo(this._elem)}}return this._elem};a.jqplot.CategoryAxisRenderer.prototype.set=function(){var e=0;var m;var k=0;var f=0;var d=(this._label==null)?false:this._label.show;if(this.show){var n=this._ticks;for(var c=0;c<n.length;c++){var g=n[c];if(g.showLabel&&(!g.isMinorTick||this.showMinorTicks)){if(this.name=="xaxis"||this.name=="x2axis"){m=g._elem.outerHeight(true)}else{m=g._elem.outerWidth(true)}if(m>e){e=m}}}var j=0;for(var c=0;c<this._groupLabels.length;c++){var b=this._groupLabels[c];Line truncated
|
||||||
@@ -0,0 +1,116 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.ciParser
|
||||||
|
* Data Renderer function which converts a custom JSON data object into jqPlot data format.
|
||||||
|
* Set this as a callable on the jqplot dataRenderer plot option:
|
||||||
|
*
|
||||||
|
* > plot = $.jqplot('mychart', [data], { dataRenderer: $.jqplot.ciParser, ... });
|
||||||
|
*
|
||||||
|
* Where data is an object in JSON format or a JSON encoded string conforming to the
|
||||||
|
* City Index API spec.
|
||||||
|
*
|
||||||
|
* Note that calling the renderer function is handled internally by jqPlot. The
|
||||||
|
* user does not have to call the function. The parameters described below will
|
||||||
|
* automatically be passed to the ciParser function.
|
||||||
|
*
|
||||||
|
* Parameters:
|
||||||
|
* data - JSON encoded string or object.
|
||||||
|
* plot - reference to jqPlot Plot object.
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* data array in jqPlot format.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
$.jqplot.ciParser = function (data, plot) {
|
||||||
|
var ret = [],
|
||||||
|
line,
|
||||||
|
temp,
|
||||||
|
i, j, k, kk;
|
||||||
|
|
||||||
|
if (typeof(data) == "string") {
|
||||||
|
data = $.jqplot.JSON.parse(data, handleStrings);
|
||||||
|
}
|
||||||
|
|
||||||
|
else if (typeof(data) == "object") {
|
||||||
|
for (k in data) {
|
||||||
|
for (i=0; i<data[k].length; i++) {
|
||||||
|
for (kk in data[k][i]) {
|
||||||
|
data[k][i][kk] = handleStrings(kk, data[k][i][kk]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// function handleStrings
|
||||||
|
// Checks any JSON encoded strings to see if they are
|
||||||
|
// encoded dates. If so, pull out the timestamp.
|
||||||
|
// Expects dates to be represented by js timestamps.
|
||||||
|
|
||||||
|
function handleStrings(key, value) {
|
||||||
|
var a;
|
||||||
|
if (value != null) {
|
||||||
|
if (value.toString().indexOf('Date') >= 0) {
|
||||||
|
//here we will try to extract the ticks from the Date string in the "value" fields of JSON returned data
|
||||||
|
a = /^\/Date\((-?[0-9]+)\)\/$/.exec(value);
|
||||||
|
if (a) {
|
||||||
|
return parseInt(a[1], 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (var prop in data) {
|
||||||
|
line = [];
|
||||||
|
temp = data[prop];
|
||||||
|
switch (prop) {
|
||||||
|
case "PriceTicks":
|
||||||
|
for (i=0; i<temp.length; i++) {
|
||||||
|
line.push([temp[i]['TickDate'], temp[i]['Price']]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "PriceBars":
|
||||||
|
for (i=0; i<temp.length; i++) {
|
||||||
|
line.push([temp[i]['BarDate'], temp[i]['Open'], temp[i]['High'], temp[i]['Low'], temp[i]['Close']]);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ret.push(line);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
};
|
||||||
|
})(jQuery);
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(a){a.jqplot.ciParser=function(g,l){var m=[],o,n,h,f,e,c;if(typeof(g)=="string"){g=a.jqplot.JSON.parse(g,d)}else{if(typeof(g)=="object"){for(e in g){for(h=0;h<g[e].length;h++){for(c in g[e][h]){g[e][h][c]=d(c,g[e][h][c])}}}}else{return null}}function d(j,k){var i;if(k!=null){if(k.toString().indexOf("Date")>=0){i=/^\/Date\((-?[0-9]+)\)\/$/.exec(k);if(i){return parseInt(i[1],10)}}return k}}for(var b in g){o=[];n=g[b];switch(b){case"PriceTicks":for(h=0;h<n.length;h++){o.push([n[h]["TickDate"],n[h]["Price"]])}break;case"PriceBars":for(h=0;h<n.length;h++){o.push([n[h]["BarDate"],n[h]["Open"],n[h]["High"],n[h]["Low"],n[h]["Close"]])}break}m.push(o)}return m}})(jQuery);
|
||||||
File diff suppressed because it is too large.
Load diff
+3
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(j){j.jqplot.Cursor=function(q){this.style="crosshair";this.previousCursor="auto";this.show=j.jqplot.config.enablePlugins;this.showTooltip=true;this.followMouse=false;this.tooltipLocation="se";this.tooltipOffset=6;this.showTooltipGridPosition=false;this.showTooltipUnitPosition=true;this.showTooltipDataPosition=false;this.tooltipFormatString="%.4P, %.4P";this.useAxesFormatters=true;this.tooltipAxisGroups=[];this.zoom=false;this.zoomProxy=false;this.zoomTarget=false;this.looseZoom=true;this.clickReset=false;this.dblClickReset=true;this.showVerticalLine=false;this.showHorizontalLine=false;this.constrainZoomTo="none";this.shapeRenderer=new j.jqplot.ShapeRenderer();this._zoom={start:[],end:[],started:false,zooming:false,isZoomed:false,axes:{start:{},end:{}},gridpos:{},datapos:{}};this._tooltipElem;this.zoomCanvas;this.cursorCanvas;this.intersectionThreshold=2;this.showCursorLegend=false;this.cursorLegendFormatString=j.jqplot.Cursor.cursorLegendFormatString;this._oldHandlers={onselectstart:null,ondrag:null,onmousedown:null};this.constrainOutsideZoom=true;this.showTooltipOutsideZoom=false;this.onGrid=false;j.extend(true,this,q)};j.jqplot.Cursor.cursorLegendFormatString="%s x:%s, y:%s";j.jqplot.Cursor.init=function(t,s,r){var q=r||{};this.plugins.cursor=new j.jqplot.Cursor(q.cursor);var u=this.plugins.cursor;if(u.show){j.jqplot.eventListenerHooks.push(["jqplotMouseEnter",b]);j.jqplot.eventListenerHooks.push(["jqplotMouseLeave",f]);j.jqplot.eventListenerHooks.push(["jqplotMouseMove",i]);if(u.showCursorLegend){r.legend=r.legend||{};r.legend.renderer=j.jqplot.CursorLegendRenderer;r.legend.formatString=this.plugins.cursor.cursorLegendFormatString;r.legend.show=true}if(u.zoom){j.jqplot.eventListenerHooks.push(["jqplotMouseDown",a]);if(u.clickReset){j.jqplot.eventListenerHooks.push(["jqplotClick",k])}if(u.dblClickReset){j.jqplot.eventListenerHooks.push(["jqplotDblClick",c])}}this.resetZoom=function(){var x=this.axes;if(!u.zoomProxy){for(var w in x){x[w].reset();x[w]._ticks=[];if(u._zoom.axes[w]!==undefined){x[w]._autoFormatString=u._zoom.axes[w].tickFormatString}}this.redraw()}else{var v=this.plugins.cursor.zoomCanvas._ctx;v.clearRect(0,0,v.canvas.width,v.canvas.height);v=null}this.plugins.cursor._zoom.isZoomed=false;this.target.trigger("jqplotResetZoom",[this,this.plugins.cursor])};if(u.showTooltipDataPosition){u.showTooltipUnitPosition=false;u.showTooltipGridPosition=false;if(q.cursor.tooltipFormatString==undefined){u.tooltipFormatString=j.jqplot.Cursor.cursorLegendFormatString}}}};j.jqplot.Cursor.postDraw=function(){var x=this.plugins.cursor;if(x.zoomCanvas){x.zoomCanvas.resetCanvas();x.zoomCanvas=null}if(x.cursorCanvas){x.cursorCanvas.resetCanvas();x.cursorCanvas=null}if(x._tooltipElem){x._tooltipElem.emptyForce();x._tooltipElem=null}if(x.zoom){x.zoomCanvas=new j.jqplot.GenericCanvas();this.eventCanvas._elem.before(x.zoomCanvas.createElement(this._gridPadding,"jqplot-zoom-canvas",this._plotDimensions,this));x.zoomCanvas.setContext()}var v=document.createElement("div");x._tooltipElem=j(v);v=null;x._tooltipElem.addClass("jqplot-cursor-tooltip");x._tooltipElem.css({position:"absolute",display:"none"});if(x.zoomCanvas){x.zoomCanvas._elem.before(x._tooltipElem)}else{this.eventCanvas._elem.before(x._tooltipElem)}if(x.showVerticalLine||x.showHorizontalLine){x.cursorCanvas=new j.jqplot.GenericCanvas();this.eventCanvas._elem.before(x.cursorCanvas.createElement(this._gridPadding,"jqplot-cursor-canvas",this._plotDimensions,this));x.cursorCanvas.setContext()}if(x.showTooltipUnitPosition){if(x.tooltipAxisGroups.length===0){var t=this.series;var u;var q=[];for(var r=0;r<t.length;r++){u=t[r];var w=u.xaxis+","+u.yaxis;if(j.inArray(w,q)==-1){q.push(w)}}for(var r=0;r<q.length;r++){x.tooltipAxisGroups.push(q[r].split(","))}}}};j.jqplot.Cursor.zoomProxy=function(v,r){var q=v.plugins.cursor;var u=r.plugins.cursor;q.zoomTarget=true;q.zoom=true;q.style="auto";q.dblClickReset=false;u.zoom=true;u.zoomProxy=true;r.target.bind("jqplotZoom",t);r.target.bind("jqplotResetZoom",s);function t(x,w,z,y,A){q.doZoom(w,z,v,A)}function s(w,x,y){v.resetZoom()}};j.jqplot.Cursor.prototype.resetZoom=function(u,v){var t=u.axes;var s=v._zoom.axes;if(!u.plugins.cursor.zoomProxy&&v._zoom.isZoomed){for(var r in t){t[r].reset();t[r]._ticks=[];t[r]._autoFormatString=s[r].tickFormatString}u.redraw();v._zoom.isZoomed=false}else{var q=v.zoomCanvas._ctx;q.clearRect(0,0,q.canvas.width,q.canvas.height);q=null}u.target.trigger("jqplotResetZoom",[u,v])};j.jqplot.Cursor.resetZoom=function(q){q.resetZoom()};j.jqplot.Cursor.prototype.doZoom=function(G,t,C,u){var I=u;var F=C.axes;var r=I._zoom.axes;var w=r.start;var s=r.end;var B,E,z,D,v,x,q,H,J;var A=C.plugins.cursor.zoomCanvas._ctx;if((I.constrainZoomTo=="none"&&Math.abs(G.x-I._zoom.start[0])>6&&Math.abs(G.y-I._zoom.start[1])>6)||(I.constrainZoomTo=="x"&&Math.abs(G.x-I._zoom.start[0])>6)||(I.constrainZoomTo=="y"&&Math.abs(G.y-I._zoom.start[1])>6)){if(!C.plugins.cursor.zoomProxy){for(var y in t){if(I._zoom.axes[yLine truncated
|
||||||
@@ -0,0 +1,741 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.DateAxisRenderer
|
||||||
|
* A plugin for a jqPlot to render an axis as a series of date values.
|
||||||
|
* This renderer has no options beyond those supplied by the <Axis> class.
|
||||||
|
* It supplies its own tick formatter, so the tickOptions.formatter option
|
||||||
|
* should not be overridden.
|
||||||
|
*
|
||||||
|
* Thanks to Ken Synder for his enhanced Date instance methods which are
|
||||||
|
* included with this code <http://kendsnyder.com/sandbox/date/>.
|
||||||
|
*
|
||||||
|
* To use this renderer, include the plugin in your source
|
||||||
|
* > <script type="text/javascript" language="javascript" src="plugins/jqplot.dateAxisRenderer.js"></script>
|
||||||
|
*
|
||||||
|
* and supply the appropriate options to your plot
|
||||||
|
*
|
||||||
|
* > {axes:{xaxis:{renderer:$.jqplot.DateAxisRenderer}}}
|
||||||
|
*
|
||||||
|
* Dates can be passed into the axis in almost any recognizable value and
|
||||||
|
* will be parsed. They will be rendered on the axis in the format
|
||||||
|
* specified by tickOptions.formatString. e.g. tickOptions.formatString = '%Y-%m-%d'.
|
||||||
|
*
|
||||||
|
* Accecptable format codes
|
||||||
|
* are:
|
||||||
|
*
|
||||||
|
* > Code Result Description
|
||||||
|
* > == Years ==
|
||||||
|
* > %Y 2008 Four-digit year
|
||||||
|
* > %y 08 Two-digit year
|
||||||
|
* > == Months ==
|
||||||
|
* > %m 09 Two-digit month
|
||||||
|
* > %#m 9 One or two-digit month
|
||||||
|
* > %B September Full month name
|
||||||
|
* > %b Sep Abbreviated month name
|
||||||
|
* > == Days ==
|
||||||
|
* > %d 05 Two-digit day of month
|
||||||
|
* > %#d 5 One or two-digit day of month
|
||||||
|
* > %e 5 One or two-digit day of month
|
||||||
|
* > %A Sunday Full name of the day of the week
|
||||||
|
* > %a Sun Abbreviated name of the day of the week
|
||||||
|
* > %w 0 Number of the day of the week (0 = Sunday, 6 = Saturday)
|
||||||
|
* > %o th The ordinal suffix string following the day of the month
|
||||||
|
* > == Hours ==
|
||||||
|
* > %H 23 Hours in 24-hour format (two digits)
|
||||||
|
* > %#H 3 Hours in 24-hour integer format (one or two digits)
|
||||||
|
* > %I 11 Hours in 12-hour format (two digits)
|
||||||
|
* > %#I 3 Hours in 12-hour integer format (one or two digits)
|
||||||
|
* > %p PM AM or PM
|
||||||
|
* > == Minutes ==
|
||||||
|
* > %M 09 Minutes (two digits)
|
||||||
|
* > %#M 9 Minutes (one or two digits)
|
||||||
|
* > == Seconds ==
|
||||||
|
* > %S 02 Seconds (two digits)
|
||||||
|
* > %#S 2 Seconds (one or two digits)
|
||||||
|
* > %s 1206567625723 Unix timestamp (Seconds past 1970-01-01 00:00:00)
|
||||||
|
* > == Milliseconds ==
|
||||||
|
* > %N 008 Milliseconds (three digits)
|
||||||
|
* > %#N 8 Milliseconds (one to three digits)
|
||||||
|
* > == Timezone ==
|
||||||
|
* > %O 360 difference in minutes between local time and GMT
|
||||||
|
* > %Z Mountain Standard Time Name of timezone as reported by browser
|
||||||
|
* > %G -06:00 Hours and minutes between GMT
|
||||||
|
* > == Shortcuts ==
|
||||||
|
* > %F 2008-03-26 %Y-%m-%d
|
||||||
|
* > %T 05:06:30 %H:%M:%S
|
||||||
|
* > %X 05:06:30 %H:%M:%S
|
||||||
|
* > %x 03/26/08 %m/%d/%y
|
||||||
|
* > %D 03/26/08 %m/%d/%y
|
||||||
|
* > %#c Wed Mar 26 15:31:00 2008 %a %b %e %H:%M:%S %Y
|
||||||
|
* > %v 3-Sep-2008 %e-%b-%Y
|
||||||
|
* > %R 15:31 %H:%M
|
||||||
|
* > %r 3:31:00 PM %I:%M:%S %p
|
||||||
|
* > == Characters ==
|
||||||
|
* > %n \n Newline
|
||||||
|
* > %t \t Tab
|
||||||
|
* > %% % Percent Symbol
|
||||||
|
*/
|
||||||
|
$.jqplot.DateAxisRenderer = function() {
|
||||||
|
$.jqplot.LinearAxisRenderer.call(this);
|
||||||
|
this.date = new $.jsDate();
|
||||||
|
};
|
||||||
|
|
||||||
|
var second = 1000;
|
||||||
|
var minute = 60 * second;
|
||||||
|
var hour = 60 * minute;
|
||||||
|
var day = 24 * hour;
|
||||||
|
var week = 7 * day;
|
||||||
|
|
||||||
|
// these are less definitive
|
||||||
|
var month = 30.4368499 * day;
|
||||||
|
var year = 365.242199 * day;
|
||||||
|
|
||||||
|
var daysInMonths = [31,28,31,30,31,30,31,30,31,30,31,30];
|
||||||
|
// array of consistent nice intervals. Longer intervals
|
||||||
|
// will depend on days in month, days in year, etc.
|
||||||
|
var niceFormatStrings = ['%M:%S.%#N', '%M:%S.%#N', '%M:%S.%#N', '%M:%S', '%M:%S', '%M:%S', '%M:%S', '%H:%M:%S', '%H:%M:%S', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%H:%M', '%a %H:%M', '%a %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%b %e %H:%M', '%v', '%v', '%v', '%v', '%v', '%v', '%v'];
|
||||||
|
var niceIntervals = [0.1*second, 0.2*second, 0.5*second, second, 2*second, 5*second, 10*second, 15*second, 30*second, minute, 2*minute, 5*minute, 10*minute, 15*minute, 30*minute, hour, 2*hour, 4*hour, 6*hour, 8*hour, 12*hour, day, 2*day, 3*day, 4*day, 5*day, week, 2*week];
|
||||||
|
|
||||||
|
var niceMonthlyIntervals = [];
|
||||||
|
|
||||||
|
function bestDateInterval(min, max, titarget) {
|
||||||
|
// iterate through niceIntervals to find one closest to titarget
|
||||||
|
var badness = Number.MAX_VALUE;
|
||||||
|
var temp, bestTi, bestfmt;
|
||||||
|
for (var i=0, l=niceIntervals.length; i < l; i++) {
|
||||||
|
temp = Math.abs(titarget - niceIntervals[i]);
|
||||||
|
if (temp < badness) {
|
||||||
|
badness = temp;
|
||||||
|
bestTi = niceIntervals[i];
|
||||||
|
bestfmt = niceFormatStrings[i];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return [bestTi, bestfmt];
|
||||||
|
}
|
||||||
|
|
||||||
|
$.jqplot.DateAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
||||||
|
$.jqplot.DateAxisRenderer.prototype.constructor = $.jqplot.DateAxisRenderer;
|
||||||
|
|
||||||
|
$.jqplot.DateTickFormatter = function(format, val) {
|
||||||
|
if (!format) {
|
||||||
|
format = '%Y/%m/%d';
|
||||||
|
}
|
||||||
|
return $.jsDate.strftime(val, format);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DateAxisRenderer.prototype.init = function(options){
|
||||||
|
// prop: tickRenderer
|
||||||
|
// A class of a rendering engine for creating the ticks labels displayed on the plot,
|
||||||
|
// See <$.jqplot.AxisTickRenderer>.
|
||||||
|
// this.tickRenderer = $.jqplot.AxisTickRenderer;
|
||||||
|
// this.labelRenderer = $.jqplot.AxisLabelRenderer;
|
||||||
|
this.tickOptions.formatter = $.jqplot.DateTickFormatter;
|
||||||
|
// prop: tickInset
|
||||||
|
// Controls the amount to inset the first and last ticks from
|
||||||
|
// the edges of the grid, in multiples of the tick interval.
|
||||||
|
// 0 is no inset, 0.5 is one half a tick interval, 1 is a full
|
||||||
|
// tick interval, etc.
|
||||||
|
this.tickInset = 0;
|
||||||
|
// prop: drawBaseline
|
||||||
|
// True to draw the axis baseline.
|
||||||
|
this.drawBaseline = true;
|
||||||
|
// prop: baselineWidth
|
||||||
|
// width of the baseline in pixels.
|
||||||
|
this.baselineWidth = null;
|
||||||
|
// prop: baselineColor
|
||||||
|
// CSS color spec for the baseline.
|
||||||
|
this.baselineColor = null;
|
||||||
|
this.daTickInterval = null;
|
||||||
|
this._daTickInterval = null;
|
||||||
|
|
||||||
|
$.extend(true, this, options);
|
||||||
|
|
||||||
|
var db = this._dataBounds,
|
||||||
|
stats,
|
||||||
|
sum,
|
||||||
|
s,
|
||||||
|
d,
|
||||||
|
pd,
|
||||||
|
sd,
|
||||||
|
intv;
|
||||||
|
|
||||||
|
// Go through all the series attached to this axis and find
|
||||||
|
// the min/max bounds for this axis.
|
||||||
|
for (var i=0; i<this._series.length; i++) {
|
||||||
|
stats = {intervals:[], frequencies:{}, sortedIntervals:[], min:null, max:null, mean:null};
|
||||||
|
sum = 0;
|
||||||
|
s = this._series[i];
|
||||||
|
d = s.data;
|
||||||
|
pd = s._plotData;
|
||||||
|
sd = s._stackData;
|
||||||
|
intv = 0;
|
||||||
|
|
||||||
|
for (var j=0; j<d.length; j++) {
|
||||||
|
if (this.name == 'xaxis' || this.name == 'x2axis') {
|
||||||
|
d[j][0] = new $.jsDate(d[j][0]).getTime();
|
||||||
|
pd[j][0] = new $.jsDate(d[j][0]).getTime();
|
||||||
|
sd[j][0] = new $.jsDate(d[j][0]).getTime();
|
||||||
|
if ((d[j][0] != null && d[j][0] < db.min) || db.min == null) {
|
||||||
|
db.min = d[j][0];
|
||||||
|
}
|
||||||
|
if ((d[j][0] != null && d[j][0] > db.max) || db.max == null) {
|
||||||
|
db.max = d[j][0];
|
||||||
|
}
|
||||||
|
if (j>0) {
|
||||||
|
intv = Math.abs(d[j][0] - d[j-1][0]);
|
||||||
|
stats.intervals.push(intv);
|
||||||
|
if (stats.frequencies.hasOwnProperty(intv)) {
|
||||||
|
stats.frequencies[intv] += 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stats.frequencies[intv] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum += intv;
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
d[j][1] = new $.jsDate(d[j][1]).getTime();
|
||||||
|
pd[j][1] = new $.jsDate(d[j][1]).getTime();
|
||||||
|
sd[j][1] = new $.jsDate(d[j][1]).getTime();
|
||||||
|
if ((d[j][1] != null && d[j][1] < db.min) || db.min == null) {
|
||||||
|
db.min = d[j][1];
|
||||||
|
}
|
||||||
|
if ((d[j][1] != null && d[j][1] > db.max) || db.max == null) {
|
||||||
|
db.max = d[j][1];
|
||||||
|
}
|
||||||
|
if (j>0) {
|
||||||
|
intv = Math.abs(d[j][1] - d[j-1][1]);
|
||||||
|
stats.intervals.push(intv);
|
||||||
|
if (stats.frequencies.hasOwnProperty(intv)) {
|
||||||
|
stats.frequencies[intv] += 1;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stats.frequencies[intv] = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum += intv;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (s.renderer.bands) {
|
||||||
|
if (s.renderer.bands.hiData.length) {
|
||||||
|
var bd = s.renderer.bands.hiData;
|
||||||
|
for (var j=0, l=bd.length; j < l; j++) {
|
||||||
|
if (this.name === 'xaxis' || this.name === 'x2axis') {
|
||||||
|
bd[j][0] = new $.jsDate(bd[j][0]).getTime();
|
||||||
|
if ((bd[j][0] != null && bd[j][0] > db.max) || db.max == null) {
|
||||||
|
db.max = bd[j][0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bd[j][1] = new $.jsDate(bd[j][1]).getTime();
|
||||||
|
if ((bd[j][1] != null && bd[j][1] > db.max) || db.max == null) {
|
||||||
|
db.max = bd[j][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (s.renderer.bands.lowData.length) {
|
||||||
|
var bd = s.renderer.bands.lowData;
|
||||||
|
for (var j=0, l=bd.length; j < l; j++) {
|
||||||
|
if (this.name === 'xaxis' || this.name === 'x2axis') {
|
||||||
|
bd[j][0] = new $.jsDate(bd[j][0]).getTime();
|
||||||
|
if ((bd[j][0] != null && bd[j][0] < db.min) || db.min == null) {
|
||||||
|
db.min = bd[j][0];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
bd[j][1] = new $.jsDate(bd[j][1]).getTime();
|
||||||
|
if ((bd[j][1] != null && bd[j][1] < db.min) || db.min == null) {
|
||||||
|
db.min = bd[j][1];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var tempf = 0,
|
||||||
|
tempn=0;
|
||||||
|
for (var n in stats.frequencies) {
|
||||||
|
stats.sortedIntervals.push({interval:n, frequency:stats.frequencies[n]});
|
||||||
|
}
|
||||||
|
stats.sortedIntervals.sort(function(a, b){
|
||||||
|
return b.frequency - a.frequency;
|
||||||
|
});
|
||||||
|
|
||||||
|
stats.min = $.jqplot.arrayMin(stats.intervals);
|
||||||
|
stats.max = $.jqplot.arrayMax(stats.intervals);
|
||||||
|
stats.mean = sum/d.length;
|
||||||
|
this._intervalStats.push(stats);
|
||||||
|
stats = sum = s = d = pd = sd = null;
|
||||||
|
}
|
||||||
|
db = null;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with scope of an axis
|
||||||
|
$.jqplot.DateAxisRenderer.prototype.reset = function() {
|
||||||
|
this.min = this._options.min;
|
||||||
|
this.max = this._options.max;
|
||||||
|
this.tickInterval = this._options.tickInterval;
|
||||||
|
this.numberTicks = this._options.numberTicks;
|
||||||
|
this._autoFormatString = '';
|
||||||
|
if (this._overrideFormatString && this.tickOptions && this.tickOptions.formatString) {
|
||||||
|
this.tickOptions.formatString = '';
|
||||||
|
}
|
||||||
|
this.daTickInterval = this._daTickInterval;
|
||||||
|
// this._ticks = this.__ticks;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DateAxisRenderer.prototype.createTicks = function(plot) {
|
||||||
|
// we're are operating on an axis here
|
||||||
|
var ticks = this._ticks;
|
||||||
|
var userTicks = this.ticks;
|
||||||
|
var name = this.name;
|
||||||
|
// databounds were set on axis initialization.
|
||||||
|
var db = this._dataBounds;
|
||||||
|
var iv = this._intervalStats;
|
||||||
|
var dim = (this.name.charAt(0) === 'x') ? this._plotDimensions.width : this._plotDimensions.height;
|
||||||
|
var interval;
|
||||||
|
var min, max;
|
||||||
|
var pos1, pos2;
|
||||||
|
var tt, i;
|
||||||
|
var threshold = 30;
|
||||||
|
var insetMult = 1;
|
||||||
|
var daTickInterval = null;
|
||||||
|
|
||||||
|
// if user specified a tick interval, convert to usable.
|
||||||
|
if (this.tickInterval != null)
|
||||||
|
{
|
||||||
|
// if interval is a number or can be converted to one, use it.
|
||||||
|
// Assume it is in SECONDS!!!
|
||||||
|
if (Number(this.tickInterval)) {
|
||||||
|
daTickInterval = [Number(this.tickInterval), 'seconds'];
|
||||||
|
}
|
||||||
|
// else, parse out something we can build from.
|
||||||
|
else if (typeof this.tickInterval == "string") {
|
||||||
|
var parts = this.tickInterval.split(' ');
|
||||||
|
if (parts.length == 1) {
|
||||||
|
daTickInterval = [1, parts[0]];
|
||||||
|
}
|
||||||
|
else if (parts.length == 2) {
|
||||||
|
daTickInterval = [parts[0], parts[1]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var tickInterval = this.tickInterval;
|
||||||
|
|
||||||
|
// if we already have ticks, use them.
|
||||||
|
// ticks must be in order of increasing value.
|
||||||
|
|
||||||
|
min = new $.jsDate((this.min != null) ? this.min : db.min).getTime();
|
||||||
|
max = new $.jsDate((this.max != null) ? this.max : db.max).getTime();
|
||||||
|
|
||||||
|
// see if we're zooming. if we are, don't use the min and max we're given,
|
||||||
|
// but compute some nice ones. They will be reset later.
|
||||||
|
|
||||||
|
var cursor = plot.plugins.cursor;
|
||||||
|
|
||||||
|
if (cursor && cursor._zoom && cursor._zoom.zooming) {
|
||||||
|
this.min = null;
|
||||||
|
this.max = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
var range = max - min;
|
||||||
|
|
||||||
|
if (this.tickOptions == null || !this.tickOptions.formatString) {
|
||||||
|
this._overrideFormatString = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (userTicks.length) {
|
||||||
|
// ticks could be 1D or 2D array of [val, val, ,,,] or [[val, label], [val, label], ...] or mixed
|
||||||
|
for (i=0; i<userTicks.length; i++){
|
||||||
|
var ut = userTicks[i];
|
||||||
|
var t = new this.tickRenderer(this.tickOptions);
|
||||||
|
if (ut.constructor == Array) {
|
||||||
|
t.value = new $.jsDate(ut[0]).getTime();
|
||||||
|
t.label = ut[1];
|
||||||
|
if (!this.showTicks) {
|
||||||
|
t.showLabel = false;
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
else if (!this.showTickMarks) {
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
t.setTick(t.value, this.name);
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
t.value = new $.jsDate(ut).getTime();
|
||||||
|
if (!this.showTicks) {
|
||||||
|
t.showLabel = false;
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
else if (!this.showTickMarks) {
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
t.setTick(t.value, this.name);
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
this.numberTicks = userTicks.length;
|
||||||
|
this.min = this._ticks[0].value;
|
||||||
|
this.max = this._ticks[this.numberTicks-1].value;
|
||||||
|
this.daTickInterval = [(this.max - this.min) / (this.numberTicks - 1)/1000, 'seconds'];
|
||||||
|
}
|
||||||
|
|
||||||
|
////////
|
||||||
|
// We don't have any ticks yet, let's make some!
|
||||||
|
////////
|
||||||
|
|
||||||
|
// special case when there is only one point, make three tick marks to center the point
|
||||||
|
else if (this.min == null && this.max == null && db.min == db.max)
|
||||||
|
{
|
||||||
|
var onePointOpts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
|
||||||
|
var delta = 300000;
|
||||||
|
this.min = db.min - delta;
|
||||||
|
this.max = db.max + delta;
|
||||||
|
this.numberTicks = 3;
|
||||||
|
|
||||||
|
for(var i=this.min;i<=this.max;i+= delta)
|
||||||
|
{
|
||||||
|
onePointOpts.value = i;
|
||||||
|
|
||||||
|
var t = new this.tickRenderer(onePointOpts);
|
||||||
|
|
||||||
|
if (this._overrideFormatString && this._autoFormatString != '') {
|
||||||
|
t.formatString = this._autoFormatString;
|
||||||
|
}
|
||||||
|
|
||||||
|
t.showLabel = false;
|
||||||
|
t.showMark = false;
|
||||||
|
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.showTicks) {
|
||||||
|
this._ticks[1].showLabel = true;
|
||||||
|
}
|
||||||
|
if(this.showTickMarks) {
|
||||||
|
this._ticks[1].showTickMarks = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// if user specified min and max are null, we set those to make best ticks.
|
||||||
|
else if (this.min == null && this.max == null) {
|
||||||
|
|
||||||
|
var opts = $.extend(true, {}, this.tickOptions, {name: this.name, value: null});
|
||||||
|
|
||||||
|
// want to find a nice interval
|
||||||
|
var nttarget,
|
||||||
|
titarget;
|
||||||
|
|
||||||
|
// if no tickInterval or numberTicks options specified, make a good guess.
|
||||||
|
if (!this.tickInterval && !this.numberTicks) {
|
||||||
|
var tdim = Math.max(dim, threshold+1);
|
||||||
|
// how many ticks to put on the axis?
|
||||||
|
// date labels tend to be long. If ticks not rotated,
|
||||||
|
// don't use too many and have a high spacing factor.
|
||||||
|
// If we are rotating ticks, use a lower factor.
|
||||||
|
var spacingFactor = 115;
|
||||||
|
if (this.tickRenderer === $.jqplot.CanvasAxisTickRenderer && this.tickOptions.angle) {
|
||||||
|
spacingFactor = 115 - 40 * Math.abs(Math.sin(this.tickOptions.angle/180*Math.PI));
|
||||||
|
}
|
||||||
|
|
||||||
|
nttarget = Math.ceil((tdim-threshold)/spacingFactor + 1);
|
||||||
|
titarget = (max - min) / (nttarget - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If tickInterval is specified, we'll try to honor it.
|
||||||
|
// Not guaranteed to get this interval, but we'll get as close as
|
||||||
|
// we can.
|
||||||
|
// tickInterval will be used before numberTicks, that is if
|
||||||
|
// both are specified, numberTicks will be ignored.
|
||||||
|
else if (this.tickInterval) {
|
||||||
|
titarget = new $.jsDate(0).add(daTickInterval[0], daTickInterval[1]).getTime();
|
||||||
|
}
|
||||||
|
|
||||||
|
// if numberTicks specified, try to honor it.
|
||||||
|
// Not guaranteed, but will try to get close.
|
||||||
|
else if (this.numberTicks) {
|
||||||
|
nttarget = this.numberTicks;
|
||||||
|
titarget = (max - min) / (nttarget - 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If we can use an interval of 2 weeks or less, pick best one
|
||||||
|
if (titarget <= 19*day) {
|
||||||
|
var ret = bestDateInterval(min, max, titarget);
|
||||||
|
var tempti = ret[0];
|
||||||
|
this._autoFormatString = ret[1];
|
||||||
|
|
||||||
|
min = new $.jsDate(min);
|
||||||
|
min = Math.floor((min.getTime() - min.getUtcOffset())/tempti) * tempti + min.getUtcOffset();
|
||||||
|
|
||||||
|
nttarget = Math.ceil((max - min) / tempti) + 1;
|
||||||
|
this.min = min;
|
||||||
|
this.max = min + (nttarget - 1) * tempti;
|
||||||
|
|
||||||
|
// if max is less than max, add an interval
|
||||||
|
if (this.max < max) {
|
||||||
|
this.max += tempti;
|
||||||
|
nttarget += 1;
|
||||||
|
}
|
||||||
|
this.tickInterval = tempti;
|
||||||
|
this.numberTicks = nttarget;
|
||||||
|
|
||||||
|
for (var i=0; i<nttarget; i++) {
|
||||||
|
opts.value = this.min + i * tempti;
|
||||||
|
t = new this.tickRenderer(opts);
|
||||||
|
|
||||||
|
if (this._overrideFormatString && this._autoFormatString != '') {
|
||||||
|
t.formatString = this._autoFormatString;
|
||||||
|
}
|
||||||
|
if (!this.showTicks) {
|
||||||
|
t.showLabel = false;
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
else if (!this.showTickMarks) {
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
insetMult = this.tickInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
// should we use a monthly interval?
|
||||||
|
else if (titarget <= 9 * month) {
|
||||||
|
|
||||||
|
this._autoFormatString = '%v';
|
||||||
|
|
||||||
|
// how many months in an interval?
|
||||||
|
var intv = Math.round(titarget/month);
|
||||||
|
if (intv < 1) {
|
||||||
|
intv = 1;
|
||||||
|
}
|
||||||
|
else if (intv > 6) {
|
||||||
|
intv = 6;
|
||||||
|
}
|
||||||
|
|
||||||
|
// figure out the starting month and ending month.
|
||||||
|
var mstart = new $.jsDate(min).setDate(1).setHours(0,0,0,0);
|
||||||
|
|
||||||
|
// See if max ends exactly on a month
|
||||||
|
var tempmend = new $.jsDate(max);
|
||||||
|
var mend = new $.jsDate(max).setDate(1).setHours(0,0,0,0);
|
||||||
|
|
||||||
|
if (tempmend.getTime() !== mend.getTime()) {
|
||||||
|
mend = mend.add(1, 'month');
|
||||||
|
}
|
||||||
|
|
||||||
|
var nmonths = mend.diff(mstart, 'month');
|
||||||
|
|
||||||
|
nttarget = Math.ceil(nmonths/intv) + 1;
|
||||||
|
|
||||||
|
this.min = mstart.getTime();
|
||||||
|
this.max = mstart.clone().add((nttarget - 1) * intv, 'month').getTime();
|
||||||
|
this.numberTicks = nttarget;
|
||||||
|
|
||||||
|
for (var i=0; i<nttarget; i++) {
|
||||||
|
if (i === 0) {
|
||||||
|
opts.value = mstart.getTime();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
opts.value = mstart.add(intv, 'month').getTime();
|
||||||
|
}
|
||||||
|
t = new this.tickRenderer(opts);
|
||||||
|
|
||||||
|
if (this._overrideFormatString && this._autoFormatString != '') {
|
||||||
|
t.formatString = this._autoFormatString;
|
||||||
|
}
|
||||||
|
if (!this.showTicks) {
|
||||||
|
t.showLabel = false;
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
else if (!this.showTickMarks) {
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
insetMult = intv * month;
|
||||||
|
}
|
||||||
|
|
||||||
|
// use yearly intervals
|
||||||
|
else {
|
||||||
|
|
||||||
|
this._autoFormatString = '%v';
|
||||||
|
|
||||||
|
// how many years in an interval?
|
||||||
|
var intv = Math.round(titarget/year);
|
||||||
|
if (intv < 1) {
|
||||||
|
intv = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// figure out the starting and ending years.
|
||||||
|
var mstart = new $.jsDate(min).setMonth(0, 1).setHours(0,0,0,0);
|
||||||
|
var mend = new $.jsDate(max).add(1, 'year').setMonth(0, 1).setHours(0,0,0,0);
|
||||||
|
|
||||||
|
var nyears = mend.diff(mstart, 'year');
|
||||||
|
|
||||||
|
nttarget = Math.ceil(nyears/intv) + 1;
|
||||||
|
|
||||||
|
this.min = mstart.getTime();
|
||||||
|
this.max = mstart.clone().add((nttarget - 1) * intv, 'year').getTime();
|
||||||
|
this.numberTicks = nttarget;
|
||||||
|
|
||||||
|
for (var i=0; i<nttarget; i++) {
|
||||||
|
if (i === 0) {
|
||||||
|
opts.value = mstart.getTime();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
opts.value = mstart.add(intv, 'year').getTime();
|
||||||
|
}
|
||||||
|
t = new this.tickRenderer(opts);
|
||||||
|
|
||||||
|
if (this._overrideFormatString && this._autoFormatString != '') {
|
||||||
|
t.formatString = this._autoFormatString;
|
||||||
|
}
|
||||||
|
if (!this.showTicks) {
|
||||||
|
t.showLabel = false;
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
else if (!this.showTickMarks) {
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
|
||||||
|
insetMult = intv * year;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
////////
|
||||||
|
// Some option(s) specified, work around that.
|
||||||
|
////////
|
||||||
|
|
||||||
|
else {
|
||||||
|
if (name == 'xaxis' || name == 'x2axis') {
|
||||||
|
dim = this._plotDimensions.width;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
dim = this._plotDimensions.height;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if min, max and number of ticks specified, user can't specify interval.
|
||||||
|
if (this.min != null && this.max != null && this.numberTicks != null) {
|
||||||
|
this.tickInterval = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.tickInterval != null && daTickInterval != null) {
|
||||||
|
this.daTickInterval = daTickInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if min and max are same, space them out a bit
|
||||||
|
if (min == max) {
|
||||||
|
var adj = 24*60*60*500; // 1/2 day
|
||||||
|
min -= adj;
|
||||||
|
max += adj;
|
||||||
|
}
|
||||||
|
|
||||||
|
range = max - min;
|
||||||
|
|
||||||
|
var optNumTicks = 2 + parseInt(Math.max(0, dim-100)/100, 10);
|
||||||
|
|
||||||
|
|
||||||
|
var rmin, rmax;
|
||||||
|
|
||||||
|
rmin = (this.min != null) ? new $.jsDate(this.min).getTime() : min - range/2*(this.padMin - 1);
|
||||||
|
rmax = (this.max != null) ? new $.jsDate(this.max).getTime() : max + range/2*(this.padMax - 1);
|
||||||
|
this.min = rmin;
|
||||||
|
this.max = rmax;
|
||||||
|
range = this.max - this.min;
|
||||||
|
|
||||||
|
if (this.numberTicks == null){
|
||||||
|
// if tickInterval is specified by user, we will ignore computed maximum.
|
||||||
|
// max will be equal or greater to fit even # of ticks.
|
||||||
|
if (this.daTickInterval != null) {
|
||||||
|
var nc = new $.jsDate(this.max).diff(this.min, this.daTickInterval[1], true);
|
||||||
|
this.numberTicks = Math.ceil(nc/this.daTickInterval[0]) +1;
|
||||||
|
// this.max = new $.jsDate(this.min).add(this.numberTicks-1, this.daTickInterval[1]).getTime();
|
||||||
|
this.max = new $.jsDate(this.min).add((this.numberTicks-1) * this.daTickInterval[0], this.daTickInterval[1]).getTime();
|
||||||
|
}
|
||||||
|
else if (dim > 200) {
|
||||||
|
this.numberTicks = parseInt(3+(dim-200)/100, 10);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.numberTicks = 2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
insetMult = range / (this.numberTicks-1)/1000;
|
||||||
|
|
||||||
|
if (this.daTickInterval == null) {
|
||||||
|
this.daTickInterval = [insetMult, 'seconds'];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for (var i=0; i<this.numberTicks; i++){
|
||||||
|
var min = new $.jsDate(this.min);
|
||||||
|
tt = min.add(i*this.daTickInterval[0], this.daTickInterval[1]).getTime();
|
||||||
|
var t = new this.tickRenderer(this.tickOptions);
|
||||||
|
// var t = new $.jqplot.AxisTickRenderer(this.tickOptions);
|
||||||
|
if (!this.showTicks) {
|
||||||
|
t.showLabel = false;
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
else if (!this.showTickMarks) {
|
||||||
|
t.showMark = false;
|
||||||
|
}
|
||||||
|
t.setTick(tt, this.name);
|
||||||
|
this._ticks.push(t);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.tickInset) {
|
||||||
|
this.min = this.min - this.tickInset * insetMult;
|
||||||
|
this.max = this.max + this.tickInset * insetMult;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this._daTickInterval == null) {
|
||||||
|
this._daTickInterval = this.daTickInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
ticks = null;
|
||||||
|
};
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(h){h.jqplot.DateAxisRenderer=function(){h.jqplot.LinearAxisRenderer.call(this);this.date=new h.jsDate()};var c=1000;var e=60*c;var f=60*e;var l=24*f;var b=7*l;var j=30.4368499*l;var k=365.242199*l;var g=[31,28,31,30,31,30,31,30,31,30,31,30];var i=["%M:%S.%#N","%M:%S.%#N","%M:%S.%#N","%M:%S","%M:%S","%M:%S","%M:%S","%H:%M:%S","%H:%M:%S","%H:%M","%H:%M","%H:%M","%H:%M","%H:%M","%H:%M","%a %H:%M","%a %H:%M","%b %e %H:%M","%b %e %H:%M","%b %e %H:%M","%b %e %H:%M","%v","%v","%v","%v","%v","%v","%v"];var m=[0.1*c,0.2*c,0.5*c,c,2*c,5*c,10*c,15*c,30*c,e,2*e,5*e,10*e,15*e,30*e,f,2*f,4*f,6*f,8*f,12*f,l,2*l,3*l,4*l,5*l,b,2*b];var d=[];function a(p,s,t){var o=Number.MAX_VALUE;var u,r,v;for(var q=0,n=m.length;q<n;q++){u=Math.abs(t-m[q]);if(u<o){o=u;r=m[q];v=i[q]}}return[r,v]}h.jqplot.DateAxisRenderer.prototype=new h.jqplot.LinearAxisRenderer();h.jqplot.DateAxisRenderer.prototype.constructor=h.jqplot.DateAxisRenderer;h.jqplot.DateTickFormatter=function(n,o){if(!n){n="%Y/%m/%d"}return h.jsDate.strftime(o,n)};h.jqplot.DateAxisRenderer.prototype.init=function(E){this.tickOptions.formatter=h.jqplot.DateTickFormatter;this.tickInset=0;this.drawBaseline=true;this.baselineWidth=null;this.baselineColor=null;this.daTickInterval=null;this._daTickInterval=null;h.extend(true,this,E);var C=this._dataBounds,u,x,D,y,A,z,o;for(var t=0;t<this._series.length;t++){u={intervals:[],frequencies:{},sortedIntervals:[],min:null,max:null,mean:null};x=0;D=this._series[t];y=D.data;A=D._plotData;z=D._stackData;o=0;for(var r=0;r<y.length;r++){if(this.name=="xaxis"||this.name=="x2axis"){y[r][0]=new h.jsDate(y[r][0]).getTime();A[r][0]=new h.jsDate(y[r][0]).getTime();z[r][0]=new h.jsDate(y[r][0]).getTime();if((y[r][0]!=null&&y[r][0]<C.min)||C.min==null){C.min=y[r][0]}if((y[r][0]!=null&&y[r][0]>C.max)||C.max==null){C.max=y[r][0]}if(r>0){o=Math.abs(y[r][0]-y[r-1][0]);u.intervals.push(o);if(u.frequencies.hasOwnProperty(o)){u.frequencies[o]+=1}else{u.frequencies[o]=1}}x+=o}else{y[r][1]=new h.jsDate(y[r][1]).getTime();A[r][1]=new h.jsDate(y[r][1]).getTime();z[r][1]=new h.jsDate(y[r][1]).getTime();if((y[r][1]!=null&&y[r][1]<C.min)||C.min==null){C.min=y[r][1]}if((y[r][1]!=null&&y[r][1]>C.max)||C.max==null){C.max=y[r][1]}if(r>0){o=Math.abs(y[r][1]-y[r-1][1]);u.intervals.push(o);if(u.frequencies.hasOwnProperty(o)){u.frequencies[o]+=1}else{u.frequencies[o]=1}}}x+=o}if(D.renderer.bands){if(D.renderer.bands.hiData.length){var w=D.renderer.bands.hiData;for(var r=0,q=w.length;r<q;r++){if(this.name==="xaxis"||this.name==="x2axis"){w[r][0]=new h.jsDate(w[r][0]).getTime();if((w[r][0]!=null&&w[r][0]>C.max)||C.max==null){C.max=w[r][0]}}else{w[r][1]=new h.jsDate(w[r][1]).getTime();if((w[r][1]!=null&&w[r][1]>C.max)||C.max==null){C.max=w[r][1]}}}}if(D.renderer.bands.lowData.length){var w=D.renderer.bands.lowData;for(var r=0,q=w.length;r<q;r++){if(this.name==="xaxis"||this.name==="x2axis"){w[r][0]=new h.jsDate(w[r][0]).getTime();if((w[r][0]!=null&&w[r][0]<C.min)||C.min==null){C.min=w[r][0]}}else{w[r][1]=new h.jsDate(w[r][1]).getTime();if((w[r][1]!=null&&w[r][1]<C.min)||C.min==null){C.min=w[r][1]}}}}}var B=0,v=0;for(var p in u.frequencies){u.sortedIntervals.push({interval:p,frequency:u.frequencies[p]})}u.sortedIntervals.sort(function(s,n){return n.frequency-s.frequency});u.min=h.jqplot.arrayMin(u.intervals);u.max=h.jqplot.arrayMax(u.intervals);u.mean=x/y.length;this._intervalStats.push(u);u=x=D=y=A=z=null}C=null};h.jqplot.DateAxisRenderer.prototype.reset=function(){this.min=this._options.min;this.max=this._options.max;this.tickInterval=this._options.tickInterval;this.numberTicks=this._options.numberTicks;this._autoFormatString="";if(this._overrideFormatString&&this.tickOptions&&this.tickOptions.formatString){this.tickOptions.formatString=""}this.daTickInterval=this._daTickInterval};h.jqplot.DateAxisRenderer.prototype.createTicks=function(p){var X=this._ticks;var L=this.ticks;var F=this.name;var H=this._dataBounds;var M=this._intervalStats;var n=(this.name.charAt(0)==="x")?this._plotDimensions.width:this._plotDimensions.height;var w;var ae,J;var y,x;var ad,aa;var s=30;var O=1;var U=null;if(this.tickInterval!=null){if(Number(this.tickInterval)){U=[Number(this.tickInterval),"seconds"]}else{if(typeof this.tickInterval=="string"){var ac=this.tickInterval.split(" ");if(ac.length==1){U=[1,ac[0]]}else{if(ac.length==2){U=[ac[0],ac[1]]}}}}}var v=this.tickInterval;ae=new h.jsDate((this.min!=null)?this.min:H.min).getTime();J=new h.jsDate((this.max!=null)?this.max:H.max).getTime();var A=p.plugins.cursor;if(A&&A._zoom&&A._zoom.zooming){this.min=null;this.max=null}var B=J-ae;if(this.tickOptions==null||!this.tickOptions.formatString){this._overrideFormatString=true}if(L.length){for(aa=0;aa<L.length;aa++){var P=L[aa];var Y=new this.tickRenderer(this.tickOptions);if(P.constructor==Array){Y.value=new h.jsDate(P[0]).getTime();Y.label=P[1];if(!this.showTicks){Y.showLabel=false;Y.showMark=false}else{if(!this.showTickMarks){Y.showMark=false}}Y.setTick(Y.value,this.name);this._ticks.pushLine truncated
|
||||||
@@ -0,0 +1,805 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.DonutRenderer
|
||||||
|
* Plugin renderer to draw a donut chart.
|
||||||
|
* x values, if present, will be used as slice labels.
|
||||||
|
* y values give slice size.
|
||||||
|
*
|
||||||
|
* To use this renderer, you need to include the
|
||||||
|
* donut renderer plugin, for example:
|
||||||
|
*
|
||||||
|
* > <script type="text/javascript" src="plugins/jqplot.donutRenderer.js"></script>
|
||||||
|
*
|
||||||
|
* Properties described here are passed into the $.jqplot function
|
||||||
|
* as options on the series renderer. For example:
|
||||||
|
*
|
||||||
|
* > plot2 = $.jqplot('chart2', [s1, s2], {
|
||||||
|
* > seriesDefaults: {
|
||||||
|
* > renderer:$.jqplot.DonutRenderer,
|
||||||
|
* > rendererOptions:{
|
||||||
|
* > sliceMargin: 2,
|
||||||
|
* > innerDiameter: 110,
|
||||||
|
* > startAngle: -90
|
||||||
|
* > }
|
||||||
|
* > }
|
||||||
|
* > });
|
||||||
|
*
|
||||||
|
* A donut plot will trigger events on the plot target
|
||||||
|
* according to user interaction. All events return the event object,
|
||||||
|
* the series index, the point (slice) index, and the point data for
|
||||||
|
* the appropriate slice.
|
||||||
|
*
|
||||||
|
* 'jqplotDataMouseOver' - triggered when user mouseing over a slice.
|
||||||
|
* 'jqplotDataHighlight' - triggered the first time user mouses over a slice,
|
||||||
|
* if highlighting is enabled.
|
||||||
|
* 'jqplotDataUnhighlight' - triggered when a user moves the mouse out of
|
||||||
|
* a highlighted slice.
|
||||||
|
* 'jqplotDataClick' - triggered when the user clicks on a slice.
|
||||||
|
* 'jqplotDataRightClick' - tiggered when the user right clicks on a slice if
|
||||||
|
* the "captureRightClick" option is set to true on the plot.
|
||||||
|
*/
|
||||||
|
$.jqplot.DonutRenderer = function(){
|
||||||
|
$.jqplot.LineRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DonutRenderer.prototype = new $.jqplot.LineRenderer();
|
||||||
|
$.jqplot.DonutRenderer.prototype.constructor = $.jqplot.DonutRenderer;
|
||||||
|
|
||||||
|
// called with scope of a series
|
||||||
|
$.jqplot.DonutRenderer.prototype.init = function(options, plot) {
|
||||||
|
// Group: Properties
|
||||||
|
//
|
||||||
|
// prop: diameter
|
||||||
|
// Outer diameter of the donut, auto computed by default
|
||||||
|
this.diameter = null;
|
||||||
|
// prop: innerDiameter
|
||||||
|
// Inner diameter of the donut, auto calculated by default.
|
||||||
|
// If specified will override thickness value.
|
||||||
|
this.innerDiameter = null;
|
||||||
|
// prop: thickness
|
||||||
|
// thickness of the donut, auto computed by default
|
||||||
|
// Overridden by if innerDiameter is specified.
|
||||||
|
this.thickness = null;
|
||||||
|
// prop: padding
|
||||||
|
// padding between the donut and plot edges, legend, etc.
|
||||||
|
this.padding = 20;
|
||||||
|
// prop: sliceMargin
|
||||||
|
// angular spacing between donut slices in degrees.
|
||||||
|
this.sliceMargin = 0;
|
||||||
|
// prop: ringMargin
|
||||||
|
// pixel distance between rings, or multiple series in a donut plot.
|
||||||
|
// null will compute ringMargin based on sliceMargin.
|
||||||
|
this.ringMargin = null;
|
||||||
|
// prop: fill
|
||||||
|
// true or false, whether to fil the slices.
|
||||||
|
this.fill = true;
|
||||||
|
// prop: shadowOffset
|
||||||
|
// offset of the shadow from the slice and offset of
|
||||||
|
// each succesive stroke of the shadow from the last.
|
||||||
|
this.shadowOffset = 2;
|
||||||
|
// prop: shadowAlpha
|
||||||
|
// transparency of the shadow (0 = transparent, 1 = opaque)
|
||||||
|
this.shadowAlpha = 0.07;
|
||||||
|
// prop: shadowDepth
|
||||||
|
// number of strokes to apply to the shadow,
|
||||||
|
// each stroke offset shadowOffset from the last.
|
||||||
|
this.shadowDepth = 5;
|
||||||
|
// prop: highlightMouseOver
|
||||||
|
// True to highlight slice when moused over.
|
||||||
|
// This must be false to enable highlightMouseDown to highlight when clicking on a slice.
|
||||||
|
this.highlightMouseOver = true;
|
||||||
|
// prop: highlightMouseDown
|
||||||
|
// True to highlight when a mouse button is pressed over a slice.
|
||||||
|
// This will be disabled if highlightMouseOver is true.
|
||||||
|
this.highlightMouseDown = false;
|
||||||
|
// prop: highlightColors
|
||||||
|
// an array of colors to use when highlighting a slice.
|
||||||
|
this.highlightColors = [];
|
||||||
|
// prop: dataLabels
|
||||||
|
// Either 'label', 'value', 'percent' or an array of labels to place on the pie slices.
|
||||||
|
// Defaults to percentage of each pie slice.
|
||||||
|
this.dataLabels = 'percent';
|
||||||
|
// prop: showDataLabels
|
||||||
|
// true to show data labels on slices.
|
||||||
|
this.showDataLabels = false;
|
||||||
|
// prop: dataLabelFormatString
|
||||||
|
// Format string for data labels. If none, '%s' is used for "label" and for arrays, '%d' for value and '%d%%' for percentage.
|
||||||
|
this.dataLabelFormatString = null;
|
||||||
|
// prop: dataLabelThreshold
|
||||||
|
// Threshhold in percentage (0 - 100) of pie area, below which no label will be displayed.
|
||||||
|
// This applies to all label types, not just to percentage labels.
|
||||||
|
this.dataLabelThreshold = 3;
|
||||||
|
// prop: dataLabelPositionFactor
|
||||||
|
// A Multiplier (0-1) of the pie radius which controls position of label on slice.
|
||||||
|
// Increasing will slide label toward edge of pie, decreasing will slide label toward center of pie.
|
||||||
|
this.dataLabelPositionFactor = 0.4;
|
||||||
|
// prop: dataLabelNudge
|
||||||
|
// Number of pixels to slide the label away from (+) or toward (-) the center of the pie.
|
||||||
|
this.dataLabelNudge = 0;
|
||||||
|
// prop: startAngle
|
||||||
|
// Angle to start drawing donut in degrees.
|
||||||
|
// According to orientation of canvas coordinate system:
|
||||||
|
// 0 = on the positive x axis
|
||||||
|
// -90 = on the positive y axis.
|
||||||
|
// 90 = on the negaive y axis.
|
||||||
|
// 180 or - 180 = on the negative x axis.
|
||||||
|
this.startAngle = 0;
|
||||||
|
this.tickRenderer = $.jqplot.DonutTickRenderer;
|
||||||
|
// Used as check for conditions where donut shouldn't be drawn.
|
||||||
|
this._drawData = true;
|
||||||
|
this._type = 'donut';
|
||||||
|
|
||||||
|
// if user has passed in highlightMouseDown option and not set highlightMouseOver, disable highlightMouseOver
|
||||||
|
if (options.highlightMouseDown && options.highlightMouseOver == null) {
|
||||||
|
options.highlightMouseOver = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
$.extend(true, this, options);
|
||||||
|
if (this.diameter != null) {
|
||||||
|
this.diameter = this.diameter - this.sliceMargin;
|
||||||
|
}
|
||||||
|
this._diameter = null;
|
||||||
|
this._innerDiameter = null;
|
||||||
|
this._radius = null;
|
||||||
|
this._innerRadius = null;
|
||||||
|
this._thickness = null;
|
||||||
|
// references to the previous series in the plot to properly calculate diameters
|
||||||
|
// and thicknesses of nested rings.
|
||||||
|
this._previousSeries = [];
|
||||||
|
this._numberSeries = 1;
|
||||||
|
// array of [start,end] angles arrays, one for each slice. In radians.
|
||||||
|
this._sliceAngles = [];
|
||||||
|
// index of the currenty highlighted point, if any
|
||||||
|
this._highlightedPoint = null;
|
||||||
|
|
||||||
|
// set highlight colors if none provided
|
||||||
|
if (this.highlightColors.length == 0) {
|
||||||
|
for (var i=0; i<this.seriesColors.length; i++){
|
||||||
|
var rgba = $.jqplot.getColorComponents(this.seriesColors[i]);
|
||||||
|
var newrgb = [rgba[0], rgba[1], rgba[2]];
|
||||||
|
var sum = newrgb[0] + newrgb[1] + newrgb[2];
|
||||||
|
for (var j=0; j<3; j++) {
|
||||||
|
// when darkening, lowest color component can be is 60.
|
||||||
|
newrgb[j] = (sum > 570) ? newrgb[j] * 0.8 : newrgb[j] + 0.3 * (255 - newrgb[j]);
|
||||||
|
newrgb[j] = parseInt(newrgb[j], 10);
|
||||||
|
}
|
||||||
|
this.highlightColors.push('rgb('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+')');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
plot.postParseOptionsHooks.addOnce(postParseOptions);
|
||||||
|
plot.postInitHooks.addOnce(postInit);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseMove', handleMove);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseDown', handleMouseDown);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotMouseUp', handleMouseUp);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotClick', handleClick);
|
||||||
|
plot.eventListenerHooks.addOnce('jqplotRightClick', handleRightClick);
|
||||||
|
plot.postDrawHooks.addOnce(postPlotDraw);
|
||||||
|
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DonutRenderer.prototype.setGridData = function(plot) {
|
||||||
|
// set gridData property. This will hold angle in radians of each data point.
|
||||||
|
var stack = [];
|
||||||
|
var td = [];
|
||||||
|
var sa = this.startAngle/180*Math.PI;
|
||||||
|
var tot = 0;
|
||||||
|
// don't know if we have any valid data yet, so set plot to not draw.
|
||||||
|
this._drawData = false;
|
||||||
|
for (var i=0; i<this.data.length; i++){
|
||||||
|
if (this.data[i][1] != 0) {
|
||||||
|
// we have data, O.K. to draw.
|
||||||
|
this._drawData = true;
|
||||||
|
}
|
||||||
|
stack.push(this.data[i][1]);
|
||||||
|
td.push([this.data[i][0]]);
|
||||||
|
if (i>0) {
|
||||||
|
stack[i] += stack[i-1];
|
||||||
|
}
|
||||||
|
tot += this.data[i][1];
|
||||||
|
}
|
||||||
|
var fact = Math.PI*2/stack[stack.length - 1];
|
||||||
|
|
||||||
|
for (var i=0; i<stack.length; i++) {
|
||||||
|
td[i][1] = stack[i] * fact;
|
||||||
|
td[i][2] = this.data[i][1]/tot;
|
||||||
|
}
|
||||||
|
this.gridData = td;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DonutRenderer.prototype.makeGridData = function(data, plot) {
|
||||||
|
var stack = [];
|
||||||
|
var td = [];
|
||||||
|
var tot = 0;
|
||||||
|
var sa = this.startAngle/180*Math.PI;
|
||||||
|
// don't know if we have any valid data yet, so set plot to not draw.
|
||||||
|
this._drawData = false;
|
||||||
|
for (var i=0; i<data.length; i++){
|
||||||
|
if (this.data[i][1] != 0) {
|
||||||
|
// we have data, O.K. to draw.
|
||||||
|
this._drawData = true;
|
||||||
|
}
|
||||||
|
stack.push(data[i][1]);
|
||||||
|
td.push([data[i][0]]);
|
||||||
|
if (i>0) {
|
||||||
|
stack[i] += stack[i-1];
|
||||||
|
}
|
||||||
|
tot += data[i][1];
|
||||||
|
}
|
||||||
|
var fact = Math.PI*2/stack[stack.length - 1];
|
||||||
|
|
||||||
|
for (var i=0; i<stack.length; i++) {
|
||||||
|
td[i][1] = stack[i] * fact;
|
||||||
|
td[i][2] = data[i][1]/tot;
|
||||||
|
}
|
||||||
|
return td;
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DonutRenderer.prototype.drawSlice = function (ctx, ang1, ang2, color, isShadow) {
|
||||||
|
var r = this._diameter / 2;
|
||||||
|
var ri = r - this._thickness;
|
||||||
|
var fill = this.fill;
|
||||||
|
// var lineWidth = this.lineWidth;
|
||||||
|
ctx.save();
|
||||||
|
ctx.translate(this._center[0], this._center[1]);
|
||||||
|
// ctx.translate(this.sliceMargin*Math.cos((ang1+ang2)/2), this.sliceMargin*Math.sin((ang1+ang2)/2));
|
||||||
|
|
||||||
|
if (isShadow) {
|
||||||
|
for (var i=0; i<this.shadowDepth; i++) {
|
||||||
|
ctx.save();
|
||||||
|
ctx.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI), this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));
|
||||||
|
doDraw();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else {
|
||||||
|
doDraw();
|
||||||
|
}
|
||||||
|
|
||||||
|
function doDraw () {
|
||||||
|
// Fix for IE and Chrome that can't seem to draw circles correctly.
|
||||||
|
// ang2 should always be <= 2 pi since that is the way the data is converted.
|
||||||
|
if (ang2 > 6.282 + this.startAngle) {
|
||||||
|
ang2 = 6.282 + this.startAngle;
|
||||||
|
if (ang1 > ang2) {
|
||||||
|
ang1 = 6.281 + this.startAngle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Fix for IE, where it can't seem to handle 0 degree angles. Also avoids
|
||||||
|
// ugly line on unfilled donuts.
|
||||||
|
if (ang1 >= ang2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
ctx.beginPath();
|
||||||
|
ctx.fillStyle = color;
|
||||||
|
ctx.strokeStyle = color;
|
||||||
|
// ctx.lineWidth = lineWidth;
|
||||||
|
ctx.arc(0, 0, r, ang1, ang2, false);
|
||||||
|
ctx.lineTo(ri*Math.cos(ang2), ri*Math.sin(ang2));
|
||||||
|
ctx.arc(0,0, ri, ang2, ang1, true);
|
||||||
|
ctx.closePath();
|
||||||
|
if (fill) {
|
||||||
|
ctx.fill();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
ctx.stroke();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isShadow) {
|
||||||
|
for (var i=0; i<this.shadowDepth; i++) {
|
||||||
|
ctx.restore();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ctx.restore();
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with scope of series
|
||||||
|
$.jqplot.DonutRenderer.prototype.draw = function (ctx, gd, options, plot) {
|
||||||
|
var i;
|
||||||
|
var opts = (options != undefined) ? options : {};
|
||||||
|
// offset and direction of offset due to legend placement
|
||||||
|
var offx = 0;
|
||||||
|
var offy = 0;
|
||||||
|
var trans = 1;
|
||||||
|
// var colorGenerator = new this.colorGenerator(this.seriesColors);
|
||||||
|
if (options.legendInfo && options.legendInfo.placement == 'insideGrid') {
|
||||||
|
var li = options.legendInfo;
|
||||||
|
switch (li.location) {
|
||||||
|
case 'nw':
|
||||||
|
offx = li.width + li.xoffset;
|
||||||
|
break;
|
||||||
|
case 'w':
|
||||||
|
offx = li.width + li.xoffset;
|
||||||
|
break;
|
||||||
|
case 'sw':
|
||||||
|
offx = li.width + li.xoffset;
|
||||||
|
break;
|
||||||
|
case 'ne':
|
||||||
|
offx = li.width + li.xoffset;
|
||||||
|
trans = -1;
|
||||||
|
break;
|
||||||
|
case 'e':
|
||||||
|
offx = li.width + li.xoffset;
|
||||||
|
trans = -1;
|
||||||
|
break;
|
||||||
|
case 'se':
|
||||||
|
offx = li.width + li.xoffset;
|
||||||
|
trans = -1;
|
||||||
|
break;
|
||||||
|
case 'n':
|
||||||
|
offy = li.height + li.yoffset;
|
||||||
|
break;
|
||||||
|
case 's':
|
||||||
|
offy = li.height + li.yoffset;
|
||||||
|
trans = -1;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var shadow = (opts.shadow != undefined) ? opts.shadow : this.shadow;
|
||||||
|
var showLine = (opts.showLine != undefined) ? opts.showLine : this.showLine;
|
||||||
|
var fill = (opts.fill != undefined) ? opts.fill : this.fill;
|
||||||
|
var cw = ctx.canvas.width;
|
||||||
|
var ch = ctx.canvas.height;
|
||||||
|
var w = cw - offx - 2 * this.padding;
|
||||||
|
var h = ch - offy - 2 * this.padding;
|
||||||
|
var mindim = Math.min(w,h);
|
||||||
|
var d = mindim;
|
||||||
|
var ringmargin = (this.ringMargin == null) ? this.sliceMargin * 2.0 : this.ringMargin;
|
||||||
|
|
||||||
|
for (var i=0; i<this._previousSeries.length; i++) {
|
||||||
|
d -= 2.0 * this._previousSeries[i]._thickness + 2.0 * ringmargin;
|
||||||
|
}
|
||||||
|
this._diameter = this.diameter || d;
|
||||||
|
if (this.innerDiameter != null) {
|
||||||
|
var od = (this._numberSeries > 1 && this.index > 0) ? this._previousSeries[0]._diameter : this._diameter;
|
||||||
|
this._thickness = this.thickness || (od - this.innerDiameter - 2.0*ringmargin*this._numberSeries) / this._numberSeries/2.0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this._thickness = this.thickness || mindim / 2 / (this._numberSeries + 1) * 0.85;
|
||||||
|
}
|
||||||
|
|
||||||
|
var r = this._radius = this._diameter/2;
|
||||||
|
this._innerRadius = this._radius - this._thickness;
|
||||||
|
var sa = this.startAngle / 180 * Math.PI;
|
||||||
|
this._center = [(cw - trans * offx)/2 + trans * offx, (ch - trans*offy)/2 + trans * offy];
|
||||||
|
|
||||||
|
if (this.shadow) {
|
||||||
|
var shadowColor = 'rgba(0,0,0,'+this.shadowAlpha+')';
|
||||||
|
for (var i=0; i<gd.length; i++) {
|
||||||
|
var ang1 = (i == 0) ? sa : gd[i-1][1] + sa;
|
||||||
|
// Adjust ang1 and ang2 for sliceMargin
|
||||||
|
ang1 += this.sliceMargin/180*Math.PI;
|
||||||
|
this.renderer.drawSlice.call (this, ctx, ang1, gd[i][1]+sa, shadowColor, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
for (var i=0; i<gd.length; i++) {
|
||||||
|
var ang1 = (i == 0) ? sa : gd[i-1][1] + sa;
|
||||||
|
// Adjust ang1 and ang2 for sliceMargin
|
||||||
|
ang1 += this.sliceMargin/180*Math.PI;
|
||||||
|
var ang2 = gd[i][1] + sa;
|
||||||
|
this._sliceAngles.push([ang1, ang2]);
|
||||||
|
this.renderer.drawSlice.call (this, ctx, ang1, ang2, this.seriesColors[i], false);
|
||||||
|
|
||||||
|
if (this.showDataLabels && gd[i][2]*100 >= this.dataLabelThreshold) {
|
||||||
|
var fstr, avgang = (ang1+ang2)/2, label;
|
||||||
|
|
||||||
|
if (this.dataLabels == 'label') {
|
||||||
|
fstr = this.dataLabelFormatString || '%s';
|
||||||
|
label = $.jqplot.sprintf(fstr, gd[i][0]);
|
||||||
|
}
|
||||||
|
else if (this.dataLabels == 'value') {
|
||||||
|
fstr = this.dataLabelFormatString || '%d';
|
||||||
|
label = $.jqplot.sprintf(fstr, this.data[i][1]);
|
||||||
|
}
|
||||||
|
else if (this.dataLabels == 'percent') {
|
||||||
|
fstr = this.dataLabelFormatString || '%d%%';
|
||||||
|
label = $.jqplot.sprintf(fstr, gd[i][2]*100);
|
||||||
|
}
|
||||||
|
else if (this.dataLabels.constructor == Array) {
|
||||||
|
fstr = this.dataLabelFormatString || '%s';
|
||||||
|
label = $.jqplot.sprintf(fstr, this.dataLabels[i]);
|
||||||
|
}
|
||||||
|
|
||||||
|
var fact = this._innerRadius + this._thickness * this.dataLabelPositionFactor + this.sliceMargin + this.dataLabelNudge;
|
||||||
|
|
||||||
|
var x = this._center[0] + Math.cos(avgang) * fact + this.canvas._offsets.left;
|
||||||
|
var y = this._center[1] + Math.sin(avgang) * fact + this.canvas._offsets.top;
|
||||||
|
|
||||||
|
var labelelem = $('<span class="jqplot-donut-series jqplot-data-label" style="position:absolute;">' + label + '</span>').insertBefore(plot.eventCanvas._elem);
|
||||||
|
x -= labelelem.width()/2;
|
||||||
|
y -= labelelem.height()/2;
|
||||||
|
x = Math.round(x);
|
||||||
|
y = Math.round(y);
|
||||||
|
labelelem.css({left: x, top: y});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DonutAxisRenderer = function() {
|
||||||
|
$.jqplot.LinearAxisRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DonutAxisRenderer.prototype = new $.jqplot.LinearAxisRenderer();
|
||||||
|
$.jqplot.DonutAxisRenderer.prototype.constructor = $.jqplot.DonutAxisRenderer;
|
||||||
|
|
||||||
|
|
||||||
|
// There are no traditional axes on a donut chart. We just need to provide
|
||||||
|
// dummy objects with properties so the plot will render.
|
||||||
|
// called with scope of axis object.
|
||||||
|
$.jqplot.DonutAxisRenderer.prototype.init = function(options){
|
||||||
|
//
|
||||||
|
this.tickRenderer = $.jqplot.DonutTickRenderer;
|
||||||
|
$.extend(true, this, options);
|
||||||
|
// I don't think I'm going to need _dataBounds here.
|
||||||
|
// have to go Axis scaling in a way to fit chart onto plot area
|
||||||
|
// and provide u2p and p2u functionality for mouse cursor, etc.
|
||||||
|
// for convienence set _dataBounds to 0 and 100 and
|
||||||
|
// set min/max to 0 and 100.
|
||||||
|
this._dataBounds = {min:0, max:100};
|
||||||
|
this.min = 0;
|
||||||
|
this.max = 100;
|
||||||
|
this.showTicks = false;
|
||||||
|
this.ticks = [];
|
||||||
|
this.showMark = false;
|
||||||
|
this.show = false;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
$.jqplot.DonutLegendRenderer = function(){
|
||||||
|
$.jqplot.TableLegendRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DonutLegendRenderer.prototype = new $.jqplot.TableLegendRenderer();
|
||||||
|
$.jqplot.DonutLegendRenderer.prototype.constructor = $.jqplot.DonutLegendRenderer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.DonutLegendRenderer
|
||||||
|
* Legend Renderer specific to donut plots. Set by default
|
||||||
|
* when user creates a donut plot.
|
||||||
|
*/
|
||||||
|
$.jqplot.DonutLegendRenderer.prototype.init = function(options) {
|
||||||
|
// Group: Properties
|
||||||
|
//
|
||||||
|
// prop: numberRows
|
||||||
|
// Maximum number of rows in the legend. 0 or null for unlimited.
|
||||||
|
this.numberRows = null;
|
||||||
|
// prop: numberColumns
|
||||||
|
// Maximum number of columns in the legend. 0 or null for unlimited.
|
||||||
|
this.numberColumns = null;
|
||||||
|
$.extend(true, this, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
// called with context of legend
|
||||||
|
$.jqplot.DonutLegendRenderer.prototype.draw = function() {
|
||||||
|
var legend = this;
|
||||||
|
if (this.show) {
|
||||||
|
var series = this._series;
|
||||||
|
var ss = 'position:absolute;';
|
||||||
|
ss += (this.background) ? 'background:'+this.background+';' : '';
|
||||||
|
ss += (this.border) ? 'border:'+this.border+';' : '';
|
||||||
|
ss += (this.fontSize) ? 'font-size:'+this.fontSize+';' : '';
|
||||||
|
ss += (this.fontFamily) ? 'font-family:'+this.fontFamily+';' : '';
|
||||||
|
ss += (this.textColor) ? 'color:'+this.textColor+';' : '';
|
||||||
|
ss += (this.marginTop != null) ? 'margin-top:'+this.marginTop+';' : '';
|
||||||
|
ss += (this.marginBottom != null) ? 'margin-bottom:'+this.marginBottom+';' : '';
|
||||||
|
ss += (this.marginLeft != null) ? 'margin-left:'+this.marginLeft+';' : '';
|
||||||
|
ss += (this.marginRight != null) ? 'margin-right:'+this.marginRight+';' : '';
|
||||||
|
this._elem = $('<table class="jqplot-table-legend" style="'+ss+'"></table>');
|
||||||
|
// Donut charts legends don't go by number of series, but by number of data points
|
||||||
|
// in the series. Refactor things here for that.
|
||||||
|
|
||||||
|
var pad = false,
|
||||||
|
reverse = false,
|
||||||
|
nr, nc;
|
||||||
|
var s = series[0];
|
||||||
|
var colorGenerator = new $.jqplot.ColorGenerator(s.seriesColors);
|
||||||
|
|
||||||
|
if (s.show) {
|
||||||
|
var pd = s.data;
|
||||||
|
if (this.numberRows) {
|
||||||
|
nr = this.numberRows;
|
||||||
|
if (!this.numberColumns){
|
||||||
|
nc = Math.ceil(pd.length/nr);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
nc = this.numberColumns;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (this.numberColumns) {
|
||||||
|
nc = this.numberColumns;
|
||||||
|
nr = Math.ceil(pd.length/this.numberColumns);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
nr = pd.length;
|
||||||
|
nc = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var i, j, tr, td1, td2, lt, rs, color;
|
||||||
|
var idx = 0;
|
||||||
|
|
||||||
|
for (i=0; i<nr; i++) {
|
||||||
|
if (reverse){
|
||||||
|
tr = $('<tr class="jqplot-table-legend"></tr>').prependTo(this._elem);
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
tr = $('<tr class="jqplot-table-legend"></tr>').appendTo(this._elem);
|
||||||
|
}
|
||||||
|
for (j=0; j<nc; j++) {
|
||||||
|
if (idx < pd.length){
|
||||||
|
lt = this.labels[idx] || pd[idx][0].toString();
|
||||||
|
color = colorGenerator.next();
|
||||||
|
if (!reverse){
|
||||||
|
if (i>0){
|
||||||
|
pad = true;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pad = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
if (i == nr -1){
|
||||||
|
pad = false;
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
pad = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
rs = (pad) ? this.rowSpacing : '0';
|
||||||
|
|
||||||
|
td1 = $('<td class="jqplot-table-legend" style="text-align:center;padding-top:'+rs+';">'+
|
||||||
|
'<div><div class="jqplot-table-legend-swatch" style="border-color:'+color+';"></div>'+
|
||||||
|
'</div></td>');
|
||||||
|
td2 = $('<td class="jqplot-table-legend" style="padding-top:'+rs+';"></td>');
|
||||||
|
if (this.escapeHtml){
|
||||||
|
td2.text(lt);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
td2.html(lt);
|
||||||
|
}
|
||||||
|
if (reverse) {
|
||||||
|
td2.prependTo(tr);
|
||||||
|
td1.prependTo(tr);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
td1.appendTo(tr);
|
||||||
|
td2.appendTo(tr);
|
||||||
|
}
|
||||||
|
pad = true;
|
||||||
|
}
|
||||||
|
idx++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this._elem;
|
||||||
|
};
|
||||||
|
|
||||||
|
// setup default renderers for axes and legend so user doesn't have to
|
||||||
|
// called with scope of plot
|
||||||
|
function preInit(target, data, options) {
|
||||||
|
options = options || {};
|
||||||
|
options.axesDefaults = options.axesDefaults || {};
|
||||||
|
options.legend = options.legend || {};
|
||||||
|
options.seriesDefaults = options.seriesDefaults || {};
|
||||||
|
// only set these if there is a donut series
|
||||||
|
var setopts = false;
|
||||||
|
if (options.seriesDefaults.renderer == $.jqplot.DonutRenderer) {
|
||||||
|
setopts = true;
|
||||||
|
}
|
||||||
|
else if (options.series) {
|
||||||
|
for (var i=0; i < options.series.length; i++) {
|
||||||
|
if (options.series[i].renderer == $.jqplot.DonutRenderer) {
|
||||||
|
setopts = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (setopts) {
|
||||||
|
options.axesDefaults.renderer = $.jqplot.DonutAxisRenderer;
|
||||||
|
options.legend.renderer = $.jqplot.DonutLegendRenderer;
|
||||||
|
options.legend.preDraw = true;
|
||||||
|
options.seriesDefaults.pointLabels = {show: false};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// called with scope of plot.
|
||||||
|
function postInit(target, data, options) {
|
||||||
|
// if multiple series, add a reference to the previous one so that
|
||||||
|
// donut rings can nest.
|
||||||
|
for (var i=1; i<this.series.length; i++) {
|
||||||
|
if (!this.series[i]._previousSeries.length){
|
||||||
|
for (var j=0; j<i; j++) {
|
||||||
|
if (this.series[i].renderer.constructor == $.jqplot.DonutRenderer && this.series[j].renderer.constructor == $.jqplot.DonutRenderer) {
|
||||||
|
this.series[i]._previousSeries.push(this.series[j]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (i=0; i<this.series.length; i++) {
|
||||||
|
if (this.series[i].renderer.constructor == $.jqplot.DonutRenderer) {
|
||||||
|
this.series[i]._numberSeries = this.series.length;
|
||||||
|
// don't allow mouseover and mousedown at same time.
|
||||||
|
if (this.series[i].highlightMouseOver) {
|
||||||
|
this.series[i].highlightMouseDown = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var postParseOptionsRun = false;
|
||||||
|
// called with scope of plot
|
||||||
|
function postParseOptions(options) {
|
||||||
|
for (var i=0; i<this.series.length; i++) {
|
||||||
|
this.series[i].seriesColors = this.seriesColors;
|
||||||
|
this.series[i].colorGenerator = $.jqplot.colorGenerator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function highlight (plot, sidx, pidx) {
|
||||||
|
var s = plot.series[sidx];
|
||||||
|
var canvas = plot.plugins.donutRenderer.highlightCanvas;
|
||||||
|
canvas._ctx.clearRect(0,0,canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
||||||
|
s._highlightedPoint = pidx;
|
||||||
|
plot.plugins.donutRenderer.highlightedSeriesIndex = sidx;
|
||||||
|
s.renderer.drawSlice.call(s, canvas._ctx, s._sliceAngles[pidx][0], s._sliceAngles[pidx][1], s.highlightColors[pidx], false);
|
||||||
|
}
|
||||||
|
|
||||||
|
function unhighlight (plot) {
|
||||||
|
var canvas = plot.plugins.donutRenderer.highlightCanvas;
|
||||||
|
canvas._ctx.clearRect(0,0, canvas._ctx.canvas.width, canvas._ctx.canvas.height);
|
||||||
|
for (var i=0; i<plot.series.length; i++) {
|
||||||
|
plot.series[i]._highlightedPoint = null;
|
||||||
|
}
|
||||||
|
plot.plugins.donutRenderer.highlightedSeriesIndex = null;
|
||||||
|
plot.target.trigger('jqplotDataUnhighlight');
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMove(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||||
|
var evt1 = jQuery.Event('jqplotDataMouseOver');
|
||||||
|
evt1.pageX = ev.pageX;
|
||||||
|
evt1.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt1, ins);
|
||||||
|
if (plot.series[ins[0]].highlightMouseOver && !(ins[0] == plot.plugins.donutRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||||
|
var evt = jQuery.Event('jqplotDataHighlight');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
highlight (plot, ins[0], ins[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neighbor == null) {
|
||||||
|
unhighlight (plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseDown(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||||
|
if (plot.series[ins[0]].highlightMouseDown && !(ins[0] == plot.plugins.donutRenderer.highlightedSeriesIndex && ins[1] == plot.series[ins[0]]._highlightedPoint)) {
|
||||||
|
var evt = jQuery.Event('jqplotDataHighlight');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
highlight (plot, ins[0], ins[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neighbor == null) {
|
||||||
|
unhighlight (plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMouseUp(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
var idx = plot.plugins.donutRenderer.highlightedSeriesIndex;
|
||||||
|
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||||
|
unhighlight(plot);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleClick(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||||
|
var evt = jQuery.Event('jqplotDataClick');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleRightClick(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (neighbor) {
|
||||||
|
var ins = [neighbor.seriesIndex, neighbor.pointIndex, neighbor.data];
|
||||||
|
var idx = plot.plugins.donutRenderer.highlightedSeriesIndex;
|
||||||
|
if (idx != null && plot.series[idx].highlightMouseDown) {
|
||||||
|
unhighlight(plot);
|
||||||
|
}
|
||||||
|
var evt = jQuery.Event('jqplotDataRightClick');
|
||||||
|
evt.which = ev.which;
|
||||||
|
evt.pageX = ev.pageX;
|
||||||
|
evt.pageY = ev.pageY;
|
||||||
|
plot.target.trigger(evt, ins);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// called within context of plot
|
||||||
|
// create a canvas which we can draw on.
|
||||||
|
// insert it before the eventCanvas, so eventCanvas will still capture events.
|
||||||
|
function postPlotDraw() {
|
||||||
|
// Memory Leaks patch
|
||||||
|
if (this.plugins.donutRenderer && this.plugins.donutRenderer.highlightCanvas) {
|
||||||
|
this.plugins.donutRenderer.highlightCanvas.resetCanvas();
|
||||||
|
this.plugins.donutRenderer.highlightCanvas = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugins.donutRenderer = {highlightedSeriesIndex:null};
|
||||||
|
this.plugins.donutRenderer.highlightCanvas = new $.jqplot.GenericCanvas();
|
||||||
|
// do we have any data labels? if so, put highlight canvas before those
|
||||||
|
// Fix for broken jquery :first selector with canvas (VML) elements.
|
||||||
|
var labels = $(this.targetId+' .jqplot-data-label');
|
||||||
|
if (labels.length) {
|
||||||
|
$(labels[0]).before(this.plugins.donutRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-donutRenderer-highlight-canvas', this._plotDimensions, this));
|
||||||
|
}
|
||||||
|
// else put highlight canvas before event canvas.
|
||||||
|
else {
|
||||||
|
this.eventCanvas._elem.before(this.plugins.donutRenderer.highlightCanvas.createElement(this._gridPadding, 'jqplot-donutRenderer-highlight-canvas', this._plotDimensions, this));
|
||||||
|
}
|
||||||
|
var hctx = this.plugins.donutRenderer.highlightCanvas.setContext();
|
||||||
|
this.eventCanvas._elem.bind('mouseleave', {plot:this}, function (ev) { unhighlight(ev.data.plot); });
|
||||||
|
}
|
||||||
|
|
||||||
|
$.jqplot.preInitHooks.push(preInit);
|
||||||
|
|
||||||
|
$.jqplot.DonutTickRenderer = function() {
|
||||||
|
$.jqplot.AxisTickRenderer.call(this);
|
||||||
|
};
|
||||||
|
|
||||||
|
$.jqplot.DonutTickRenderer.prototype = new $.jqplot.AxisTickRenderer();
|
||||||
|
$.jqplot.DonutTickRenderer.prototype.constructor = $.jqplot.DonutTickRenderer;
|
||||||
|
|
||||||
|
})(jQuery);
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
/* jqPlot 1.0.8r1250 | (c) 2009-2013 Chris Leonello | jplot.com
|
||||||
|
jsDate | (c) 2010-2013 Chris Leonello
|
||||||
|
*/(function(e){e.jqplot.DonutRenderer=function(){e.jqplot.LineRenderer.call(this)};e.jqplot.DonutRenderer.prototype=new e.jqplot.LineRenderer();e.jqplot.DonutRenderer.prototype.constructor=e.jqplot.DonutRenderer;e.jqplot.DonutRenderer.prototype.init=function(p,t){this.diameter=null;this.innerDiameter=null;this.thickness=null;this.padding=20;this.sliceMargin=0;this.ringMargin=null;this.fill=true;this.shadowOffset=2;this.shadowAlpha=0.07;this.shadowDepth=5;this.highlightMouseOver=true;this.highlightMouseDown=false;this.highlightColors=[];this.dataLabels="percent";this.showDataLabels=false;this.dataLabelFormatString=null;this.dataLabelThreshold=3;this.dataLabelPositionFactor=0.4;this.dataLabelNudge=0;this.startAngle=0;this.tickRenderer=e.jqplot.DonutTickRenderer;this._drawData=true;this._type="donut";if(p.highlightMouseDown&&p.highlightMouseOver==null){p.highlightMouseOver=false}e.extend(true,this,p);if(this.diameter!=null){this.diameter=this.diameter-this.sliceMargin}this._diameter=null;this._innerDiameter=null;this._radius=null;this._innerRadius=null;this._thickness=null;this._previousSeries=[];this._numberSeries=1;this._sliceAngles=[];this._highlightedPoint=null;if(this.highlightColors.length==0){for(var r=0;r<this.seriesColors.length;r++){var q=e.jqplot.getColorComponents(this.seriesColors[r]);var n=[q[0],q[1],q[2]];var s=n[0]+n[1]+n[2];for(var o=0;o<3;o++){n[o]=(s>570)?n[o]*0.8:n[o]+0.3*(255-n[o]);n[o]=parseInt(n[o],10)}this.highlightColors.push("rgb("+n[0]+","+n[1]+","+n[2]+")")}}t.postParseOptionsHooks.addOnce(l);t.postInitHooks.addOnce(g);t.eventListenerHooks.addOnce("jqplotMouseMove",b);t.eventListenerHooks.addOnce("jqplotMouseDown",a);t.eventListenerHooks.addOnce("jqplotMouseUp",j);t.eventListenerHooks.addOnce("jqplotClick",f);t.eventListenerHooks.addOnce("jqplotRightClick",m);t.postDrawHooks.addOnce(h)};e.jqplot.DonutRenderer.prototype.setGridData=function(s){var o=[];var t=[];var n=this.startAngle/180*Math.PI;var r=0;this._drawData=false;for(var q=0;q<this.data.length;q++){if(this.data[q][1]!=0){this._drawData=true}o.push(this.data[q][1]);t.push([this.data[q][0]]);if(q>0){o[q]+=o[q-1]}r+=this.data[q][1]}var p=Math.PI*2/o[o.length-1];for(var q=0;q<o.length;q++){t[q][1]=o[q]*p;t[q][2]=this.data[q][1]/r}this.gridData=t};e.jqplot.DonutRenderer.prototype.makeGridData=function(s,t){var o=[];var u=[];var r=0;var n=this.startAngle/180*Math.PI;this._drawData=false;for(var q=0;q<s.length;q++){if(this.data[q][1]!=0){this._drawData=true}o.push(s[q][1]);u.push([s[q][0]]);if(q>0){o[q]+=o[q-1]}r+=s[q][1]}var p=Math.PI*2/o[o.length-1];for(var q=0;q<o.length;q++){u[q][1]=o[q]*p;u[q][2]=s[q][1]/r}return u};e.jqplot.DonutRenderer.prototype.drawSlice=function(x,u,t,p,s){var n=this._diameter/2;var v=n-this._thickness;var w=this.fill;x.save();x.translate(this._center[0],this._center[1]);if(s){for(var q=0;q<this.shadowDepth;q++){x.save();x.translate(this.shadowOffset*Math.cos(this.shadowAngle/180*Math.PI),this.shadowOffset*Math.sin(this.shadowAngle/180*Math.PI));o()}}else{o()}function o(){if(t>6.282+this.startAngle){t=6.282+this.startAngle;if(u>t){u=6.281+this.startAngle}}if(u>=t){return}x.beginPath();x.fillStyle=p;x.strokeStyle=p;x.arc(0,0,n,u,t,false);x.lineTo(v*Math.cos(t),v*Math.sin(t));x.arc(0,0,v,t,u,true);x.closePath();if(w){x.fill()}else{x.stroke()}}if(s){for(var q=0;q<this.shadowDepth;q++){x.restore()}}x.restore()};e.jqplot.DonutRenderer.prototype.draw=function(N,V,t,P){var Q;var J=(t!=undefined)?t:{};var q=0;var p=0;var u=1;if(t.legendInfo&&t.legendInfo.placement=="insideGrid"){var I=t.legendInfo;switch(I.location){case"nw":q=I.width+I.xoffset;break;case"w":q=I.width+I.xoffset;break;case"sw":q=I.width+I.xoffset;break;case"ne":q=I.width+I.xoffset;u=-1;break;case"e":q=I.width+I.xoffset;u=-1;break;case"se":q=I.width+I.xoffset;u=-1;break;case"n":p=I.height+I.yoffset;break;case"s":p=I.height+I.yoffset;u=-1;break;default:break}}var B=(J.shadow!=undefined)?J.shadow:this.shadow;var W=(J.showLine!=undefined)?J.showLine:this.showLine;var O=(J.fill!=undefined)?J.fill:this.fill;var s=N.canvas.width;var H=N.canvas.height;var G=s-q-2*this.padding;var R=H-p-2*this.padding;var v=Math.min(G,R);var T=v;var X=(this.ringMargin==null)?this.sliceMargin*2:this.ringMargin;for(var Q=0;Q<this._previousSeries.length;Q++){T-=2*this._previousSeries[Q]._thickness+2*X}this._diameter=this.diameter||T;if(this.innerDiameter!=null){var M=(this._numberSeries>1&&this.index>0)?this._previousSeries[0]._diameter:this._diameter;this._thickness=this.thickness||(M-this.innerDiameter-2*X*this._numberSeries)/this._numberSeries/2}else{this._thickness=this.thickness||v/2/(this._numberSeries+1)*0.85}var K=this._radius=this._diameter/2;this._innerRadius=this._radius-this._thickness;var o=this.startAngle/180*Math.PI;this._center=[(s-u*q)/2+u*q,(H-u*p)/2+u*p];if(this.shadow){var L="rgba(0,0,0,"+this.shadowAlpha+")";for(var Q=0;Q<V.length;Q++){var A=(Q==0)?o:V[Q-1][1]+o;A+=this.sliceMargin/180*Math.PI;this.renderer.drawSlice.call(this,N,A,V[Q][1]+o,L,true)}}foLine truncated
|
||||||
@@ -0,0 +1,225 @@
|
|||||||
|
/**
|
||||||
|
* jqPlot
|
||||||
|
* Pure JavaScript plotting plugin using jQuery
|
||||||
|
*
|
||||||
|
* Version: 1.0.8
|
||||||
|
* Revision: 1250
|
||||||
|
*
|
||||||
|
* Copyright (c) 2009-2013 Chris Leonello
|
||||||
|
* jqPlot is currently available for use in all personal or commercial projects
|
||||||
|
* under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL
|
||||||
|
* version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can
|
||||||
|
* choose the license that best suits your project and use it accordingly.
|
||||||
|
*
|
||||||
|
* Although not required, the author would appreciate an email letting him
|
||||||
|
* know of any substantial use of jqPlot. You can reach the author at:
|
||||||
|
* chris at jqplot dot com or see http://www.jqplot.com/info.php .
|
||||||
|
*
|
||||||
|
* If you are feeling kind and generous, consider supporting the project by
|
||||||
|
* making a donation at: http://www.jqplot.com/donate.php .
|
||||||
|
*
|
||||||
|
* sprintf functions contained in jqplot.sprintf.js by Ash Searle:
|
||||||
|
*
|
||||||
|
* version 2007.04.27
|
||||||
|
* author Ash Searle
|
||||||
|
* http://hexmen.com/blog/2007/03/printf-sprintf/
|
||||||
|
* http://hexmen.com/js/sprintf.js
|
||||||
|
* The author (Ash Searle) has placed this code in the public domain:
|
||||||
|
* "This code is unrestricted: you are free to use it however you like."
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
(function($) {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class: $.jqplot.Dragable
|
||||||
|
* Plugin to make plotted points dragable by the user.
|
||||||
|
*/
|
||||||
|
$.jqplot.Dragable = function(options) {
|
||||||
|
// Group: Properties
|
||||||
|
this.markerRenderer = new $.jqplot.MarkerRenderer({shadow:false});
|
||||||
|
this.shapeRenderer = new $.jqplot.ShapeRenderer();
|
||||||
|
this.isDragging = false;
|
||||||
|
this.isOver = false;
|
||||||
|
this._ctx;
|
||||||
|
this._elem;
|
||||||
|
this._point;
|
||||||
|
this._gridData;
|
||||||
|
// prop: color
|
||||||
|
// CSS color spec for the dragged point (and adjacent line segment or bar).
|
||||||
|
this.color;
|
||||||
|
// prop: constrainTo
|
||||||
|
// Constrain dragging motion to an axis or to none.
|
||||||
|
// Allowable values are 'none', 'x', 'y'
|
||||||
|
this.constrainTo = 'none'; // 'x', 'y', or 'none';
|
||||||
|
$.extend(true, this, options);
|
||||||
|
};
|
||||||
|
|
||||||
|
function DragCanvas() {
|
||||||
|
$.jqplot.GenericCanvas.call(this);
|
||||||
|
this.isDragging = false;
|
||||||
|
this.isOver = false;
|
||||||
|
this._neighbor;
|
||||||
|
this._cursors = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
DragCanvas.prototype = new $.jqplot.GenericCanvas();
|
||||||
|
DragCanvas.prototype.constructor = DragCanvas;
|
||||||
|
|
||||||
|
|
||||||
|
// called within scope of series
|
||||||
|
$.jqplot.Dragable.parseOptions = function (defaults, opts) {
|
||||||
|
var options = opts || {};
|
||||||
|
this.plugins.dragable = new $.jqplot.Dragable(options.dragable);
|
||||||
|
// since this function is called before series options are parsed,
|
||||||
|
// we can set this here and it will be overridden if needed.
|
||||||
|
this.isDragable = $.jqplot.config.enablePlugins;
|
||||||
|
};
|
||||||
|
|
||||||
|
// called within context of plot
|
||||||
|
// create a canvas which we can draw on.
|
||||||
|
// insert it before the eventCanvas, so eventCanvas will still capture events.
|
||||||
|
// add a new DragCanvas object to the plot plugins to handle drawing on this new canvas.
|
||||||
|
$.jqplot.Dragable.postPlotDraw = function() {
|
||||||
|
// Memory Leaks patch
|
||||||
|
if (this.plugins.dragable && this.plugins.dragable.highlightCanvas) {
|
||||||
|
this.plugins.dragable.highlightCanvas.resetCanvas();
|
||||||
|
this.plugins.dragable.highlightCanvas = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.plugins.dragable = {previousCursor:'auto', isOver:false};
|
||||||
|
this.plugins.dragable.dragCanvas = new DragCanvas();
|
||||||
|
|
||||||
|
this.eventCanvas._elem.before(this.plugins.dragable.dragCanvas.createElement(this._gridPadding, 'jqplot-dragable-canvas', this._plotDimensions, this));
|
||||||
|
var dctx = this.plugins.dragable.dragCanvas.setContext();
|
||||||
|
};
|
||||||
|
|
||||||
|
//$.jqplot.preInitHooks.push($.jqplot.Dragable.init);
|
||||||
|
$.jqplot.preParseSeriesOptionsHooks.push($.jqplot.Dragable.parseOptions);
|
||||||
|
$.jqplot.postDrawHooks.push($.jqplot.Dragable.postPlotDraw);
|
||||||
|
$.jqplot.eventListenerHooks.push(['jqplotMouseMove', handleMove]);
|
||||||
|
$.jqplot.eventListenerHooks.push(['jqplotMouseDown', handleDown]);
|
||||||
|
$.jqplot.eventListenerHooks.push(['jqplotMouseUp', handleUp]);
|
||||||
|
|
||||||
|
|
||||||
|
function initDragPoint(plot, neighbor) {
|
||||||
|
var s = plot.series[neighbor.seriesIndex];
|
||||||
|
var drag = s.plugins.dragable;
|
||||||
|
|
||||||
|
// first, init the mark renderer for the dragged point
|
||||||
|
var smr = s.markerRenderer;
|
||||||
|
var mr = drag.markerRenderer;
|
||||||
|
mr.style = smr.style;
|
||||||
|
mr.lineWidth = smr.lineWidth + 2.5;
|
||||||
|
mr.size = smr.size + 5;
|
||||||
|
if (!drag.color) {
|
||||||
|
var rgba = $.jqplot.getColorComponents(smr.color);
|
||||||
|
var newrgb = [rgba[0], rgba[1], rgba[2]];
|
||||||
|
var alpha = (rgba[3] >= 0.6) ? rgba[3]*0.6 : rgba[3]*(2-rgba[3]);
|
||||||
|
drag.color = 'rgba('+newrgb[0]+','+newrgb[1]+','+newrgb[2]+','+alpha+')';
|
||||||
|
}
|
||||||
|
mr.color = drag.color;
|
||||||
|
mr.init();
|
||||||
|
|
||||||
|
var start = (neighbor.pointIndex > 0) ? neighbor.pointIndex - 1 : 0;
|
||||||
|
var end = neighbor.pointIndex+2;
|
||||||
|
drag._gridData = s.gridData.slice(start, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleMove(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (plot.plugins.dragable.dragCanvas.isDragging) {
|
||||||
|
var dc = plot.plugins.dragable.dragCanvas;
|
||||||
|
var dp = dc._neighbor;
|
||||||
|
var s = plot.series[dp.seriesIndex];
|
||||||
|
var drag = s.plugins.dragable;
|
||||||
|
var gd = s.gridData;
|
||||||
|
|
||||||
|
// compute the new grid position with any constraints.
|
||||||
|
var x = (drag.constrainTo == 'y') ? dp.gridData[0] : gridpos.x;
|
||||||
|
var y = (drag.constrainTo == 'x') ? dp.gridData[1] : gridpos.y;
|
||||||
|
|
||||||
|
// compute data values for any listeners.
|
||||||
|
var xu = s._xaxis.series_p2u(x);
|
||||||
|
var yu = s._yaxis.series_p2u(y);
|
||||||
|
|
||||||
|
// clear the canvas then redraw effect at new position.
|
||||||
|
var ctx = dc._ctx;
|
||||||
|
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||||
|
|
||||||
|
// adjust our gridData for the new mouse position
|
||||||
|
if (dp.pointIndex > 0) {
|
||||||
|
drag._gridData[1] = [x, y];
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
drag._gridData[0] = [x, y];
|
||||||
|
}
|
||||||
|
plot.series[dp.seriesIndex].draw(dc._ctx, {gridData:drag._gridData, shadow:false, preventJqPlotSeriesDrawTrigger:true, color:drag.color, markerOptions:{color:drag.color, shadow:false}, trendline:{show:false}});
|
||||||
|
plot.target.trigger('jqplotSeriesPointChange', [dp.seriesIndex, dp.pointIndex, [xu,yu], [x,y]]);
|
||||||
|
}
|
||||||
|
else if (neighbor != null) {
|
||||||
|
var series = plot.series[neighbor.seriesIndex];
|
||||||
|
if (series.isDragable) {
|
||||||
|
var dc = plot.plugins.dragable.dragCanvas;
|
||||||
|
if (!dc.isOver) {
|
||||||
|
dc._cursors.push(ev.target.style.cursor);
|
||||||
|
ev.target.style.cursor = "pointer";
|
||||||
|
}
|
||||||
|
dc.isOver = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (neighbor == null) {
|
||||||
|
var dc = plot.plugins.dragable.dragCanvas;
|
||||||
|
if (dc.isOver) {
|
||||||
|
ev.target.style.cursor = dc._cursors.pop();
|
||||||
|
dc.isOver = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleDown(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
var dc = plot.plugins.dragable.dragCanvas;
|
||||||
|
dc._cursors.push(ev.target.style.cursor);
|
||||||
|
if (neighbor != null) {
|
||||||
|
var s = plot.series[neighbor.seriesIndex];
|
||||||
|
var drag = s.plugins.dragable;
|
||||||
|
if (s.isDragable && !dc.isDragging) {
|
||||||
|
dc._neighbor = neighbor;
|
||||||
|
dc.isDragging = true;
|
||||||
|
initDragPoint(plot, neighbor);
|
||||||
|
drag.markerRenderer.draw(s.gridData[neighbor.pointIndex][0], s.gridData[neighbor.pointIndex][1], dc._ctx);
|
||||||
|
ev.target.style.cursor = "move";
|
||||||
|
plot.target.trigger('jqplotDragStart', [neighbor.seriesIndex, neighbor.pointIndex, gridpos, datapos]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Just in case of a hickup, we'll clear the drag canvas and reset.
|
||||||
|
else {
|
||||||
|
var ctx = dc._ctx;
|
||||||
|
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||||
|
dc.isDragging = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function handleUp(ev, gridpos, datapos, neighbor, plot) {
|
||||||
|
if (plot.plugins.dragable.dragCanvas.isDragging) {
|
||||||
|
var dc = plot.plugins.dragable.dragCanvas;
|
||||||
|
// clear the canvas
|
||||||
|
var ctx = dc._ctx;
|
||||||
|
ctx.clearRect(0, 0, ctx.canvas.width, ctx.canvas.height);
|
||||||
|
dc.isDragging = false;
|
||||||
|
// redraw the series canvas at the new point.
|
||||||
|
var dp = dc._neighbor;
|
||||||
|
var s = plot.series[dp.seriesIndex];
|
||||||
|
var drag = s.plugins.dragable;
|
||||||
|
// compute the new grid position with any constraints.
|
||||||
|
var x = (drag.constrainTo == 'y') ? dp.data[0] : datapos[s.xaxis];
|
||||||
|
var y = (drag.constrainTo == 'x') ? dp.data[1] : datapos[s.yaxis];
|
||||||
|
// var x = datapos[s.xaxis];
|
||||||
|
// var y = datapos[s.yaxis];
|
||||||
|
s.data[dp.pointIndex][0] = x;
|
||||||
|
s.data[dp.pointIndex][1] = y;
|
||||||
|
plot.drawSeries({preventJqPlotSeriesDrawTrigger:true}, dp.seriesIndex);
|
||||||
|
dc._neighbor = null;
|
||||||
|
ev.target.style.cursor = dc._cursors.pop();
|
||||||
|
plot.target.trigger('jqplotDragStop', [gridpos, datapos]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})(jQuery);
|
||||||
Loaded 100 of 362 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user