Skip to content

New template:slope chart ✨ + adjust helpers - #387

Open
henryjameslau wants to merge 7 commits into
mainfrom
356-slope-chart
Open

New template:slope chart ✨ + adjust helpers#387
henryjameslau wants to merge 7 commits into
mainfrom
356-slope-chart

Conversation

@henryjameslau

Copy link
Copy Markdown
Contributor

Key changes to createDirectLabels helper function, in the options object: - labelStrategy can be set as 'firstLast'

  • includeDataValue is a boolean and make the labels include the data value
  • valueFormatter is a function to format the data value in the label. It's default is d3.format(",f") which just does comma thousand separators
  • colourMap is a Map object which provides a category to colour lookup. This is used to override the categorical colour lookup, so you can do directional colours on the slope map.

I've also had so create a new wrapStyled function which wraps text elements with nested tspans for situations where you want one tspan to be bold like in the slope chart design.

Addresses #356

Please review for style @broadpeter, and for functionality anyone else.

@henryjameslau henryjameslau linked an issue Jan 9, 2026 that may be closed by this pull request
@henryjameslau

Copy link
Copy Markdown
Contributor Author

Ready for review @sam-ctrl

@nrennie nrennie left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've fixed the conflicts and I'm happy with the code.

@nrennie

nrennie commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

@broadpeter Are you happy with the style on this template? Any changes?

image

@broadpeter

broadpeter commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Needs colour contrast boost to 1:4.5 on the regular weight text. I will try to add.
I also want to look at the leader lines label position

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slope chart

4 participants