Skip to content
This repository was archived by the owner on Sep 17, 2021. It is now read-only.

Fix #97 - handle possibility of null value for axis tick label #109

Merged
merged 1 commit into from
Mar 18, 2017
Merged
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
36 changes: 19 additions & 17 deletions src/Axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,23 +131,25 @@ export default class Axis extends Component {
let scaleBase = isNaN(c) ? i : c
let gxy = horizontal ? [scale(scaleBase),chartArea.y.min]:[chartArea.x.min,scale(scaleBase)]

let returnValue = <G key={i} x={gxy[0]} y={gxy[1]}>

{options.showTicks &&
<Circle r="2" cx="0" cy="0" stroke="grey" fill="grey" />
}

{options.showLabels &&
<Text x={xy[0]} y={xy[1]}
fontFamily={textStyle.fontFamily}
fontSize={textStyle.fontSize}
fontWeight={textStyle.fontWeight}
fontStyle={textStyle.fontStyle}
fill={textStyle.fill}
textAnchor={textAnchor}>
{label}
</Text>}
</G>
let returnValue
if (label !== undefined && label !== null) {
returnValue =
<G key={i} x={gxy[0]} y={gxy[1]}>
{options.showTicks &&
<Circle r="2" cx="0" cy="0" stroke="grey" fill="grey" />
}
{options.showLabels &&
<Text x={xy[0]} y={xy[1]}
fontFamily={textStyle.fontFamily}
fontSize={textStyle.fontSize}
fontWeight={textStyle.fontWeight}
fontStyle={textStyle.fontStyle}
fill={textStyle.fill}
textAnchor={textAnchor}>
{label}
</Text>}
</G>
}

return returnValue
})
Expand Down