Chart Options
You can set various options and defaults on the chart itself by setting the options prop.
<Chart
options={{
backgroundColor: 'rgb(60, 60, 60)',
iconFontFamily: 'Font Awesome 5 Free',
overview: {
visible: false
},
navigation: {
position: 'se'
}
}}
/>
The options prop accepts an object with the following format:
stringdefault: 'white'The color to use for the background of the chart itself.
arraySet to give the chart a linear background gradient. The gradient runs from top to bottom of the chart. To create a gradient you must define an array of at least two color/stop objects.
<Chart options={{
backgroundGradient: [
{ color: 'yellow', stop: 0 },
{ color: 'red', stop: 1 },
],
}}/>stringThe color for the specified location.
numberThe point at which the background color is set. A value of 0.4 would mean that the background takes on the specified color at 40% of the chart's height (the top of the chart is at 0%). If there are colors on either side of this stop, then the background color will transition linearly from/to these colors. We recommend using values between 0 and 1.
objectOptions to control combo behavior.
booleandefault: trueWhen true, provides default combo selection behavior. Nodes and links that are selected and within combos or summary links, or connected to a combo, are brought into the foreground of the chart along with any neighbors they have. This includes showing the contents of summary links. Other items in the chart are faded. If chart items have fade set explicitly these items will not be altered.
stringThe color to use for the navigation and overview window control. Only the hue and saturation values of the color are used: the lightness is fixed.
'light' | 'dark'default: 'light'The color theme of the navigation and overview window controls.
booleandefault: trueIf true, drag operations will pan the chart automatically if the mouse or touch position moves near the edge of or outside the chart area. If false, the chart will not pan if the mouse or touch position moves near the edge of the chart area during a drag operation, and the drag will be canceled if the mouse moves outside the chart area.
numberdefault: 0.2The opacity level of faded items. In the range 0 to 1, where 0 is totally transparent.
string or objectdefault: 'auto'Controls how the chart view should respond to changes. Note that these behaviors do not take effect if the view prop is set. Valid values are:
- 'all' - Fits all items to the viewport at the end of an update.
- 'auto' - Automatically adjusts the view during the update. This setting shows changes without disrupting their context.
- 'none' - Does not adjust the view during the update. Note that layouts may still adjust node positions relative to the chart.
- 'selection' - Fits the currently selected items to the viewport at the end of an update.
- object - Fits the specified items to the viewport at the end of an update. Accepts a dictionary whose properties are valid chart items. Defaults to 'auto' if no valid items are passed.
booleandefault: trueControls the default behavior of navigation:
- If true, dragging over the background pans the view.
- If false, dragging over the background creates a selection marquee.
numberdefault: 150The number of milliseconds delay before the onItemInteraction and onHover events are triggered.
stringdefault: 'sans-serif'The default font family to use for font icons, such as 'FontAwesome' or 'Octicon'. If the font isn't supported by the browser, or if none is set, 'sans-serif' is used.
[pathOrName: string]: ImageAlignmentOptionsSets the position and scale for images and font icons on nodes. The object accepts properties where property names are image or font icon paths and property values are the values to be adjusted.
When using images and font icons in label objects for node and annotation labels, image alignment is handled differently. See fontIcon and image.
<Chart options={{
imageAlignment: {
'fas fa-user': { size: 2 },
'/assets/img/logo.png': { size: 1.5 }
}
}}/>Value
A dictionary where the id is the image path or icon name, and the value contains the following properties:
numberdefault: 0Sets how far to move the icon horizontally. The value is a percentage from -50 to 50.
numberdefault: 0Sets how far to move the icon vertically. The value is a percentage from -50 to 50.
numberdefault: 0The factor by which you want to resize the icon relative to its parent. Must be greater than 0.
objectOptions to control the appearance of labels on items.
stringdefault: 'sans-serif'The default font family to use, such as 'arial' or 'helvetica'. If the font isn't supported by the browser, or if none is set, 'sans-serif' is used.
booleandefault: falseIf set to true, labels are drawn over glyphs. If false, glyphs are drawn over labels.
numberThe maximum character length of a node or link label before it is truncated. If set, labels are truncated to the length specified, and the last three characters are replaced with ....
numberAn integer to move the label text up or down. Useful only for certain fonts where the baseline is irregular (e.g. Open Sans).
booleandefault: trueIf true, hovering over a node or a link reveals the full length of all their truncated labels.
objectOptions to control the appearance of links.
'normal' | 'small' | 'large' | 'xlarge'default: 'normal'Controls the size of arrows on links. Note that arrowhead size is proportional to the link width.
booleandefault: trueWhether link ends should avoid node labels. Does not apply to labels positioned by numeric values in the positions object.
'loose' | 'tight'default: 'tight'Controls the spacing between nodes and link ends connected to them. If set to 'loose', there is a small gap between the node and the link end. Also affects the spacing between node subjects and annotation lines.
'along' | 'horizontal'default: 'horizontal'Controls the orientation of multiple glyphs on links without labels. If set to 'along', glyphs are drawn along the link. If set to 'horizontal', glyphs are drawn horizontally.
numberdefault: 0.75Only for links with a color gradient. Controls the size of the fraction at the midpoint of the link where the color transition occurs. The value is between 0 and 1, with 0 providing an immediate transition between colors. The rest of the link is drawn with solid colors.
booleandefault: falseRotates labels and glyphs on links to match the link orientation. Note that enabling inlineLabels overrides the glyphOrientation option.
'center' | 'ends' | 'off'default: 'center'Controls how links are selected when dragging a selection marquee.
objectSettings for the logo to be displayed in a corner of the chart.
stringThe URL of the logo to be displayed, or null for no logo. On Retina devices, ReGraph will also check for a double-resolution @2x version of the logo, e.g. 'path/to/images/[email protected]'.
'ne' | 'se' | 'sw' | 'nw'default: 'ne'The position of the logo.
numberdefault: 0The horizontal offset in pixels from the logo's default position.
numberdefault: 0The vertical offset in pixels from the logo's default position.
objectSpecifies options for the Leaflet map.
<Chart options={{
map: {
tiles: 'http://example.com/path/{z}/{x}/{y}.png'
}
}}/>objectPass options directly into the Leaflet constructor. See the Leaflet API for more details.
string | objectAn option to set the url template for map tiles. Accepts either a string in the form of http://example.com/path/{z}/{x}/{y}.png, or an object in the Leaflet TileLayer options format with an additional url property. If the url template isn't set, OpenStreetMap is used as a default tile provider. If set to null, the tile layer isn't created.
numberdefault: 4Sets the maximum zoom for items, from minZoom to 4. Using the default value is suggested for optimal result.
numberdefault: 0.05Sets the minimum zoom for the view. Use a smaller value to allow the chart to be zoomed out further. The value can be from 0.001 to 1.
object | booleanAn object whose properties are the settings for the navigation controls. For brevity, you can pass a value of false to hide the navigation controls.
'ne' | 'se' | 'sw' | 'nw'default: 'nw'The position of the navigation controls.
booleandefault: trueWhether the navigation controls are displayed.
numberdefault: 0The horizontal offset in pixels from the navigation controls' default position.
numberdefault: 0The vertical offset in pixels from the navigation controls' default position.
object | booleanSettings for the overview window. To hide the overview window, you can set overview:false. Overview window is not supported on a Leaflet map.
stringdefault: value of chart backgroundColorThe background color of the overview window. If an rgba color is used, the alpha channel is ignored.
stringdefault: 'light grey'The border color of the overview window.
'ne' | 'se' | 'sw' | 'nw'default: 'se'The position of the overview window.
booleandefault: trueWhether the icon the user can click on to open/close the overview is shown.
numberdefault: 100The size of the overview window in pixels.
booleandefault: falseIf set to true, the overview window is fully expanded. If false, the overview window is collapsed into an icon.
object | booleanOptions to style selected items. Set to false or an empty object to disable it. If both selection and onItemInteraction are set, selection takes precedence. Note that options below don't apply to node labels in these cases:
- When the label is an array of objects and label's
backgroundColororcoloris set - When the label is an object,
backgroundColororcoloris set, andpositionis set
stringdefault: 'rgb(255, 109, 102)'Adds the following selection styles:
- Nodes, combos: a colored halo
- Links: a selection marker
- Node, combo, link labels: a colored background
stringdefault: 'white'Sets the label font color.
objectAn object whose properties are the settings for the watermark in the center of the chart.