From 73d8889bc49e2d5b87663886b0546323304e44cb Mon Sep 17 00:00:00 2001 From: QuietlyChan <1013893148@qq.com> Date: Wed, 30 Aug 2023 15:23:41 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=85=B3=E7=B3=BB=E5=9B=BE?= =?UTF-8?q?=E5=8A=9B=E5=BC=95=E5=AF=BC=E5=B8=83=E5=B1=80=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/Charts/Mores/Graph/config.ts | 86 +++++++++++-------- .../components/Charts/Mores/Graph/config.vue | 73 +++++++++++++--- .../components/Charts/Mores/Graph/index.vue | 9 +- src/packages/components/Charts/Mores/index.ts | 12 ++- 4 files changed, 131 insertions(+), 49 deletions(-) diff --git a/src/packages/components/Charts/Mores/Graph/config.ts b/src/packages/components/Charts/Mores/Graph/config.ts index 0dfb0dc8..7ba6b00c 100644 --- a/src/packages/components/Charts/Mores/Graph/config.ts +++ b/src/packages/components/Charts/Mores/Graph/config.ts @@ -9,13 +9,14 @@ export const includes = [] // 关系图布局 export const GraphLayout = [ { label: '无', value: 'none' }, - { label: '环形', value: 'circular' } + { label: '环形', value: 'circular' }, + { label: '力引导', value: 'force' } ] // 标签开关 export const LabelSwitch = [ - { label: '开启', value: 1 }, - { label: '关闭', value: 0 } + { label: '开启', value: true }, + { label: '关闭', value: false } ] // 标签位置 @@ -24,44 +25,57 @@ export const LabelPosition = [ { label: '右侧', value: 'right' }, { label: '顶部', value: 'top' }, { label: '底部', value: 'bottom' }, - { label: '内部', value: 'inside' }, + { label: '内部', value: 'inside' } +] + +// 图-迭代动画 +export const LayoutAnimation = [ + { label: '开启', value: true }, + { label: '关闭', value: false } ] export const option = { - dataset: { ...dataJson }, - tooltip: {}, - legend:{ - show:true, - textStyle:{ - color:"#eee", - fontSize: 14 , - }, - data: dataJson.categories.map(function (a) { - return a.name; - }) + dataset: { ...dataJson }, + tooltip: {}, + legend: { + show: true, + textStyle: { + color: '#eee', + fontSize: 14 }, - series: [ - { - type: 'graph', - layout: 'none', // none circular环形布局 - data: dataJson.nodes, - links: dataJson.links, - categories: dataJson.categories, - label: { // 标签 - show: 1, - position: 'right', - formatter: '{b}' - }, - labelLayout: { - hideOverlap: true - }, - lineStyle: { - color: 'source', // 线条颜色 - curveness: 0.2 // 线条卷曲程度 - } + data: dataJson.categories.map(function (a) { + return a.name + }) + }, + series: [ + { + type: 'graph', + layout: 'none', // none circular环形布局 + data: dataJson.nodes, + links: dataJson.links, + categories: dataJson.categories, + label: { + show: true, + position: 'right', + formatter: '{b}' + }, + labelLayout: { + hideOverlap: true + }, + lineStyle: { + color: 'source', // 线条颜色 + curveness: 0.2 // 线条卷曲程度 + }, + force: { + repulsion: 100, + gravity: 0.1, + edgeLength: 30, + layoutAnimation: true, + friction: 0.6 } - ] - }; + } + ] +} export default class Config extends PublicConfigClass implements CreateComponentType { public key = GraphConfig.key diff --git a/src/packages/components/Charts/Mores/Graph/config.vue b/src/packages/components/Charts/Mores/Graph/config.vue index 07319fde..81ce82f0 100644 --- a/src/packages/components/Charts/Mores/Graph/config.vue +++ b/src/packages/components/Charts/Mores/Graph/config.vue @@ -16,14 +16,14 @@ - + + v-model:value="optionData.series[0].lineStyle.curveness" + :min="0" + :step="0.01" + placeholder="弯曲程度" + size="small" + > @@ -32,10 +32,61 @@ size="small" :modes="['hex']" v-model:value="optionData.legend.textStyle.color" - > + > - + + + + + + + + + + + + + + + + + + + + + + @@ -46,7 +97,7 @@ diff --git a/src/packages/components/Charts/Mores/Graph/index.vue b/src/packages/components/Charts/Mores/Graph/index.vue index 40c2b0e1..378c968e 100644 --- a/src/packages/components/Charts/Mores/Graph/index.vue +++ b/src/packages/components/Charts/Mores/Graph/index.vue @@ -1,5 +1,12 @@