Skip to content
Arjen van Bochoven edited this page Dec 21, 2016 · 5 revisions

All graphs in munkireport are drawn using the d3.js graphing framework.

Default Color

The default color of all graphs is steelBlue, but you can easily change the default color of all graphs by adding this line to your custom.js file:

mr.graph.barColor = ['IndianRed'];

Widget specific color

Apart from setting the color for all graphs, you can specify the color of a specific widget:

mr.graph['hardware-age-widget'] = {barColor: ['IndianRed']};

The following widgets can be customized:

  • network-vlan-widget
  • hardware-type-widget
  • memory-widget
  • os-widget
  • hardware-age-widget

Color ranges

If you like to use color ranges instead of single colors, you can use one of the built-in color scales of d3.js (category10, category20, category20b, and category20c):

mr.graph.barColor = d3.scale.category10().range();

See also https://github.com/d3/d3-3.x-api-reference/blob/master/Ordinal-Scales.md#categorical-colors

You can also define your own color ranges:

mr.graph.barColor = ['#1f77b4', '#9467bd', '#e377c2', '#17becf'];

The same works for specific widgets:

mr.graph['hardware-age-widget'] = {barColor: d3.scale.category20().range()};
Clone this wiki locally