Slope chart

Ideal for visualising change between time periods

Updated 19 days ago to v5.0.0 by Flourish team

How to use this template

Slope chart

A simple charting template to plot the differences between two values. Useful to compare the difference in population, income or wealth.

Data requirements

Each row after the header row is one slope. There should be a column for the name and two columns for the values. The values should be of the same data type (eg. votes, income, population).

Credits and feedback

Created by Flourish. Sample data is from the World Bank illustrating the change in urbanization. Want to see additional features? Let us know at

API information

Explains to developers how to use this template with the Flourish Live API.

template: @flourish/slope-chart

version: 5


slope_color color

Default slope colour.

slope_color_palette.palette colors

Palette for categories.

slope_color_palette.extend boolean

Auto-extend. Automatically generate additional colours when needed to avoid the palette colours being used more than once. Added colours are based on the average lightness and chroma values of the palette. This works best if the palette’s colours do not have very high or low saturation.

slope_color_palette.advanced boolean

Fine tune. Fine tune how additional colours are added to the palette.

slope_color_palette.hue_rotation_angle number

Hue rotation for added colours. Angle, in degrees in HCL colourspace, between one generated colour and the next. The default value, ~360/(Golden ratio), ensures adjacent hues are not too similar.

Max: 360

slope_color_palette.custom_palette text

Custom overrides. Type the name of the entity whose colour you want to set, a colon and then a colour (using a name, hex-code or rgb declaration). Multiple colours can be set using multiple lines. For example:<br /><hr />Party 1: red<br />Party 2: #4455AA<br />Party 3: rgb(30,168,26)

circle_radius number

Circle radius.

slope_width number

Slope width. Ignored if a line thickness is set for the line via column selection

slope_width_max number

Max slope width.

selected_slopes text

Highlight slopes. To highlight slopes, write the name of each slope on a line. You can also create a a story and highlight/unhighlight by clicking.

value_type string


Allowed values:

  • ranks (Ranks)
  • scores (Scores)
  • change (% change)

ties_mode string

Ties mode. What rank ranks should be given when there are ties? See for explanation of nomenclature

Allowed values:

  • dense (1 2 2 3)
  • competition (1 2 2 4)
  • fractional (1 2.5 2.5 4)
  • modified_competition (1 3 3 4)

sort_mode string

Sort mode.

Allowed values:

  • descending (Descending)
  • ascending (Ascending)


label_font_size number

Font size.

labels_position string

Labels position.

Allowed values:

  • left (Left)
  • right (Right)
  • both (Both)

use_label_highlight_color boolean

Use different label highlight color.

label_font_highlight_color color

only_show_highlights boolean

Only show highlighted labels.

label_max_width number

Max label width. as % of total width

Max: 100


popup.show_popups boolean


Allowed values:

  • true (Enabled)
  • false (Disabled)

popup.is_custom boolean

Popup contents.

Allowed values:

  • false (Auto)
  • true (Custom content)

popup.custom_template text

Popup content. The text to appear in the popup. You can use {{column_name}} to add a value from your data. It must be in a selected column, but you can add columns to “Metadata” if you just want to include them for use in the popup. Advanced users can include HTML to apply layouts, formatting, images, etc.

popup.show_pointer boolean


popup.show_shadow boolean


popup.style_popups boolean

Custom styling.

popup.text_color color

Text colour.

popup.align string


Allowed values:

  • left (fa-align-left)
  • center (fa-align-center)
  • right (fa-align-right)

popup.font_size number

Font size.

Min: 1

popup.fill_color color

Fill colour.

popup.opacity number

Fill opacity.

Max: 1

popup.padding number


popup.border_radius number

Radius. Corner radius of popup

Y axis

axis_font_size number

Font size.

axis_text_color color

Font colour.

axis_color color

Axis colour.

axis_width number

Axis width.

axis_dashoffset string

Axis dash. eg. 2,2

axis_labels_position string

Position of axis labels.

Allowed values:

  • top (Top)
  • bottom (Bottom)
  • hidden (Hidden)


controls.type string

Data type.

Allowed values:

  • categorical (Categories)
  • temporal (Dates/times)
  • numeric (Numbers)

controls.temporal_format string

Date/time format in data. The date/time format in your data sheet. Used only to sort the data, if required. If your format isn’t in the list, you can enter a custom format using d3-time-format syntax. See for details.

