PB Line Graph

In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.

This kit is a wrapper around the Highcharts library. It applies styling and default settings but does NOT ship Highcharts. Once 'highcharts' and 'highcharts-react-official are installed into your repo, any prop or functionality provided by Highcharts can be used with this kit without requiring specific props from Playbook. The doc examples below showcase a few common usecases but are not a comprehensive list of all the functionalities possible.

See the highcharts API docs for a comprehensive look at what is possible.

Default


In order to use this kit, 'highcharts' and 'highcharts-react-official' must be installed in your repo.

Legend


Legend Position


Highcharts provides many options for customizing the legend display. This example showcases the following:

align can be used to align the legend left, right or center (defaults to center)

verticalAlign can be used to place the legend above the graph. Options are top, middle, bottom with default set to bottom

layout determines the position of the legend items. Options are horizontal, vertical or proximate with default set to horizontal layout: proximate will place the legend items as close as possible to the graphs they're representing. It will also determine whether to place the legend above/below or on the side of the plot area, if the legend is in a corner.

x offsets the legend relative to its horizontal alignment. Negative x moves it to the left, positive x moves it to the right (defaults to 0)

y offsets the legend relative to its vertical alignment. Negative y moves it up, positive y moves it down (defaults to 0)

Legend NonClickable


Height


By default, Highcharts have a height of 400px, but this can be customized. You can override the default by specifying either a percentage or a fixed pixel value.

Using a percentage maintains a consistent aspect ratio across different responsive sizes. For example, setting the height to 50% makes the chart’s height half of its width.

Color Overrides


Custom data colors allow for color customization to match the needs of business requirements.

For React, import 'colors' from Playbook, then set custom colors in the colors array using the desired color variables. Hex colors are also available.

For Rails, HEX values are required.


Available Props