I am trying to create an undirected graph in Raphael (unsuccessful till now) and layout it using JointJs. I am able to create an undirected graph in JointJs and layout it.
From past couple of days i have been going through Raphael documentation, did a local setup but struggling to create a graph. My basic requirement is diagramming/graph creation through Raphael and rendering it with proper layout(like in jointjs; DirectedGraph Layout). Now, this auto layout is not supported by Raphael so, i have to use an external library only for layout purpose.
Now, as far as i've worked with JointJs, it does a acceptable job but even though lets say i've graph from raphael, still not sure how will i use it with DirectedGraph Layout.
D3 was also an option but after i explored it, i could not get much about layouting. Not necessarily i should use JointJs but could be another library which can support my use case.
My main concerns are:
How to draw undirected graph in Rapahel.
How to consume the graph drawn in Raphael in JointJs (or any layouting library)
OR
Layout technique/library that would do both diagramming and layout like in image from link below.
http://s000.tinyupload.com/?file_id=10320373554237333472
Any resources/code snippet will be helpful. Thanks in advance!
Related
I am using draw2d javascript library for drawing predefined shapes and custom shapes in it's canvas.
As I don't have any example made yet, I am trying to copy from it's documentation but doesn't seem to find a good way to research it as it contains a whole lot of it.
Here is the circle example.
http://www.draw2d.org/draw2d_touch/jsdoc_6/#!/api/draw2d.shape.basic.Circle
and here are some more documentation with examples.
http://www.draw2d.org/draw2d_touch/jsdoc_6/
I have premade shapes with html and css and I am trying to drag and drop and render them on canvas like these in this image. Also when dropped, they should have input and output ports too.
Is it possible to convert this html/css to draw2d shapes?
So here this is made possible via extending draw2d's SVGFigure and thus we have ability to provide custom svg to render it as a custom shape.
Below links were useful in this context.
http://www.draw2d.org/draw2d_touch/jsdoc/#!/guide/extending_svg_figure-section-live-example
https://github.com/freegroup/draw2d/tree/master/examples/shape_custom_svg
http://www.draw2d.org/draw2d_touch/jsdoc_6/#!/api/draw2d.SetFigure
https://github.com/freegroup/draw2d/tree/master/examples/shape_labeld
https://github.com/freegroup/draw2d/tree/master/examples/shape_custom_markdown
I am new to jointjs. I am working with shapes as instances of joint.shapes.devs.Model and am trying to replace the circle, representing an in/out port with a custom image. I would like to keep the current functionality where it is possible to create a new arrow by dragging the circle, snaplinks, and the rest of the great functionality offered by JointJs. The only thing I would like to do is to replace the magnet/inPort/circle with an image. Is this possible? If so, how?
Regards
It is indeed possible. The best way would be to look at how the joint.shapes.devs.Model is defined here: https://raw.githubusercontent.com/clientIO/joint/master/plugins/shapes/joint.shapes.devs.js and create your own custom shape that has the SVG <image> element in the ports instead of the current <circle>.
I'm working with nokia HERE maps and I want to add an additional layer of visualization graphics on top of a map. Since the possibilities to interact, manipulate and customize the graphics created by the HERE api are limited, I would like to work with d3.js/SVG for my visualizations.
My straight forward and obvious solution would have been to just add an absolute positioned SVG element on top of the map and giving it the same dimensions. But of course that takes every possibility to interact with the map. Is there any solution to add an overlay to the map which allows me to put SVG on it while maintaining the full interactivity (panning, zooming, clicking) of the map? Also it should be possible to interact with the SVG.
I know that there is a possibility to add a custom overlay of tiles provided by a tile server to HERE maps but that's not really what I'm looking for. I'm looking for something like the solution google has to offer to this problem. A set of custom layers which are always in sync with the corresponding map and have their own initialize, draw and remove methods. Is there something similar for HERE maps?
I think you are after the nokia.maps.map.provider.CanvasProvider class. This class provides a ground overlay bound to a specific area which offers a draw() method. The attach() method is the equivalent of your intialize I think, and you can refresh the overlay using update().
Depending upon your use case, I've also found the following techniques useful regarding SVG, Images and HERE Maps:
For an SVG marker which is anchored to a point and doesn't resize
use: SVG Markers
Alternatively override the Marker class and write using the low
level graphics commands to add flexibility to the rendering of a
marker anchored to a point. Like this: Defaced Marker
To add an image bound to a specific area use the ImageProvider class
To add a series of tiled images from a TMS (Tile Map Service) use the ImgTileProvider class
Alternatively if the [zoom][col][row] is useful to you and you
want to write SVG based stuff yourself try something like this example - which combines
SVG with 256x256 pixel markers.
Note that the HERE Maps API for JavaScript only supports SVG Tiny.
A class like the old nokia.maps.map.provider.CanvasProvider isn't even available on the new v3 API from Here.
Your best bet is on Leaflet using custom providers loading Here map tiles. Then you just load this Custom Overlay class and you're all set to draw D3, WebGL, whatever you need. Leaflet only loads the tiles from the providers and exposes some simple APIs. You will not have to deal with any of the providers' APIs.
Just don't forget to add your app_id and app_code to the provider class.
I am new to opengl and visual c++. I have done a sample application which rotates 3D shapes in opengl. I want to allow the user to rotate and zoom the object. Please give me an example of how to do this.
I have tried NeHe tutorial: http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=48
I can't understand the class structure in the example. Is there anysimple way to achieve this?
I have found a library as well: http://www.nigels.com/glt/gltzpr/
But still can't figure out how to do this.
Please help me.
Zooming is usually done through gluLookAt. The third parameter is the view distance.
Here is some basic example running this :
http://graphics.stanford.edu/courses/cs248-01/OpenGLHelpSession/code_example.html
Look in display() to see how the viewing distance is used and in MouseMotion() to see how the value is modified and the painting updated.
I need to build a custom designed bar chart that displays some simple data. Below are my requirements. Can anyone suggest the best web technology for my requirements.
high browser compatibility
ability to draw shapes
ability to fill shapes with gradients
ability to have onclick and onmouseover events for the different shapes (bars in the chart).
Thanks guys. I was thinking of using svg but looking for suggestions.
How about Raphaël - it's SVG/VML.
It says:
Browser compatibility:
Raphaël currently supports Firefox
3.0+, Safari 3.0+, Opera 9.5+ and Internet Explorer 6.0+.
Ability to draw shapes
circle, rect, ellipse, image, text, path
Ability to fill shapes with gradients
yes
Ability to have onclick and onmouseover events
yes:
... every graphical object you
create is also a DOM object, so you
can attach JavaScript event handlers
or modify them later.
Everything in the reference
On top of that, there's a plugin called gRaphael which makes the creation of charts easier.
Simple data - Google Charts API or Google Visualization API may suit you.
Details for all features of image charts can be found on the Chart feature list
You may also take a look at the comparison of the Charts API and the Visualization API.
Another candidate of course is JQuery SVG - if you're already familiar with jquery you may prefer this one.
There's a comparison of JQuery SVG and Raphaël on SO:
jQuery SVG vs. Raphael
I recommend using Adobe Flex. Below is an example of how easy pie chart creation can be in Flex:
<mx:Panel title="Pie Chart">
<mx:PieChart id="myChart"
dataProvider="{expenses}"
showDataTips="true"
>
<mx:series>
<mx:PieSeries
field="Amount"
nameField="Expense"
labelPosition="callout"
/>
</mx:series>
</mx:PieChart>
<mx:Legend dataProvider="{myChart}"/>
Based on your criteria:
high browser compatibility: Flex is used on more than 95% of all browsers and behaves the same in all browsers. No more need to check if your web app is running in ie, firefox, chrome, etc... because any browser that has a flash player is compatible.
ability to draw shapes: Flash's greatest strength is the ability to draw. Charts are completely customizable and skinnable to achieve the look you need.
Ability to fill shapes with gradients - done easily by setting style attributes or a custom skin.
ability to have onclick and onmouseover events for the different shapes - see this link for some easy ways to create user interactions with charts.
Hi i hope this link may help you i found it while searching for a solution similar to what you're looking for:
http://www.artetics.com/Articles/using-various-javascript-libraries-to-create-pie-chart
i'm trying gRaphael, i'm having difficulties on finding documentation though. you have to read the code and use the exploded instead of the min.js
I would like to share jquery.jqplot.js. It has lots of jQuery options, but depends on other plugins such as syntaxhighliter etc.