Predefined values:

  • %Y-%m-%dT%H:%M:%S.%LZ (1986-01-28T11:39:13.000Z)
  • %Y-%m-%d (1986-01-28)
  • %m/%d/%Y (01/28/1986)
  • %d-%b-%y (28-Jan-86)
  • %m/%Y (01/1986)
  • %b %Y (Jan 1986)
  • %B %d (January 28)
  • %d %b (28 Jan)
  • %Y (1986)
  • %B (January)
  • %b (Jan)
  • %A (Tuesday)
  • %a (Tue)
  • %X (11:39:13)
  • %H:%M %p (11:39 AM)
  • %H:%M (11:39)

controls.sort boolean

Sort menu.

controls.control string


Allowed values:

  • auto (Auto)
  • dropdown (Dropdown menu)
  • slider (Slider)
  • grouped-buttons (Button group)
  • floating-buttons (Buttons)

controls.width number

Menu width.

Min: 150

controls.play_button boolean

Include play button.

controls.step_time number

Time between steps when playing. Measured in seconds, positive values move the slider left to right, negative values move the slider right to left.

controls.loop boolean

Loop on play.

controls.restart_pause number

Pause before loop restarts. Measured in seconds and in addition to the regular step time displayed above.

controls.dropdown_icon_color color

Icon color.

controls.slider_handle_color color

Handle and button color.

controls.slider_track_color color

Track and label color.

Number formatting

localization.input_decimal_separator string

Decimal separator in data sheet. Used for interpreting your data. Only change if data is not displaying on the chart as expected.

Allowed values:

  • . (.)
  • , (,)

localization.output_separators string

Number format to display. How the numbers should appear on chart labels

Allowed values:

  • ,. (12,235.67)
  • ., (12.345,67)
  • . (12235.67)
  • , (12345,67)
  • . (12 235.67)
  • , (12 345,67)

formatting.prefix string

Prefix. Text to place in front of number

formatting.suffix string

Suffix. Text to place after number

formatting.n_dec number

Decimal places. Use negative integers to round to positive powers of ten (eg -2 rounds to the nearest 100)

Min: -10

Max: 10

formatting.strip_zeros boolean

Remove trailing zeros.

formatting.strip_separator boolean

Hide thousands separator below 10,000. Turn off if you want four-digit numbers to include a separator, e.g. “1,234” rather than “1234”.

formatting.transform_labels boolean

Multiply/divide values.

formatting.transform string

Allowed values:

  • multiply (Multiply by)
  • divide (Divide by)
  • exponentiate (×10 to the power of)

formatting.multiply_divide_constant number

formatting.exponentiate_constant number


animation_duration number

Animation duration. The duration of the animation (in milliseconds) when changing data or mode – for example between slides in a story



layout.body_font font


layout.max_width number

Maximum width. Leave blank to stretch to container width

Min: 50

layout.background_color color


layout.margin number


layout.layout_order string

Layout order.

Allowed values:

  • stack-default (data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAdCAYAAAHZdKxuAAAAAXNSR0IArs4c6QAAANhJREFUSA3tVNEOwiAM7Iy/p2/wkTz6g5gjOVZZEepcjMmWLBTau95ugIh6lpzzLcb4wNpFJaRk9MIahxAyXmD7mC7BC2RlFbliQjFMpJTujOdGs/ECwRoP3rlKoEzNJlz3+CwutK0NLRVt2QhjggA9n2IGEKANMxmt0VVsEfxgzfX7zL3ZiqbXLjcKc8vEORk5/75mMB/7u11uuIpdbtDCc5R3l/s+e+pmHt1foza7Nv6IXOeHiqGk9zWtSk1cN2cPrItnYjZzHZEZYtacxHTiuANSO/xN8AS4uW8Rw1Gu2AAAAABJRU5ErkJggg==)
  • stack-2 (data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAdCAYAAAHZdKxuAAAAAXNSR0IArs4c6QAAAMpJREFUSA3tVMsKwyAQNKW/l970Iz32Bw0jjKTrSLUY0oOBsO5rnOwYnTs9W0ppDyG8EcsOkw8uauu9T3jR2+75yJxBnnC4JxMxxlezg0V9VsJsIGz75TfKdlkpg3aPcT8TsPNRMJjZEIf5xaAAahUyE+RtfcZvtFLoFh95aFXxH4hCWpUoTCg7fxqUfB4yEcl/CJlNy5qbfuZA8m8CwJ77q2djSj50lnuAWbOAOQlXxCuRHxcUje2XzfgrYzBpHUXLkmxh181SpnEAB4Vg0DSGhHsAAAAASUVORK5CYII=)
  • stack-3 (data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAdCAYAAAHZdKxuAAAAAXNSR0IArs4c6QAAANFJREFUSA3tVEEOwyAMo9O+193gkRz3QSZHMmNRUkGp1guVqkCIHZMAITTfVkrZU0pv+B7NQpCV1vEdxxgLfmB9jEvwBBNzkjXn/HIRDOqzJs0GwS1eEmonAn52RITJaUYScd5KLl0fTQf58HVpIFlXMDPNBVMf2TDXPq7dZM2eelrMQ6uDucG50mlWzG/ooCWDvqENXldn1pcyhpgJWjYcPe5z5ZFrAgoe2LN0f2v1ZYq5UyofuiME99hFXKtUm1c9aoBmeEeRjVIQma6XpVblAwnpZjN/VjqsAAAAAElFTkSuQmCC)
  • stack-4 (data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABYAAAAdCAYAAAHZdKxuAAAAAXNSR0IArs4c6QAAANtJREFUSA3tVNEOwjAI3Iy/p2/tR/bRH6zekmuA1glO45bYZAHKcdDCOk1izbXWC+0zlJzzDVJ5sNGW9qSUKj4QKY8yWvBDUWnoKKVcTzS2yWHiIfeMwm2yIbLbRL3DRJYubi+0bAPCkcvapO3AdFgZvuDuyJZR2i4wSpBBP9ZD7RsOLQ9gD/Y5ZmaA3EEHWY6r3SEwrzDEHLpnlvOXa4/7xttZfhNwyPdKcqLPaz6JlXpr9bNgCfbobw2ch5iY0CQzyCOPR9ya5zleBPNy3LxknAbiv1YxExxH3gEqBW7I4zw3PQAAAABJRU5ErkJggg==)

