|
@@ -1,3 +1,7 @@
|
|
|
+export function getTheme() {
|
|
|
+ // ("zen" | "hack" | "concrete" | "")
|
|
|
+ return localStorage.isDark ? 'hack' : ''
|
|
|
+}
|
|
|
|
|
|
export function getLineData({ xAxis = [] as any[], datas = [] as number[][], legend = [] as string[], suffix = '', width = 1000, height = 400 }) {
|
|
|
const colors = ['#6376DD', '#FBBB04']
|
|
@@ -7,11 +11,10 @@ export function getLineData({ xAxis = [] as any[], datas = [] as number[][], leg
|
|
|
const radio = 10 ** (maxVal.toString().length - 2)
|
|
|
const max = Math.ceil(maxVal * 1.4 / radio) * radio
|
|
|
const config = {
|
|
|
+ theme: getTheme(),
|
|
|
"chart": {
|
|
|
"fontFamily": "inherit",
|
|
|
"paddingTop": 0,
|
|
|
- "backgroundColor": "transparent",
|
|
|
- "color": "#888888",
|
|
|
height,
|
|
|
width,
|
|
|
"zoom": {
|
|
@@ -27,7 +30,6 @@ export function getLineData({ xAxis = [] as any[], datas = [] as number[][], leg
|
|
|
"position": "start",
|
|
|
"labels": {
|
|
|
"show": true,
|
|
|
- "color": "#888888",
|
|
|
"fontSize": 12,
|
|
|
"axis": {
|
|
|
"fontSize": 12
|
|
@@ -39,7 +41,6 @@ export function getLineData({ xAxis = [] as any[], datas = [] as number[][], leg
|
|
|
},
|
|
|
"xAxisLabels": {
|
|
|
"show": true,
|
|
|
- "color": "#888888",
|
|
|
"values": xAxis,
|
|
|
"fontSize": 12,
|
|
|
"showOnlyFirstAndLast": false,
|
|
@@ -54,7 +55,6 @@ export function getLineData({ xAxis = [] as any[], datas = [] as number[][], leg
|
|
|
},
|
|
|
"legend": {
|
|
|
"show": legend.length > 1,
|
|
|
- "color": "#888888",
|
|
|
"fontSize": 12
|
|
|
},
|
|
|
"title": {
|
|
@@ -69,8 +69,7 @@ export function getLineData({ xAxis = [] as any[], datas = [] as number[][], leg
|
|
|
"radius": 3,
|
|
|
"useGradient": true,
|
|
|
"strokeWidth": 2,
|
|
|
- "labels": {
|
|
|
- },
|
|
|
+ "labels": {},
|
|
|
"area": {
|
|
|
"useGradient": true,
|
|
|
"opacity": "26"
|
|
@@ -97,10 +96,11 @@ export function getLineData({ xAxis = [] as any[], datas = [] as number[][], leg
|
|
|
return { config, dataset }
|
|
|
}
|
|
|
|
|
|
-export function getLine2Data({ xAxis = [] as any[], datas = [] as number[][], legend = [] as string[], suffix = '', width = 600, height = 300, color = 'rgb(1, 191, 236)' }) {
|
|
|
+export function getLine2Data({ xAxis = [] as any[], datas = [] as number[][], legend = [] as string[], suffix = '', width = 500, height = 300, color = 'rgb(1, 191, 236)' }) {
|
|
|
|
|
|
const max = 100
|
|
|
const config = {
|
|
|
+ theme: getTheme(),
|
|
|
"responsive": false,
|
|
|
"chart": {
|
|
|
"fontFamily": "inherit",
|
|
@@ -114,9 +114,9 @@ export function getLine2Data({ xAxis = [] as any[], datas = [] as number[][], le
|
|
|
},
|
|
|
"padding": {
|
|
|
"top": 10,
|
|
|
- "right": 10,
|
|
|
- "bottom": 10,
|
|
|
- "left": 10
|
|
|
+ "right": 24,
|
|
|
+ "bottom": 30,
|
|
|
+ "left": 24
|
|
|
},
|
|
|
"grid": {
|
|
|
"position": "start",
|
|
@@ -198,13 +198,14 @@ export function getPieData({ datas = [] as number[][], legend = [] as string[],
|
|
|
const colorList = ['#4285F4', '#2ecc71', '#FBBB04', '#e67e22', '#FF0000'].reverse()
|
|
|
|
|
|
const config = {
|
|
|
+ theme: getTheme(),
|
|
|
+ "backgroundColor": "transparent",
|
|
|
style: {
|
|
|
- "color": "#888888",
|
|
|
+ "backgroundColor": "transparent",
|
|
|
chart: {
|
|
|
"fontFamily": "inherit",
|
|
|
"paddingTop": 0,
|
|
|
"backgroundColor": "transparent",
|
|
|
- "color": "#888888",
|
|
|
height,
|
|
|
width,
|
|
|
"padding": {
|
|
@@ -221,7 +222,6 @@ export function getPieData({ datas = [] as number[][], legend = [] as string[],
|
|
|
"show": true,
|
|
|
"bold": false,
|
|
|
"backgroundColor": "transparent",
|
|
|
- "color": "#888888",
|
|
|
"fontSize": 14,
|
|
|
"roundingValue": 0,
|
|
|
"roundingPercentage": 0
|
|
@@ -230,20 +230,17 @@ export function getPieData({ datas = [] as number[][], legend = [] as string[],
|
|
|
"labels": {
|
|
|
value: { rounding: 0, show: true, formatter: null },
|
|
|
percentage: {
|
|
|
- color: "#888888",
|
|
|
bold: true,
|
|
|
fontSize: 18,
|
|
|
rounding: 0,
|
|
|
formatter: null,
|
|
|
},
|
|
|
- name: { color: "#888888", bold: false, fontSize: 14 },
|
|
|
+ name: { bold: false, fontSize: 14 },
|
|
|
"hollow": {
|
|
|
"total": {
|
|
|
"fontSize": 18,
|
|
|
- "color": "#888888",
|
|
|
"text": "总计",
|
|
|
"value": {
|
|
|
- "color": "#888888",
|
|
|
"fontSize": 18,
|
|
|
}
|
|
|
},
|
|
@@ -260,7 +257,6 @@ export function getPieData({ datas = [] as number[][], legend = [] as string[],
|
|
|
},
|
|
|
}
|
|
|
|
|
|
-
|
|
|
// const dataset = [{ "name": "Series 1", "values": [100] }, { "name": "Series 2", "values": [50] }, { "name": "Series 3", "values": [25] }, { "name": "Series 4", "values": [12.5] }]
|
|
|
|
|
|
const dataset = datas.map((data, i) => {
|
|
@@ -273,8 +269,8 @@ export function getPieData({ datas = [] as number[][], legend = [] as string[],
|
|
|
export function getGaugeData({ value = 50 }) {
|
|
|
|
|
|
const config = {
|
|
|
+ theme: getTheme(),
|
|
|
"responsive": false,
|
|
|
- "theme": "",
|
|
|
"customPalette": [],
|
|
|
"style": {
|
|
|
"fontFamily": "inherit",
|