Comments (9)
It really boils down to what part of API you want to change. I intentionally made some part of the library private, to protect developers from errors.
Can you give a particular example of what you wanted to extend and was not able to?
from vivagraphjs.
to protect developers from errors.
This "protection" "throws away the baby together with a water", in my opinion.
Wherever I look in vivagraph I see those huge unreadable return objects that are a huge source of pain and possible errors.
Currently I am extending WebgImageNodeProgram I simply want to add few tiny features there but I cannot do because there is a mess there with several completely unreachable classes.
Why do not you simply do something like:
class WebgImageNodeProgram extends AbstractNodeProgram
constructor: ()->
@atlas = new ImageAtlas()
#some other setup code
So developers will simply do
constructor: ()->
super
#some new code
???
The same for many other classes I have to work with. And sometimes your private methods simply do not work. For instance I am trying to establish better control for node and edges updates because I want to stream graphs with websockets and do realtime two-way syncronization. And I get "non implemented" errors for update notifications that are hidden somewhere in the "private section".
As a conclusion I have to rewrite whole vivagraph classes in normal OOP way (with subclasses, inheritance and so on) in my projects =(((
from vivagraphjs.
Think about return object as public API, which is accessible to external code. There are many ways of extending behavior of a library and I usually prefer delegation over inheritance.
Though I must admit WebGL based stuff has really rudimentary support right now. I was thinking it could be a better idea to have a satellite package to handle webgl rendering.
from vivagraphjs.
Here is how to implement custom nodes in WebGL: https://github.com/anvaka/VivaGraphJS/blob/master/demos/other/webglCustomNode.html
In case of prototypical inheritance shaders code becomes visible to all clients - which I don't really want to do.
I'm agree with you it could be done better. If you want to refactor this part - please feel free to submit the pull request. Though as I said, it might be a better idea to make a satellite library or make API flexible enough to use other rendering libraries like three.js or two.js
from vivagraphjs.
. If you want to refactor this part - please feel free to submit the pull request.
It is not hard for me to contribute because I will anyway do some graph code in my project. The problem is that I write in completely different style than you: I prefer to use coffeescript, I use a lot of small classes and am not obsessed with "privacy".
Regarding three.js I actually plan to use in the future. The reason why I am trying to use current webgl code because I am prototyping some features and want to get things working faster.
from vivagraphjs.
Hi,
what about wrap Vivagraph in angularjs directive?
Not addressing anton kulaga points but it would made viva extremely extensible.
I've obtained real nice results with viva as stand alone graph loaded as onload() events, I'd like it now to use it as directive to load dinamically some graphs withinin div objects.
Any help in doing this?
(starting to learn angularjs now..)
http://briantford.com/blog/angular-d3.html
if someone angularjs-trained could help in figure out how to wrap it so that ot inject graph dynamically, it'd be amazingly useful (and I'd be real grateful).
from vivagraphjs.
@xdiscovery Nice idea. I've been using angular myself recently, and want to port some parts of yasiv.com to angular. Will share the code for angular directive.
from vivagraphjs.
Closing this issue. I'm not planning to expose private state to world. If there is lack of extensibility points I'd be happy to address those via delegation.
from vivagraphjs.
hi @anvaka,
could you show an example for using vivagraph with angular?
I wrote a web-app with vivagraph, hammerjs and jquery.
Angular is not really straight forward for me, I am learning with a dive course about angular-cli:
https://www.udemy.com/learn-angular-from-scratch/learn/v4/t/lecture/6976310?start=0
and I would be happy to wrap the whole piece of code within a "graph" view.
It would be nice if you or someone savvy with angular could show an example to fit with above tutorial.
from vivagraphjs.
Related Issues (20)
- Feedback
- how many nodes can this graph support
- Feedback - WebAssembly
- Cannot render graph HOT 2
- Documentation?
- Bug with links
- Go to the link by clicking on the node. HOT 1
- Adding text label functionality HOT 4
- render images on nodes instead of squares
- ngraph dependencies and other dependencies versions
- Messaging between nodes' position to optimise layout
- Request to be added to the list of examples
- how to make hyperlink <a href > from node
- How to fix nodes coordinates
- when you click on an object it jumps
- Performance is not good!
- change image in webgl graph node
- Extend Options to add Custom Force-Directed Layouts
- Node icon images turn to green when nodes number exceed 15,000.
- Custom nodes get stacked on top of each other HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vivagraphjs.