Skip to content

Commit

Permalink
color_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
daizeyao committed Mar 29, 2024
1 parent 4f6e547 commit db3a762
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
12 changes: 9 additions & 3 deletions web/OJ/study_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
///////////////////////////////////////////////////////////////////////////////cs

//此处修改层次颜色
$pointcolor = ['#e5e5e5', '#d0f0c0', '#aadf8f', '#85c96e'];

$neednum = array();
$neednum = array_fill_keys($studytags, [0, 1, 2, 4]);
Expand Down Expand Up @@ -72,15 +71,22 @@
$nowcolor = array();

foreach ($studytags as $tag) {
$ancestor = $tag;
while (isset($tagfa[$ancestor])) {
$ancestor = $tagfa[$ancestor];
}

//找到祖先节点
$index = array_search($ancestor, $studytags1);

for ($i = 3; $i >= 0; $i--) {
if ($studydata[$tag] >= $neednum[$tag][$i]) {
$nowcolor[$tag] = $pointcolor[$i];
$nowcolor[$tag] = $pointcolor[$index][$i];
break;
}
}
}


/////////////////////////Template
require("template/" . $OJ_TEMPLATE . "/study_detail.php");
/////////////////////////Common foot
Expand Down
23 changes: 17 additions & 6 deletions web/OJ/study_detail_data.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@
$studytags1 = [
'HelloWorld!', '基础数据类型', '运算符', '控制结构', '函数', '指针', '结构体', '数组'
];
$pointcolor =[
['#e5e5e5', '#C5E0B4', '#A9D18E', '#548235'],
['#e5e5e5', '#BDD7EE', '#9DC3E6', '#2E75B6'],
['#e5e5e5', '#F8CBAD', '#F4B183', '#C55A11'],
['#e5e5e5', '#ffe5bc', '#ffc973', '#fa9a00'],
['#e5e5e5', '#f0b4ae', '#f0938a', '#f87f74'],
['#e5e5e5', '#d3a2ea', '#c27fe1', '#874aa3'],
['#e5e5e5', '#f2bee4', '#e696d0', '#ea7ccc'],
['#e5e5e5', '#cdb7a4', '#CAA789', '#cd9463'],
];

$studytags2 = [
'基础输入输出', '转义字符', '整型', '浮点型', '字符型', '算术运算', '逻辑运算', '二进制运算',
'函数指针', '指针数组', '指针基础', '结构体数组', '结构体基础', '递归函数', '内置函数', '自定义函数', '函数基础',
Expand Down Expand Up @@ -66,14 +77,14 @@
'HelloWorld!' => ['x' => 200, 'y' => 480],
'基础数据类型' => ['x' => 403, 'y' => 430],
'运算符' => ['x' => 530, 'y' => 225],
'控制结构' => ['x' => 520, 'y' => 600],
'控制结构' => ['x' => 480, 'y' => 600],
'函数' => ['x' => 740, 'y' => 640],
'指针' => ['x' => 693, 'y' => 257],
'结构体' => ['x' => 803, 'y' => 365],
'数组' => ['x' => 780, 'y' => 515],

'基础输入输出' => ['x' => 343, 'y' => 590],
'转义字符' => ['x' => 308, 'y' => 670],
'基础输入输出' => ['x' => 303, 'y' => 570],
'转义字符' => ['x' => 288, 'y' => 680],

'整型' => ['x' => 285, 'y' => 270],
'浮点型' => ['x' => 321, 'y' => 200],
Expand Down Expand Up @@ -106,7 +117,7 @@
'选择结构' => ['x' => 448, 'y' => 743],
'循环结构' => ['x' => 523, 'y' => 735],

'科学计算' => ['x' => 280, 'y' => 770],
'科学计算' => ['x' => 280, 'y' => 800],
'单分支' => ['x' => 366, 'y' => 843],
'多分支' => ['x' => 414, 'y' => 850],
'多重循环' => ['x' => 488, 'y' => 850],
Expand Down Expand Up @@ -411,7 +422,7 @@
opacity: 0.9,
width: 2.5,
curveness: 0.1,
color: '#31b6f9'
color: '#5d716a'
},
symbol: ['circle', 'arrow']
};
Expand All @@ -422,4 +433,4 @@
Object.assign(links[i], additionalProperties);
}
}
</script>
</script>
18 changes: 12 additions & 6 deletions web/OJ/template/hznu/study_detail.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,12 @@
roam: false,
label: {
show: true,
fontSize: 10
fontSize: 10,
// color: '#ffffff',
// textBorderType: "solid",
// textBorderWidth: 0.5,
// textBorderColor: "#A9D18E",
// textBorderDashOffset:10
},
edgeSymbolSize: [0, 10],
edgeLabel: {
Expand All @@ -115,22 +120,22 @@
categories: [{
name: 'Newbie',
itemStyle: {
color: '<?php echo $pointcolor[0]; ?>',
color: '<?php echo $pointcolor[0][0]; ?>',
}
}, {
name: 'Learner',
itemStyle: {
color: '<?php echo $pointcolor[1]; ?>',
color: '<?php echo $pointcolor[0][1]; ?>',
}
}, {
name: 'Expert',
itemStyle: {
color: '<?php echo $pointcolor[2]; ?>',
color: '<?php echo $pointcolor[0][2]; ?>',
}
}, {
name: 'Master',
itemStyle: {
color: '<?php echo $pointcolor[3]; ?>',
color: '<?php echo $pointcolor[0][3]; ?>',
}
}],
data: updatedData,
Expand All @@ -139,7 +144,7 @@
opacity: 0.9,
width: 2,
curveness: 0.1,
color: '#ffbc61'
color: '#bdcec8'
}
}, ]
};
Expand Down Expand Up @@ -217,4 +222,5 @@
});
}
});
window.addEventListener('resize', myChart.resize);
</script>

0 comments on commit db3a762

Please sign in to comment.