Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/core/config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export const DEFAULT_PROPS = {

// custom segment labels
customSegmentLabels: [],
// show custom segment labels and stops
showStopsAndCustomSegmentLabels: false,

// color strings
needleColor: 'steelblue',
Expand Down Expand Up @@ -116,6 +118,8 @@ export const getConfig = ({ PROPS, parentWidth, parentHeight }) => {

// custom segment labels
customSegmentLabels: PROPS.customSegmentLabels,
// show custom segment labels and stops
showStopsAndCustomSegmentLabels: PROPS.showStopsAndCustomSegmentLabels,

// max segment labels
maxSegmentLabels: calculateSegmentLabelCount({
Expand Down
4 changes: 3 additions & 1 deletion src/core/render/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,9 @@ export function _renderLabels({ config, svg, centerTx, r }) {
range,
})
// do not proceed
return
if (!config.showStopsAndCustomSegmentLabels) {
return
}
}

// normal label rendering
Expand Down
1 change: 1 addition & 0 deletions src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ declare module 'react-d3-speedometer' {
customSegmentStops?: number[]

customSegmentLabels?: CustomSegmentLabel[]
showStopsAndCustomSegmentLabels?: boolean

labelFontSize?: string
valueTextFontSize?: string
Expand Down