Skip to content

Instantly share code, notes, and snippets.

@mattrdini
mattrdini / index.html
Created January 6, 2016 19:56
Adjusting Axis Lines
<!doctype html>
<meta charset="utf-8">
<script src="http://www.d3plus.org/js/d3.js"></script>
<script src="http://www.d3plus.org/js/d3plus.js"></script>
<div id="viz"></div>
<script>
@mattrdini
mattrdini / README.md
Last active December 30, 2015 01:20
Toggle Zerolines On/Off

By using the “axis” Object key passed with a boolean value to .x() or .y() will toggle the zero line of either axis on or off. Additional parameters for styling are “color”, “font”, and “rendering”.

Featured on D3plus.org.

@mattrdini
mattrdini / README.md
Last active December 30, 2015 01:00
Toggle Grid Lines On/Off

Passing the Object key “grid” to either .x() or .y() methods will toggle the gridlines on or off. The key will take a boolean value as well as “color” or “rendering” objects for formatting parameters.

Featured on D3plus.org.

@mattrdini
mattrdini / README.md
Last active December 30, 2015 00:49
Set a Static Range on X or Y Axes

If you pass a “range” Object key to either the .x() or .y() methods in a D3plus visualization you can set a static range for either axis. The value this key takes is an Array with the min and maximum values for the range.

Featured on D3plus.org.

@mattrdini
mattrdini / README.md
Last active December 30, 2015 00:00
Adjust The Padding Between Data On A Specific Axis

By passing a “padding” Object with a number value to either the .x or .y() method will allow you to control the space between data points. If the number is less than 1, it is used as a percentage of the available space. If the number is greater than 1, it is used as a set pixel value (unless there isn’t sufficient space, then it will revert to the default)

Featured on D3plus.org.

@mattrdini
mattrdini / README.md
Last active December 29, 2015 23:41
Formatting Ticks on X or Y Axes

You can format the ticks on either the x or the y axis of a D3plus visualization by passing a key of “ticks” to either the .x() or .y() methods. This key will accept keys of “width”, “color”, “font”, “rendering”, and “size”.

Featured on D3plus.org.

@mattrdini
mattrdini / README.md
Last active December 29, 2015 23:13
Override X or Y Axis Labels

To override the labels of your x or y axes pass an object key of “labels” to the .x() or .y() method. Further formatting control possible by passing any of the additional supported object parameters: “color”, “decoration”, “family”, “padding”, “size”, “transform”, and “weight”.

Featured on D3plus.org.

@mattrdini
mattrdini / README.md
Last active December 29, 2015 22:38
Adding Subtitles to Tooltips

If you'd like to show a data-driven subtitle in your tooltips, you can pass a “sub” key to the .tooltip( ) method, where the value is the key in each data point that contains the subtitle.

Featured on D3plus.org.

@mattrdini
mattrdini / README.md
Last active December 29, 2015 21:57
Toggle Share Percentage in Tooltip

Use the “share” Object key with .tooltip() method to toggle the share percentage from showing in the tooltip info. This key will accept a boolean value.

Featured on D3plus.org.

@mattrdini
mattrdini / README.md
Last active December 29, 2015 21:22
Set the Opacity of Edge Connections

Use the “opacity” keyed Object with the .edges() method to set the opacity of the connections in a network visualization.

Featured on D3plus.org.