-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Conflicts: .gitignore
- Loading branch information
Showing
116 changed files
with
7,413 additions
and
3,314 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,4 +11,4 @@ app/index.html | |
site/dist | ||
.grunt | ||
archive | ||
s3.yml | ||
s3.yml |
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,71 @@ | ||
Build this repo locally | ||
======================= | ||
Alchemy.js leverages yeoman.io heavily for workflow. At the heart of Yeoman is the Gruntfile which is used to run tasks. The Alchemy.js app `./app` builds a `./dist` folder containing Alchemy.js and dependencies, while the Alchemy.js site is built from a seperate Yeoman project in the `./site` folder which publishes to the gh-pages branch of this repo. Additionally, we use [CoffeeScript](http://coffeescript.org), [Sass](http://sass-lang.com/), [d3](http://sass-lang.com/), and [lodash](http://lodash.com/). If you are looking to contribute, each project has fantastic documentation. | ||
|
||
##### Up and Running with Yeoman: | ||
``` | ||
# If you don't have Node find fast Wifi | ||
brew update | ||
brew doctor | ||
brew install node | ||
# If you don't have Yeoman find fast Wifi | ||
npm install -g yo | ||
# Install Coffee for compiling CoffeeScript into JavaScript | ||
npm install -g coffee-script | ||
# Install Compass for compiling Sass into css | ||
gem install compass | ||
# Download this directory | ||
git clone [email protected]:GraphAlchemist/Alchemy.git | ||
cd Alchemy | ||
``` | ||
|
||
Building the Alchemy app | ||
------------------------ | ||
Get Alchemy up and running locally: | ||
``` | ||
# Make sure you are in the Alchemy directory and | ||
# completed the Up and Running with Yeoman steps | ||
# Install project specific Node dependencies | ||
npm install | ||
# Install project specific front end dependencies | ||
bower install | ||
# Fire up the grunt dev server | ||
grunt serve | ||
``` | ||
|
||
Alchemy will now be running at localhost:9000. The Alchemy app that is running is based on the inline configuration in `./app/index.html`. Additionally, there are a number of sample data sets to play with in the `./app/sample_data/` directory. | ||
|
||
Building the Docs | ||
----------------- | ||
One of the best ways to contribute is helping clean up the docs. | ||
|
||
The Alchemy.js site is in angular and is hosted on gh-pages from this repo. The site builds from the site folder `./site`. All of the documentation is written in Markdown can be found in the docs folder `./site/app/docs`. | ||
|
||
Here's how to get the docs up and running locally: | ||
``` | ||
# Make sure you are in the site directory and | ||
# completed the Up and Running with Yeoman steps | ||
# Install Node depedencies | ||
npm install | ||
# Install Bower depedencies | ||
bower install | ||
# Install Jekyll and its depedencies | ||
gem install jekyll | ||
gem install codearray | ||
gem install kramdown | ||
# Run the documentation locally | ||
grunt serve | ||
``` | ||
|
||
The docs should now be running locally on port :9002. |
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
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 |
---|---|---|
|
@@ -62,7 +62,7 @@ | |
{ | ||
"source": 4, | ||
"target": 0, | ||
"caption": "Often Breaks" | ||
"caption": "Often_Breaks" | ||
}, | ||
{ | ||
"source": 5, | ||
|
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,93 @@ | ||
""" | ||
Alchemy.js is a graph drawing application for the web. | ||
Copyright (C) 2014 GraphAlchemist, Inc. | ||
This program is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
lets | ||
""" | ||
|
||
class Alchemy | ||
constructor: () -> | ||
@version = "#VERSION#" | ||
@layout = {} | ||
@interactions = {} | ||
@utils = {} | ||
@visControls = {} | ||
@styles = {} | ||
@models = {} | ||
@drawing = {} | ||
@editor = {} | ||
|
||
@log = {} | ||
@state = { | ||
"interactions": "default" | ||
"layout": "default" | ||
"filters": { | ||
"edges": {}, | ||
"nodes": {} | ||
} | ||
} | ||
|
||
getState: (key) => | ||
if @state.key? | ||
@state.key | ||
|
||
setState: (key, value) => | ||
@state.key = value | ||
|
||
begin: (userConf) => | ||
@conf = _.assign({}, alchemy.defaults, userConf) | ||
if typeof alchemy.conf.dataSource == 'string' | ||
d3.json(alchemy.conf.dataSource, alchemy.startGraph) | ||
else if typeof alchemy.conf.dataSource == 'object' | ||
alchemy.startGraph(alchemy.conf.dataSource) | ||
|
||
#API methods | ||
getNodes: (id, ids...) => | ||
# returns one or more nodes as an array | ||
if ids | ||
ids.push(id) | ||
params = _.union(ids) | ||
results = [] | ||
for p in params | ||
results.push(alchemy._nodes[p].properties) | ||
results | ||
else | ||
[@_nodes[id].properties] | ||
|
||
getEdges: (id=null, target=null) => | ||
# returns one or more edges as an array | ||
if id? and target? | ||
edge_id = "#{id}-#{target}" | ||
edge = @_edges[edge_id] | ||
[edge.properties] | ||
else if id? and not target? | ||
results = _.map(@_edges, (edge) -> | ||
if (edge.properties.source is id) or (edge.properties.target is id) | ||
edge.properties) | ||
_.compact(results) # best way to do this? | ||
|
||
allNodes: => | ||
_.map(@_nodes, (n) -> n.properties) | ||
|
||
allEdges: => | ||
_.map(@_edges, (e) -> e.properties) | ||
|
||
|
||
currentRelationshipTypes = {} | ||
|
||
if typeof module isnt 'undefined' and module.exports | ||
module.exports = new Alchemy() | ||
else | ||
@alchemy = new Alchemy() |
Oops, something went wrong.