diff --git a/src/assets/images/chart/charts/sankey.png b/src/assets/images/chart/charts/sankey.png new file mode 100644 index 00000000..1ab374e9 Binary files /dev/null and b/src/assets/images/chart/charts/sankey.png differ diff --git a/src/packages/components/Charts/Mores/Sankey/config.ts b/src/packages/components/Charts/Mores/Sankey/config.ts new file mode 100644 index 00000000..cab0ff7d --- /dev/null +++ b/src/packages/components/Charts/Mores/Sankey/config.ts @@ -0,0 +1,43 @@ +import { echartOptionProfixHandle, PublicConfigClass } from '@/packages/public' +import { SankeyConfig } from './index' +import { CreateComponentType } from '@/packages/index.d' +import cloneDeep from 'lodash/cloneDeep' +import dataJson from './data.json' + +export const includes = ['legend'] + +// 图表方向 +export const orientList = [ + { label: '水平', value: 'horizontal' }, + { label: '垂直', value: 'vertical' } +] + +// 标签展示 +export const toolTipSwitch = [ + { label: '开启', value: 1 }, + { label: '关闭', value: 0 } +] + +export const option = { + dataset: { ...dataJson }, + tooltip: { + show: 1, + trigger: 'item', + triggerOn: 'mousemove' + }, + series: { + type: 'sankey', + layout: 'none', + orient:'horizontal', + data: dataJson.label, + links: dataJson.links, + levels: dataJson.levels + } +}; + +export default class Config extends PublicConfigClass implements CreateComponentType { + public key = SankeyConfig.key + public chartConfig = cloneDeep(SankeyConfig) + // 图表配置项 + public option = echartOptionProfixHandle(option, includes) +} diff --git a/src/packages/components/Charts/Mores/Sankey/config.vue b/src/packages/components/Charts/Mores/Sankey/config.vue new file mode 100644 index 00000000..fcb23e7e --- /dev/null +++ b/src/packages/components/Charts/Mores/Sankey/config.vue @@ -0,0 +1,43 @@ + + + diff --git a/src/packages/components/Charts/Mores/Sankey/data.json b/src/packages/components/Charts/Mores/Sankey/data.json new file mode 100644 index 00000000..e1f81b79 --- /dev/null +++ b/src/packages/components/Charts/Mores/Sankey/data.json @@ -0,0 +1,86 @@ +{ + "label": [ + { + "name": "a" + }, + { + "name": "b" + }, + { + "name": "a1" + }, + { + "name": "a2" + }, + { + "name": "b1" + }, + { + "name": "b2" + } + ], + "links": [ + { + "source": "a", + "target": "a1", + "value": 5 + }, + { + "source": "a", + "target": "a2", + "value": 3 + }, + { + "source": "b", + "target": "b1", + "value": 8 + }, + { + "source": "a", + "target": "b1", + "value": 3 + }, + { + "source": "b1", + "target": "a1", + "value": 1 + }, + { + "source": "b1", + "target": "b2", + "value": 2 + } + ], + "levels": [ + { + "depth": 0, + "itemStyle": { + "color": "#decbe4" + }, + "lineStyle": { + "color": "source", + "opacity": 0.9 + } + }, + { + "depth": 1, + "itemStyle": { + "color": "#b3cde3" + }, + "lineStyle": { + "color": "source", + "opacity": 0.6 + } + }, + { + "depth": 2, + "itemStyle": { + "color": "#ccebc5" + }, + "lineStyle": { + "color": "source", + "opacity": 0.6 + } + } + ] +} diff --git a/src/packages/components/Charts/Mores/Sankey/index.ts b/src/packages/components/Charts/Mores/Sankey/index.ts new file mode 100644 index 00000000..71992944 --- /dev/null +++ b/src/packages/components/Charts/Mores/Sankey/index.ts @@ -0,0 +1,14 @@ +import { ConfigType, PackagesCategoryEnum, ChartFrameEnum } from '@/packages/index.d' +import { ChatCategoryEnum, ChatCategoryEnumName } from '../../index.d' + +export const SankeyConfig: ConfigType = { + key: 'Sankey', + chartKey: 'VSankey', + conKey: 'VCSankey', + title: '桑基图', + category: ChatCategoryEnum.MORE, + categoryName: ChatCategoryEnumName.MORE, + package: PackagesCategoryEnum.CHARTS, + chartFrame: ChartFrameEnum.COMMON, + image: 'sankey.png' +} diff --git a/src/packages/components/Charts/Mores/Sankey/index.vue b/src/packages/components/Charts/Mores/Sankey/index.vue new file mode 100644 index 00000000..a8cdb09b --- /dev/null +++ b/src/packages/components/Charts/Mores/Sankey/index.vue @@ -0,0 +1,78 @@ + + + diff --git a/src/packages/components/Charts/Mores/index.ts b/src/packages/components/Charts/Mores/index.ts index 7539cf21..65ed05e1 100644 --- a/src/packages/components/Charts/Mores/index.ts +++ b/src/packages/components/Charts/Mores/index.ts @@ -4,5 +4,6 @@ import { FunnelConfig } from './Funnel/index' import { HeatmapConfig } from './Heatmap/index' import { WaterPoloConfig } from './WaterPolo/index' import { TreeMapConfig } from './TreeMap/index' +import { SankeyConfig } from './Sankey/index' -export default [ProcessConfig, RadarConfig, FunnelConfig, HeatmapConfig, WaterPoloConfig, TreeMapConfig] +export default [ProcessConfig, RadarConfig, FunnelConfig, HeatmapConfig, WaterPoloConfig, TreeMapConfig, SankeyConfig]