-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Bridge Tools
committed
Mar 8, 2021
1 parent
01be605
commit 9d09f2b
Showing
70 changed files
with
4,220 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
public/ | ||
.cache/ | ||
node_modules/ | ||
node_modules/ | ||
src/libs/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,7 +41,6 @@ | |
"postcss-text-remove-gap": "^1.1.1", | ||
"prismjs": "^1.20.0", | ||
"prop-types": "^15.7.2", | ||
"rc-spider": "git+ssh://[email protected]/intergalactico/spider.git#master", | ||
"react": "^16.8.6", | ||
"react-calendly": "^1.3.0", | ||
"react-children-utilities": "^2.1.6", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# top-most EditorConfig file | ||
root = true | ||
|
||
# Unix-style newlines with a newline ending every file | ||
[*.{js,jsx,css}] | ||
end_of_line = lf | ||
insert_final_newline = true | ||
indent_style = space | ||
indent_size = 2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
*.iml | ||
*.log | ||
.idea | ||
.ipr | ||
.iws | ||
*~ | ||
~* | ||
*.diff | ||
*.patch | ||
*.bak | ||
.DS_Store | ||
Thumbs.db | ||
.project | ||
.*proj | ||
.svn | ||
*.swp | ||
*.swo | ||
*.pyc | ||
*.pyo | ||
node_modules | ||
.cache | ||
*.css | ||
build | ||
coverage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
language: node_js | ||
|
||
sudo: false | ||
|
||
notifications: | ||
email: | ||
- [email protected] | ||
|
||
node_js: | ||
- 5.4.1 | ||
|
||
before_install: | ||
- | | ||
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(\.md$)|(^(docs|examples))/' | ||
then | ||
echo "Only docs were updated, stopping build process." | ||
exit | ||
fi | ||
npm install [email protected] -g | ||
phantomjs --version | ||
script: | ||
- | | ||
if [ "$TEST_TYPE" = test ]; then | ||
npm test | ||
else | ||
npm run $TEST_TYPE | ||
fi | ||
env: | ||
matrix: | ||
- TEST_TYPE=lint | ||
- TEST_TYPE=test | ||
- TEST_TYPE=coverage | ||
- TEST_TYPE=saucelabs | ||
|
||
|
||
matrix: | ||
allow_failures: | ||
- env: "TEST_TYPE=saucelabs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
## v0.0.8 | ||
* `network` layout | ||
## v0.0.7 | ||
* `mindNode` example add | ||
|
||
### v0.0.5 | ||
* `Text` element now supported setting `alignment` props (left|center|right) to set text alignment. | ||
|
||
* `transform` and `projection` prop on `<Spider />` component will effect whole graph but node only. | ||
|
||
* to set `transform` or `projection` prop of node, set `transform` or `projection` prop of `<Node />` component directly, | ||
|
||
or set `NodeTransform` or `NodeProjection` attribute of `<Spider />` | ||
|
||
|
||
### v0.0.4 | ||
using tidier drawing algorithm to draw tree | ||
|
||
### v0.0.3 | ||
|
||
tree-layout supported. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# rc-spider | ||
--- | ||
|
||
React Spider Component | ||
|
||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
[![gemnasium deps][gemnasium-image]][gemnasium-url] | ||
[![npm download][download-image]][download-url] | ||
|
||
[npm-image]: http://img.shields.io/npm/v/rc-spider.svg?style=flat-square | ||
[npm-url]: http://npmjs.org/package/rc-spider | ||
[travis-image]: https://img.shields.io/travis/react-component/spider.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/react-component/spider | ||
[coveralls-image]: https://img.shields.io/coveralls/react-component/spider.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/react-component/spider?branch=master | ||
[gemnasium-image]: http://img.shields.io/gemnasium/react-component/spider.svg?style=flat-square | ||
[gemnasium-url]: https://gemnasium.com/react-component/spider | ||
[node-image]: https://img.shields.io/badge/node.js-%3E=_0.10-green.svg?style=flat-square | ||
[node-url]: http://nodejs.org/download/ | ||
[download-image]: https://img.shields.io/npm/dm/rc-spider.svg?style=flat-square | ||
[download-url]: https://npmjs.org/package/rc-spider | ||
|
||
## Screenshots | ||
|
||
<img src="https://img.alicdn.com/tps/TB1NVsALVXXXXXZaXXXXXXXXXXX-1620-1334.jpg" width="288"/> | ||
<img src="https://os.alipayobjects.com/rmsportal/ivIBcNVOuJHpgPx.png" width="288" /> | ||
|
||
## Development | ||
|
||
``` | ||
npm install | ||
npm start | ||
``` | ||
|
||
## Example | ||
|
||
http://localhost:8000/examples/ | ||
|
||
|
||
online example: http://react-component.github.io/spider/ | ||
|
||
|
||
## install | ||
|
||
|
||
[](https://npmjs.org/package/rc-spider) | ||
|
||
|
||
## Usage | ||
|
||
```js | ||
var Spider = require('rc-spider'); | ||
var React = require('react'); | ||
React.render(<Spider />, container); | ||
``` | ||
|
||
## API | ||
|
||
### props | ||
|
||
<table class="table table-bordered table-striped"> | ||
<thead> | ||
<tr> | ||
<th style="width: 100px;">name</th> | ||
<th style="width: 50px;">type</th> | ||
<th style="width: 50px;">default</th> | ||
<th>description</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
<tr> | ||
<td>className</td> | ||
<td>String</td> | ||
<td></td> | ||
<td>additional css class of root dom node</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
|
||
## Test Case | ||
|
||
``` | ||
npm test | ||
npm run chrome-test | ||
``` | ||
|
||
## Coverage | ||
|
||
``` | ||
npm run coverage | ||
``` | ||
|
||
open coverage/ dir | ||
|
||
## License | ||
|
||
rc-spider is released under the MIT license. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
placeholder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import 'normalize.css'; | ||
import Spider from 'rc-spider'; | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom'; | ||
|
||
const width = 1280; | ||
const height = 800; | ||
const rx = width / 2; | ||
const ry = height / 2; | ||
|
||
const { Node, Circle, Text, Link } = Spider.Shape; | ||
|
||
function onClick(d, e) { | ||
console.log('>> onClick', this); | ||
} | ||
|
||
function nodeCreator(data) { | ||
return (<Node width="3.5" height="3.5" > | ||
<Circle onClick={onClick} /> | ||
<Text transform={data.x < 180 ? null: new Spider.Transform().rotate(180)} | ||
offset={data.x < 180 ? [8, 3] : [-8 , 3]} | ||
alignment={data.x < 180 ? 'left' : 'right'}> | ||
{data.name} | ||
</Text> | ||
</Node>); | ||
} | ||
|
||
function projection (d) { | ||
return [d.y, d.x / 180 * Math.PI] | ||
} | ||
function radial (data) { | ||
var d = projection.apply(this, arguments), r = d[0], a = d[1] - Math.PI / 2; | ||
return [ r * Math.cos(a), r * Math.sin(a) ]; | ||
} | ||
|
||
function linkCreator (data) { | ||
return <Link projection={radial} data={data}/>; | ||
} | ||
|
||
const data = new Request('./flare.json'); | ||
fetch(data).then(response => response.json()) | ||
.then(response => { | ||
const tree = response; | ||
const cluster = Spider.layout.cluster().size([360, ry - 120]); | ||
const data = cluster.data(tree); | ||
ReactDOM.render(<Spider width={width} height={height} dataSource={data} | ||
offset={[rx, ry]} | ||
nodeTransform={d => new Spider.Transform().rotate(d.x - 90).translate(d.y)} | ||
nodeCreator={nodeCreator} | ||
linkCreator={linkCreator} | ||
/>, document.getElementById('__react-content')); | ||
}); | ||
|
Oops, something went wrong.