From 7047fc75d8d33ad7608c05f655e760f4e824808b Mon Sep 17 00:00:00 2001
From: fengxiang <110431245@qq.com>
Date: Fri, 13 Jul 2018 10:08:33 +0800
Subject: [PATCH] 提交修改

---
 _mock/_chart.ts |  214 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 214 insertions(+), 0 deletions(-)

diff --git a/_mock/_chart.ts b/_mock/_chart.ts
new file mode 100644
index 0000000..974bcbc
--- /dev/null
+++ b/_mock/_chart.ts
@@ -0,0 +1,214 @@
+// tslint:disable
+import * as Mock from 'mockjs';
+import * as moment from "moment";
+
+// region: mock data
+
+const visitData = [];
+const beginDay = new Date().getTime();
+
+const fakeY = [7, 5, 4, 2, 4, 7, 5, 6, 5, 9, 6, 3, 1, 5, 3, 6, 5];
+for (let i = 0; i < fakeY.length; i += 1) {
+	visitData.push({
+		x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format(
+			"YYYY-MM-DD"
+		),
+		y: fakeY[i]
+	});
+}
+
+const visitData2 = [];
+const fakeY2 = [1, 6, 4, 8, 3, 7, 2];
+for (let i = 0; i < fakeY2.length; i += 1) {
+	visitData2.push({
+		x: moment(new Date(beginDay + 1000 * 60 * 60 * 24 * i)).format(
+			"YYYY-MM-DD"
+		),
+		y: fakeY2[i]
+	});
+}
+
+const salesData = [];
+// for (let i = 0; i < 12; i += 1) {
+// 	salesData.push({
+// 		x: `${i + 1}���`,
+// 		y: Math.floor(Math.random() * 1000) + 200
+// 	});
+// }
+for (let i = 0; i < 24; i += 1) {
+	salesData.push({
+		x: `${i}���`,
+		y: Math.floor(Math.random() * 1000) + 200
+	});
+}
+const searchData = [];
+for (let i = 0; i < 50; i += 1) {
+	searchData.push({
+		index: i + 1,
+		keyword: `���������������-${i}`,
+		count: Math.floor(Math.random() * 1000),
+		range: Math.floor(Math.random() * 100),
+		status: Math.floor((Math.random() * 10) % 2)
+	});
+}
+const salesTypeData = [
+	{
+		x: "������������",
+		y: 4544
+	},
+	{
+		x: "������������",
+		y: 3321
+	},
+	{
+		x: "������������",
+		y: 3113
+	},
+	{
+		x: "������������",
+		y: 2341
+	},
+	{
+		x: "������������",
+		y: 1231
+	},
+	{
+		x: "������",
+		y: 1231
+	}
+];
+
+const salesTypeDataOnline = [
+	{
+		x: "������������",
+		y: 244
+	},
+	{
+		x: "������������",
+		y: 321
+	},
+	{
+		x: "������������",
+		y: 311
+	},
+	{
+		x: "������������",
+		y: 41
+	},
+	{
+		x: "������������",
+		y: 121
+	},
+	{
+		x: '������',
+		y: 111
+	}
+];
+
+const salesTypeDataOffline = [
+	{
+		x: '������������',
+		y: 99
+	},
+	{
+		x: '������������',
+		y: 188
+	},
+	{
+		x: '������������',
+		y: 344
+	},
+	{
+		x: '������������',
+		y: 255
+	},
+	{
+		x: '������',
+		y: 65
+	}
+];
+
+const offlineData = [];
+for (let i = 0; i < 10; i += 1) {
+	offlineData.push({
+		name: `������${i}`,
+		cvr: Math.ceil(Math.random() * 9) / 10
+	});
+}
+const offlineChartData = [];
+for (let i = 0; i < 20; i += 1) {
+	offlineChartData.push({
+		x: new Date().getTime() + 1000 * 60 * 30 * i,
+		y1: Math.floor(Math.random() * 100) + 10,
+		y2: Math.floor(Math.random() * 100) + 10
+	});
+}
+
+const radarOriginData = [
+	{
+		name: '������',
+		ref: 10,
+		koubei: 8,
+		output: 4,
+		contribute: 5,
+		hot: 7
+	},
+	{
+		name: '������',
+		ref: 3,
+		koubei: 9,
+		output: 6,
+		contribute: 3,
+		hot: 1
+	},
+	{
+		name: '������',
+		ref: 4,
+		koubei: 1,
+		output: 6,
+		contribute: 5,
+		hot: 7
+	}
+];
+
+//
+const radarData = [];
+const radarTitleMap = {
+	ref: '������',
+	koubei: '������',
+	output: '������',
+	contribute: '������',
+	hot: '������'
+};
+radarOriginData.forEach(item => {
+	Object.keys(item).forEach(key => {
+		if (key !== 'name') {
+			radarData.push({
+				name: item.name,
+				label: radarTitleMap[key],
+				value: item[key]
+			});
+		}
+	});
+});
+
+// endregion
+
+export const CHARTS = {
+    '/chart': Object.assign({}, {
+        visitData,
+        visitData2,
+        salesData,
+        searchData,
+        offlineData,
+        offlineChartData,
+        salesTypeData,
+        salesTypeDataOnline,
+        salesTypeDataOffline,
+        radarData
+    }),
+    '/chart/visit': Object.assign([], visitData),
+    '/chart/tags': Mock.mock({
+        'list|100': [{ name: '@city', 'value|1-100': 150, 'type|0-2': 1 }]
+    })
+};

--
Gitblit v1.8.0