layout.space_between_sections string

Space between sections.

Allowed values:

  • 0 (▁)
  • 0.5 (▃)
  • 1 (▄)
  • custom (...)

layout.space_between_sections_custom number


Max: 100


layout.header_align string


Allowed values:

  • left (fa-align-left)
  • center (fa-align-center)
  • right (fa-align-right)

layout.title string

layout.title_styling boolean

Change title styles.

layout.title_size string


Allowed values:

  • 1.4 (ᴀ)
  • 1.6 (A)
  • 2 (fa-font)
  • custom (...)

layout.title_size_custom number

Custom. Specify a custom responsive font size. Best results will be with values between 1.2 and 3

layout.title_weight string


Allowed values:

  • bold (Bold)
  • normal (Regular)

layout.title_color color


layout.title_line_height number

Line height.

Max: 3

layout.subtitle string

layout.subtitle_styling boolean

Change subtitle styles.

layout.subtitle_size string


Allowed values:

  • 1.4 (ᴀ)
  • 1.6 (A)
  • 2 (fa-font)
  • custom (...)

layout.subtitle_size_custom number

Custom. Specify a custom responsive font size. Best results will be with values between 1.2 and 3

layout.subtitle_weight string


Allowed values:

  • bold (Bold)
  • normal (Regular)

layout.subtitle_color color


layout.subtitle_line_height number

Line height.

Max: 3

layout.subtitle_space_above string

Space above.

Allowed values:

  • 0 (▁)
  • 0.5 (▃)
  • 1 (▄)
  • custom (...)

layout.subtitle_space_above_custom number


Max: 100

layout.text string

layout.text_styling boolean

Change text styles.

layout.text_size string


Allowed values:

  • 1.2 (ᴀ)
  • 1.4 (A)
  • 1.6 (fa-font)
  • custom (...)

layout.text_size_custom number

Custom. Specify a custom responsive font size. Best results will be with values between 1.2 and 3

layout.text_weight string


Allowed values:

  • bold (Bold)
  • normal (Regular)

layout.text_color color


layout.text_line_height number

Line height.

Max: 3

layout.text_space_above string

Space above.

Allowed values:

  • 0 (▁)
  • 0.5 (▃)
  • 1 (▄)
  • custom (...)

layout.text_space_above_custom number


Max: 100


layout.source_name string

Source name.

layout.source_url string

Source url.

layout.multiple_sources boolean

Multiple sources.

layout.source_name_2 string

Source name.

layout.source_url_2 string

Source url.

layout.source_name_3 string

Source name.

layout.source_url_3 string

Source url.

layout.source_label string

Source label.

layout.note string


layout.size number


layout.color color


layout.footer_align string


Allowed values:

  • left (fa-align-left)
  • center (fa-align-center)
  • right (fa-align-right)
  • justify (fa-align-justify)

layout.logo_url url



layout.logo_height number


layout.logo_margin number


layout.logo_order string


Allowed values:

  • left (Left)
  • right (Right)

layout.footer_align_vertical string

V. align.

Allowed values:

  • flex-start (Top)
  • center (Center)
  • flex-end (Bottom)