D3.js Force directed graph different shapes for nodes - javascript

I am currently developing a visualization using D3.js where I am displaying the data in a force-directed graph. As data in JSON format has 6 different types of nodes so I want to display them in different shapes like circle, rectangle, square etc. I had gone through the following blogs
https://bl.ocks.org/mbostock/1062383
http://bl.ocks.org/eyaler/10586116
http://bl.ocks.org/FrissAnalytics/a63553129a896159c07b71dd3ede35d7
http://bl.ocks.org/fzyukio/563059b1bff8901dc3beaf1150934323
But I did not understand the logic of how did the append different shapes. I do not want to use symbols as I had tried them and they are too small were distorting my visualization. So Please let me know how can I display different shapes for my nodes.

Related

d3.js voronoi with overlapping data points

I am mapping tens of thousands of circles to a d3.js chart, with varying radii. Here is a screenshot (of a subset of the data, which can be filtered):
There is an overlaying voronoi diagram which is used to display a custom pop-up (with a bit of detail) when a user rolls over each circle. The voronoi points ("positions") have a random number assigned as the decimal, to prevent the issue of overlapping exactly similar data points. Here is a screenshot with the voronoi overlap:
However, the pop-up tooltip only displays when mousing over some of the data points, and not others.
I am using d3.js, v2 (not v3), and the code is at https://github.com/shaunjacobsen/divvy_savestime, with my progress so far visible at http://sjacobsen.com/testing/2015/bubble-chart.html. (It's difficult to append the large json datasets in jsfiddle).
Do you have any advice or guidance for how to get the pop-up to appear over each circle on mouseover? I greatly appreciate it.
Edit: I should note that this is based on http://ta.virot.me.s3-website-us-east-1.amazonaws.com/hubway/hubway-summary.html
AFAIK you use the voronoi diagram to show the tooltip? A better approach is a weighted voronoi with equalized areas for the circles.

Add labels between two points in a line graph d3.js

I'm trying to add labels to different sections of a line graph using d3.js. I'm working with a dataset that needs to be labelled by the end user by assigning labels to different section of the graph. My current under use case is to build something like the following:
While I am able to create the line graph, and can guess that the areas can be added to the graph as brushes, I'm unable to get started with regard it.

Link two D3 plots

I'm trying to link two D3 plots so that selecting part of the histogram on the right, causes a certain scatter plot to display on the left.
This is my attempt.
My current question is why the right plot isn't rendering, which I think goes back to how to create and refer to multiple SVG tags in d3.
D3 has SVG controls for this type of situation. What you are looking for is a brush with context.
Here are the API docs:
https://github.com/mbostock/d3/wiki/SVG-Controls
And here are two great examples:
http://bl.ocks.org/mbostock/4063663
http://bl.ocks.org/mbostock/1667367

different symbols in a google charts scatter plot

I'm using the google charts library to make some interactive scatter plots. And I cannot find is whether you can have symbols other than circles as "markers" ? As far as I can see it was possible with the previous obsolete version of google charts. But is it impossible with the current one ?
Scatter chart "playground":
https://code.google.com/apis/ajax/playground/?type=visualization#scatter_chart
Currently (as of July, 2013) there is no way to do this within the chart options. You have a choice between circles and no markers, and that's it.
You could go through the code and change the SVG using javascript, changing the circles to rectangles, and manipulating the coordinates appropriately (or drawing paths, or whatever you'd like). That's really the only way to do it.
Edited to add:
Additionally, you could set a fill for the circles themselves using javascript, and make the fill any shape you'd like.
You can do it with the help of image charts. You can change the color and shape of the markers using this.Refer this link. An example for the different shape markers
Click here to see this. For more google charts related queries take a look at this jqfaq.com

select an area of a scatter plot in javascript

I am trying to achieve the following with javascript:
draw a scatter plot with many (~10,000) points
allow the user to draw a curved shape on top of the plot to select a region (I am open to exactly how the shape is designed: an ellipse would be fine, or a polygon, or a path defined by bezier curves)
get a list of the points inside the selected area and do something with them.
Obviously, it is step 2 that is causing the problem. I have previously used jqplot to something similar to the above using a rectangular selection, but it is vital for the purposes of this project that the user be able to select an elliptical region.
Can anybody give any hint as to which javascript library would allow this?
I know that you can create paths using Raphael. I would have though that the most difficult part of this would be the last, but I did find this (yes, I know it's VB, but it gives a basis that can be applied to JavaScript).

Categories

Resources