Skip to content

Commit

Permalink
feat:adjust graphin docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pomelo-nwu committed Feb 2, 2021
1 parent 5482bf0 commit 67b6792
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 34 deletions.
12 changes: 0 additions & 12 deletions packages/graphin/docs/quick-start/components.md

This file was deleted.

28 changes: 15 additions & 13 deletions packages/graphin/docs/quick-start/demos/node.tsx
Expand Up @@ -4,7 +4,7 @@ import iconLoader from '@antv/graphin-icons';
import { Row, Col, Card } from 'antd';

const icons = Graphin.registerFontFamily(iconLoader);

const parimaryColor = '#ff6a00';
const data = {
nodes: [
{
Expand All @@ -19,9 +19,11 @@ const data = {
/** 节点的大小 */
size: 80,
/** 包围边颜色 */
stroke: '#FF6A00',
stroke: parimaryColor,
/** 填充色 */
fill: Utils.hexToRgbaToHex('#FF6A00', 0.2),
fill: parimaryColor,
/** 填充色的透明度 */
fillOpacity: 0.2,
/** 透明度 */
opacity: 1,
/** 鼠标样式 */
Expand Down Expand Up @@ -51,7 +53,7 @@ const data = {
/** 图标大小 */
size: 40,
/** 字体图标的填充色 */
fill: '#FF6A00',
fill: parimaryColor,
/** 字体Family */
fontFamily: 'graphin',
},
Expand All @@ -66,7 +68,7 @@ const data = {
// type = image 时生效,表示图片的宽度和高度
size: [25, 25],
/** 徽标填充色 */
fill: '#FF6A00',
fill: parimaryColor,
/** 徽标描边色 */
stroke: '',
/** 徽标内文本的颜色 */
Expand All @@ -87,7 +89,7 @@ const data = {
// type = image 时生效,表示图片的宽度和高度
size: [25, 25],
/** 徽标填充色 */
fill: Utils.hexToRgbaToHex('#FF6A00', 1),
fill: Utils.hexToRgbaToHex(parimaryColor, 1),
/** 徽标描边色 */
stroke: '',
/** 徽标内文本的颜色 */
Expand All @@ -103,7 +105,7 @@ const data = {
// // 节点的光环,在节点交互过程中(hover,selected,disabled,active)等,可以打开光环,默认是隐藏的,也可以自定义
halo: {
/** 光晕 */
fill: Utils.hexToRgbaToHex('#FF6A00', 0.2),
fill: Utils.hexToRgbaToHex(parimaryColor, 0.2),
/** 透明度 */
opacity: 1,
/** 是否展示 */
Expand Down Expand Up @@ -157,9 +159,9 @@ export default () => {
/** 节点的大小 */
size: 80,
/** 包围边颜色 */
stroke: '#FF6A00',
stroke: parimaryColor,
/** 填充色 */
fill: Utils.hexToRgbaToHex('#FF6A00', 0.2),
fill: Utils.hexToRgbaToHex(parimaryColor, 0.2),
/** 透明度 */
opacity: 1,
/** 鼠标样式 */
Expand Down Expand Up @@ -189,7 +191,7 @@ export default () => {
/** 图标大小 */
size: 40,
/** 字体图标的填充色 */
fill: '#FF6A00',
fill: parimaryColor,
/** 字体Family */
fontFamily: 'graphin',
},
Expand All @@ -204,7 +206,7 @@ export default () => {
// type = image 时生效,表示图片的宽度和高度
size: [25, 25],
/** 徽标填充色 */
fill: Utils.hexToRgbaToHex('#FF6A00', 1),
fill: Utils.hexToRgbaToHex(parimaryColor, 1),
/** 徽标描边色 */
stroke: '',
/** 徽标内文本的颜色 */
Expand All @@ -225,7 +227,7 @@ export default () => {
// type = image 时生效,表示图片的宽度和高度
size: [25, 25],
/** 徽标填充色 */
fill: Utils.hexToRgbaToHex('#FF6A00', 1),
fill: Utils.hexToRgbaToHex(parimaryColor, 1),
/** 徽标描边色 */
stroke: '',
/** 徽标内文本的颜色 */
Expand All @@ -241,7 +243,7 @@ export default () => {
// 节点的光环,在节点交互过程中(hover,selected,disabled,active)等,可以打开光环,默认是隐藏的,也可以自定义
halo: {
/** 光晕 */
fill: Utils.hexToRgbaToHex('#FF6A00', 0.2),
fill: Utils.hexToRgbaToHex(parimaryColor, 0.2),
/** 透明度 */
opacity: 1,
/** 是否展示 */
Expand Down
7 changes: 4 additions & 3 deletions packages/graphin/docs/quick-start/demos/style.tsx
@@ -1,8 +1,7 @@
import React from 'react';
import Graphin, { Behaviors, Utils } from '@antv/graphin';
import Graphin, { Behaviors, GraphinData } from '@antv/graphin';
import { Row, Col, Card } from 'antd';
import iconLoader from '@antv/graphin-icons';
import { GraphinData } from '../../../dist/typings/type';

const icons = Graphin.registerFontFamily(iconLoader);
const Color = {
Expand Down Expand Up @@ -70,7 +69,9 @@ data.nodes.forEach(node => {
keyshape: {
size: count ? (count / 10) * 2 : 30,
stroke: Color[type],
fill: Utils.hexToRgbaToHex(Color[type], 0.2),
fill: Color[type],
fillOpacity: 0.2,
strokeOpacity: 1,
},
icon: {
type: 'font',
Expand Down
2 changes: 1 addition & 1 deletion packages/graphin/docs/quick-start/index.md
Expand Up @@ -2,7 +2,7 @@
title: 快速开始
order: 0
group:
path: /a/quick-start
path: /quick-start
title: 快速开始
order: 0
nav:
Expand Down
7 changes: 5 additions & 2 deletions packages/graphin/docs/render/data/Network.tsx
@@ -1,7 +1,7 @@
import React, { useEffect } from 'react';
import Graphin, { Utils, Behaviors, GraphinContext } from '@antv/graphin';

const { FitView } = Behaviors;
const { FitView, DragCanvas } = Behaviors;

const data = Utils.mock(10).circle().graphin();
const layout = {
Expand All @@ -19,14 +19,17 @@ const FocusItem = () => {
};

console.log('network', data);

const shouldBegin = () => {
return true;
};
export default () => {
return (
<div>
<Graphin data={data} layout={layout}>
<FitView />
{/* <ZoomCanvas disabled /> */}
<FocusItem />
<DragCanvas shouldBegin={shouldBegin} />
</Graphin>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion packages/graphin/docs/render/element/edge.md
@@ -1,5 +1,5 @@
---
title: 边 Edge
title: 边的样式
group:
path: /render
nav:
Expand Down
2 changes: 1 addition & 1 deletion packages/graphin/docs/render/element/node.md
@@ -1,5 +1,5 @@
---
title: 节点 Node
title: 节点样式
group:
path: /render
nav:
Expand Down
2 changes: 1 addition & 1 deletion packages/graphin/docs/render/update/index.md
@@ -1,5 +1,5 @@
---
title: 更新元素
title: 更新样式
group:
path: /render
nav:
Expand Down
5 changes: 5 additions & 0 deletions packages/graphin/src/theme/index.ts
Expand Up @@ -19,22 +19,27 @@ export interface ThemeType {
mode: 'light' | 'dark';
/**
* @description 画布背景色
* @default #fff
*/
background: string;
/**
* @description 节点大小
* @default 26
*/
nodeSize: number;
/**
* @description 节点主要颜色
* @default #269a99
*/
primaryColor: string;
/**
* @description 边的大小
* @default 1
*/
edgeSize: number;
/**
* @description 边的主要颜色
* @default #ddd
*/
primaryEdgeColor: string;
}
Expand Down

0 comments on commit 67b6792

Please sign in to comment.