{"remainingRequest":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js??vue-loader-options!D:\\jenkins\\workspace\\examine-fvue\\node_modules\\@jiaminghi\\data-view\\lib\\components\\flylineChart\\src\\main.vue?vue&type=script&lang=js&","dependencies":[{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\@jiaminghi\\data-view\\lib\\components\\flylineChart\\src\\main.vue","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\babel-loader\\lib\\index.js","mtime":315532800000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\cache-loader\\dist\\cjs.js","mtime":499162500000},{"path":"D:\\jenkins\\workspace\\examine-fvue\\node_modules\\vue-loader\\lib\\index.js","mtime":499162500000}],"contextDependencies":[],"result":["//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n//\n\nimport { deepMerge } from '@jiaminghi/charts/lib/util/index'\n\nimport { deepClone } from '@jiaminghi/c-render/lib/plugin/util'\n\nimport { randomExtend, getPointDistance, uuid } from '../../../util/index'\n\nimport autoResize from '../../../mixin/autoResize'\n\nexport default {\n name: 'DvFlylineChart',\n mixins: [autoResize],\n props: {\n config: {\n type: Object,\n default: () => ({})\n },\n dev: {\n type: Boolean,\n default: false\n }\n },\n data () {\n const id = uuid()\n return {\n ref: 'dv-flyline-chart',\n unique: Math.random(),\n maskId: `flyline-mask-id-${id}`,\n maskCircleId: `mask-circle-id-${id}`,\n gradientId: `gradient-id-${id}`,\n gradient2Id: `gradient2-id-${id}`,\n\n defaultConfig: {\n /**\n * @description Flyline chart center point\n * @type {Array}\n * @default centerPoint = [0, 0]\n */\n centerPoint: [0, 0],\n /**\n * @description Flyline start points\n * @type {Array>}\n * @default points = []\n * @example points = [[10, 10], [100, 100]]\n */\n points: [],\n /**\n * @description Flyline width\n * @type {Number}\n * @default lineWidth = 1\n */\n lineWidth: 1,\n /**\n * @description Orbit color\n * @type {String}\n * @default orbitColor = 'rgba(103, 224, 227, .2)'\n */\n orbitColor: 'rgba(103, 224, 227, .2)',\n /**\n * @description Flyline color\n * @type {String}\n * @default orbitColor = '#ffde93'\n */\n flylineColor: '#ffde93',\n /**\n * @description K value\n * @type {Number}\n * @default k = -0.5\n * @example k = -1 ~ 1\n */\n k: -0.5,\n /**\n * @description Flyline curvature\n * @type {Number}\n * @default curvature = 5\n */\n curvature: 5,\n /**\n * @description Flyline radius\n * @type {Number}\n * @default flylineRadius = 100\n */\n flylineRadius: 100,\n /**\n * @description Flyline animation duration\n * @type {Array}\n * @default duration = [20, 30]\n */\n duration: [20, 30],\n /**\n * @description Relative points position\n * @type {Boolean}\n * @default relative = true\n */\n relative: true,\n /**\n * @description Back ground image url\n * @type {String}\n * @default bgImgUrl = ''\n * @example bgImgUrl = './img/bg.jpg'\n */\n bgImgUrl: '',\n /**\n * @description Text configuration\n * @type {Object}\n */\n text: {\n /**\n * @description Text offset\n * @type {Array}\n * @default offset = [0, 15]\n */\n offset: [0, 15],\n /**\n * @description Text color\n * @type {String}\n * @default color = '#ffdb5c'\n */\n color: '#ffdb5c',\n /**\n * @description Text font size\n * @type {Number}\n * @default fontSize = 12\n */\n fontSize: 12\n },\n /**\n * @description Halo configuration\n * @type {Object}\n */\n halo: {\n /**\n * @description Weather to show halo\n * @type {Boolean}\n * @default show = true\n * @example show = true | false\n */\n show: true,\n /**\n * @description Halo animation duration (10 = 1s)\n * @type {Number}\n * @default duration = 30\n */\n duration: 30,\n /**\n * @description Halo color\n * @type {String}\n * @default color = '#fb7293'\n */\n color: '#fb7293',\n /**\n * @description Halo max radius\n * @type {Number}\n * @default radius = 120\n */\n radius: 120\n },\n /**\n * @description Center point img configuration\n * @type {Object}\n */\n centerPointImg: {\n /**\n * @description Center point img width\n * @type {Number}\n * @default width = 40\n */\n width: 40,\n /**\n * @description Center point img height\n * @type {Number}\n * @default height = 40\n */\n height: 40,\n /**\n * @description Center point img url\n * @type {String}\n * @default url = ''\n */\n url: ''\n },\n /**\n * @description Points img configuration\n * @type {Object}\n * @default radius = 120\n */\n pointsImg: {\n /**\n * @description Points img width\n * @type {Number}\n * @default width = 15\n */\n width: 15,\n /**\n * @description Points img height\n * @type {Number}\n * @default height = 15\n */\n height: 15,\n /**\n * @description Points img url\n * @type {String}\n * @default url = ''\n */\n url: ''\n }\n },\n\n mergedConfig: null,\n\n paths: [],\n lengths: [],\n times: [],\n texts: []\n }\n },\n watch: {\n config () {\n const { calcData } = this\n\n calcData()\n }\n },\n methods: {\n afterAutoResizeMixinInit () {\n const { calcData } = this\n\n calcData()\n },\n onResize () {\n const { calcData } = this\n\n calcData()\n },\n async calcData () {\n const { mergeConfig, createFlylinePaths, calcLineLengths } = this\n\n mergeConfig()\n\n createFlylinePaths()\n\n await calcLineLengths()\n\n const { calcTimes, calcTexts } = this\n\n calcTimes()\n\n calcTexts()\n },\n mergeConfig () {\n let { config, defaultConfig } = this\n\n const mergedConfig = deepMerge(deepClone(defaultConfig, true), config || {})\n\n const { points } = mergedConfig\n\n mergedConfig.points = points.map(item => {\n if (item instanceof Array) {\n return { position: item, text: '' }\n }\n\n return item\n })\n\n this.mergedConfig = mergedConfig\n },\n createFlylinePaths () {\n const { getPath, mergedConfig, width, height } = this\n\n let { centerPoint, points, relative } = mergedConfig\n\n points = points.map(({ position }) => position)\n\n if (relative) {\n centerPoint = [width * centerPoint[0], height * centerPoint[1]]\n points = points.map(([x, y]) => [width * x, height * y])\n }\n\n this.paths = points.map(point => getPath(centerPoint, point))\n },\n getPath (center, point) {\n const { getControlPoint } = this\n\n const controlPoint = getControlPoint(center, point)\n\n return [point, controlPoint, center]\n },\n getControlPoint ([sx, sy], [ex, ey]) {\n const { getKLinePointByx, mergedConfig } = this\n\n const { curvature, k } = mergedConfig\n\n const [mx, my] = [(sx + ex) / 2, (sy + ey) / 2]\n\n const distance = getPointDistance([sx, sy], [ex, ey])\n\n const targetLength = distance / curvature\n const disDived = targetLength / 2\n\n let [dx, dy] = [mx, my]\n\n do {\n dx += disDived\n dy = getKLinePointByx(k, [mx, my], dx)[1]\n } while (getPointDistance([mx, my], [dx, dy]) < targetLength)\n\n return [dx, dy]\n },\n getKLinePointByx (k, [lx, ly], x) {\n const y = ly - k * lx + k * x\n\n return [x, y]\n },\n async calcLineLengths () {\n const { $nextTick, paths, $refs } = this\n\n await $nextTick()\n\n this.lengths = paths.map((foo, i) => $refs[`path${i}`][0].getTotalLength())\n },\n calcTimes () {\n const { duration, points } = this.mergedConfig\n\n this.times = points.map(foo => randomExtend(...duration) / 10)\n },\n calcTexts () {\n const { points } = this.mergedConfig\n\n this.texts = points.map(({ text }) => text)\n },\n consoleClickPos ({ offsetX, offsetY }) {\n const { width, height, dev } = this\n\n if (!dev) return\n\n const relativeX = (offsetX / width).toFixed(2)\n const relativeY = (offsetY / height).toFixed(2)\n\n console.warn(`dv-flyline-chart DEV: \\n Click Position is [${offsetX}, ${offsetY}] \\n Relative Position is [${relativeX}, ${relativeY}]`)\n }\n }\n}\n",null]}