How to use d3.min and d3.max within a d3.json command

If your data is an array, your original code will work, if you get rid of the brackets around data: var data = [32710,20280,18002]; console.log(data); console.log(d3.min(data)); console.log(d3.max(data)); If you need to identify the array values with the keys “01”,”02″, “03”, create an array of objects, and operate on the values to get min/max: //data as … Read more

Create a D3 axis without tick labels

I’m just going to leave this here since people are likely to end up on this question. Here are the different ways you can easily manipulate a D3 axis. Without any ticks or tick labels: d3.svg.axis().tickValues([]); No line or text elements are created this way. Without ticks and with tick labels: d3.svg.axis().tickSize(0); The line elements … Read more

Is it possible to determine if a GeoJSON point is inside a GeoJSON polygon using JavasScript?

Seems like d3 has you covered: https://github.com/d3/d3-geo#geoContains d3.geoContains(object, point) Returns true if and only if the specified GeoJSON object contains the specified point, or false if the object does not contain the point. The point must be specified as a two-element array [longitude, latitude] in degrees. For Point and MultiPoint geometries, an exact test is … Read more

in svg: translate vs position x and y

In SVG transform is not hardware accelerated. They have around the same performance for single elements (in my experience). However, I use transform more to move thing around because in SVG not all elements have a x or y attributes, consider… <line x1=”0″ y1=”0″ x2=”100″ y2=”100″ /> <circle cx=”100″ cy=”100″ r=”100″ /> <path d=”M 0 … Read more

D3: How to show large dataset

The problem is not to render them. You could switch to canvas or webgl for the rendering part. You can find some examples of using canvas and X3DOM with D3 data-binding. But it will be slow because of the number of DOM objects, so it’s better to keep them separated, as in this parallel coordinates … Read more

d3.js and document.onReady

You’ll notice in their examples that their javascript is below any of the html elements that is utilized so that part of the dom is loaded before it starts executing the javascript. Simply putting your javascript at the bottom of the body is usually good enough.

Zoomable, Google-Finance-style time series graph in D3 or Rickshaw? [closed]

NVD3 is a very cool project that has a number of reusable charts written upon D3. See here for an example of a line chart with a view finder, along with source code. Update: The NVD3 example now also links to an example of Mike Bostock’s (creator of D3) which demonstrates similar functionality, the ability … Read more