Symbols supported in D3
If you look at the d3.shape
API (https://github.com/d3/d3-shape), you can see all the different standard shapes provided by D3, and you'll notice that we've already discussed most of them in the previous chapters. However, there is one part of this API that we haven't explored yet, and that is the symbols.
D3 provides a number of standard symbols that you can use in your visualizations. For instance, when drawing a line chart, instead of drawing circles for each point of the chart, you could use a cross or a star. D3 comes with the following list of standard symbols:
d3.symbolCross
: A cross symbol, or an addition (+
) symbold3.symbolCircle
: A simple circled3.symbolDiamond
: A diamond symbol, as used on playing cardsd3.symbolSquare
: A simple squared3.symbolStar
: A five pointed stard3.symbolTriangle
: A simple triangle, point upd3.symbolWye
: AY
symbol
Each of these symbols has a size
function, which you can use to set the size of the symbol, which defaults to 64
. In DVD3...