diff --git a/src/core/config/index.js b/src/core/config/index.js index dd25d98..b1a93e8 100644 --- a/src/core/config/index.js +++ b/src/core/config/index.js @@ -32,6 +32,8 @@ export const DEFAULT_PROPS = { // custom segment labels customSegmentLabels: [], + // show custom segment labels and stops + showStopsAndCustomSegmentLabels: false, // color strings needleColor: 'steelblue', @@ -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({ diff --git a/src/core/render/index.js b/src/core/render/index.js index 4947e51..040d2fc 100644 --- a/src/core/render/index.js +++ b/src/core/render/index.js @@ -141,7 +141,9 @@ export function _renderLabels({ config, svg, centerTx, r }) { range, }) // do not proceed - return + if (!config.showStopsAndCustomSegmentLabels) { + return + } } // normal label rendering diff --git a/src/index.d.ts b/src/index.d.ts index 7d3b6ec..0854c5e 100644 --- a/src/index.d.ts +++ b/src/index.d.ts @@ -81,6 +81,7 @@ declare module 'react-d3-speedometer' { customSegmentStops?: number[] customSegmentLabels?: CustomSegmentLabel[] + showStopsAndCustomSegmentLabels?: boolean labelFontSize?: string valueTextFontSize?: string