|
@@ -21,18 +21,20 @@
|
|
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
<script type="text/javascript">
|
|
- function randomColor() {
|
|
|
|
- return '#' + Math.floor(
|
|
|
|
- (
|
|
|
|
- Math.random() * (1 - 0.3) + 0.3
|
|
|
|
- ) * 0xffffff
|
|
|
|
- ).toString(16)
|
|
|
|
|
|
+ function getRandomColorPair() {
|
|
|
|
+ const colorR = Math.floor(Math.random() * (220 - 50) + 50)
|
|
|
|
+ const colorG = Math.floor(Math.random() * (220 - 50) + 50)
|
|
|
|
+ const colorB = Math.floor(Math.random() * (220 - 50) + 50)
|
|
|
|
+ const colorDiff = Math.floor(Math.random() * ((255 - 220) - 20) + 20)
|
|
|
|
+ return [
|
|
|
|
+ `rgb(${colorR}, ${colorG}, ${colorB})`,
|
|
|
|
+ `rgb(${colorR + colorDiff}, ${colorG + colorDiff}, ${colorB + colorDiff})`
|
|
|
|
+ ]
|
|
}
|
|
}
|
|
|
|
|
|
const rawInfo = [
|
|
const rawInfo = [
|
|
{
|
|
{
|
|
name: '开埠通商',
|
|
name: '开埠通商',
|
|
- color: randomColor(),
|
|
|
|
corpList: [
|
|
corpList: [
|
|
// {
|
|
// {
|
|
// companyName: "正泰橡皮物品制造厂",
|
|
// companyName: "正泰橡皮物品制造厂",
|
|
@@ -55,48 +57,68 @@
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: '曲折发展',
|
|
name: '曲折发展',
|
|
- color: randomColor(),
|
|
|
|
corpList: [],
|
|
corpList: [],
|
|
id: 'time-1'
|
|
id: 'time-1'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: '步履维艰',
|
|
name: '步履维艰',
|
|
- color: randomColor(),
|
|
|
|
corpList: [],
|
|
corpList: [],
|
|
id: 'time-2'
|
|
id: 'time-2'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: '筚路蓝缕',
|
|
name: '筚路蓝缕',
|
|
- color: randomColor(),
|
|
|
|
corpList: [],
|
|
corpList: [],
|
|
id: 'time-3'
|
|
id: 'time-3'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: '改革开放',
|
|
name: '改革开放',
|
|
- color: randomColor(),
|
|
|
|
corpList: [],
|
|
corpList: [],
|
|
id: 'time-4'
|
|
id: 'time-4'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: '战略负重',
|
|
name: '战略负重',
|
|
- color: randomColor(),
|
|
|
|
corpList: [],
|
|
corpList: [],
|
|
id: 'time-5'
|
|
id: 'time-5'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: '创新驱动',
|
|
name: '创新驱动',
|
|
- color: randomColor(),
|
|
|
|
corpList: [],
|
|
corpList: [],
|
|
id: 'time-6'
|
|
id: 'time-6'
|
|
},
|
|
},
|
|
{
|
|
{
|
|
name: '追梦未来',
|
|
name: '追梦未来',
|
|
- color: randomColor(),
|
|
|
|
corpList: [],
|
|
corpList: [],
|
|
id: 'time-7'
|
|
id: 'time-7'
|
|
},
|
|
},
|
|
]
|
|
]
|
|
|
|
|
|
|
|
+ for (const iterator of rawInfo) {
|
|
|
|
+ const [color1, color2] = getRandomColorPair()
|
|
|
|
+ console.log(color1);
|
|
|
|
+ console.log(color2);
|
|
|
|
+ iterator.color = {
|
|
|
|
+ type: "radial",
|
|
|
|
+ x: 0.5,
|
|
|
|
+ y: 0.5,
|
|
|
|
+ r: 0.5,
|
|
|
|
+ colorStops: [
|
|
|
|
+ {
|
|
|
|
+ offset: 0,
|
|
|
|
+ color: color1
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ offset: 0.4,
|
|
|
|
+ color: color1
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ offset: 1,
|
|
|
|
+ color: color2
|
|
|
|
+ },
|
|
|
|
+ ],
|
|
|
|
+ global: false
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
const nodesForRender = [
|
|
const nodesForRender = [
|
|
{
|
|
{
|
|
name: "历史回顾",
|
|
name: "历史回顾",
|
|
@@ -176,7 +198,7 @@
|
|
category: null,
|
|
category: null,
|
|
lineStyle: {
|
|
lineStyle: {
|
|
normal: {
|
|
normal: {
|
|
- color: timeInfoItem.color,
|
|
|
|
|
|
+ color: timeInfoItem.color.colorStops[2].color,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
source: '历史回顾',
|
|
source: '历史回顾',
|
|
@@ -190,15 +212,15 @@
|
|
category: timeInfoItem.name,
|
|
category: timeInfoItem.name,
|
|
symbolSize: 10,
|
|
symbolSize: 10,
|
|
itemStyle: {
|
|
itemStyle: {
|
|
- borderColor: timeInfoItem.color,
|
|
|
|
|
|
+ borderColor: timeInfoItem.color.colorStops[2].color,
|
|
color: 'transparent',
|
|
color: 'transparent',
|
|
shadowColor: "rgba(255, 255, 255, 0.5)",
|
|
shadowColor: "rgba(255, 255, 255, 0.5)",
|
|
shadowBlur: 10
|
|
shadowBlur: 10
|
|
},
|
|
},
|
|
select: {
|
|
select: {
|
|
itemStyle: {
|
|
itemStyle: {
|
|
- borderColor: timeInfoItem.color,
|
|
|
|
- color: timeInfoItem.color,
|
|
|
|
|
|
+ borderColor: timeInfoItem.color.colorStops[2].color,
|
|
|
|
+ color: timeInfoItem.color.colorStops[2].color,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
label: {
|
|
label: {
|
|
@@ -212,7 +234,7 @@
|
|
category: timeInfoItem.name,
|
|
category: timeInfoItem.name,
|
|
lineStyle: {
|
|
lineStyle: {
|
|
normal: {
|
|
normal: {
|
|
- color: timeInfoItem.color,
|
|
|
|
|
|
+ color: timeInfoItem.color.colorStops[2].color,
|
|
},
|
|
},
|
|
},
|
|
},
|
|
source: timeInfoItem.name,
|
|
source: timeInfoItem.name,
|