Skip to content

Commit

Permalink
feat(labels): use alignmentBaseline instead of approximative dy
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphaël Benitte committed Aug 19, 2017
1 parent 755783d commit 10aa40f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/components/charts/bubble/Bubble.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ const createNodes = ({
labelFormat,
labelSkipRadius,
labelTextColor,
labelTextDY,
}) => {
const label = getLabelGenerator(_label, labelFormat)
const borderColorFn = getColorGenerator(borderColor)
Expand All @@ -47,7 +46,6 @@ const createNodes = ({
<circle
key={`${node.key}.circle`}
r={node.style.r}
className="nivo_bubble_node"
transform={`translate(${node.style.x},${node.style.y})`}
onMouseEnter={handleTooltip}
onMouseMove={handleTooltip}
Expand All @@ -73,10 +71,9 @@ const createNodes = ({
renderedNodes.push(
<text
key={`${node.key}.text`}
className="nivo_bubble_legend"
transform={`translate(${node.style.x},${node.style.y})`}
textAnchor={'middle'}
dy={labelTextDY}
textAnchor="middle"
alignmentBaseline="central"
style={{
fill: textColorFn(node.style),
pointerEvents: 'none',
Expand Down
1 change: 0 additions & 1 deletion src/components/charts/bubble/BubbleProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export const bubbleDefaultProps = {
enableLabel: true,
label: 'id',
labelTextColor: 'inherit:darker(1)',
labelTextDY: 5,
labelSkipRadius: 0,

// transitions
Expand Down
2 changes: 1 addition & 1 deletion src/components/charts/treemap/TreeMapNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const TreeMapNode = ({
{hasLabel &&
<text
textAnchor="middle"
dy="0.5em"
alignmentBaseline="central"
style={{ fill: labelTextColor, pointerEvents: 'none' }}
transform={`translate(${width / 2},${height / 2}) rotate(${labelRotation})`}
>
Expand Down

0 comments on commit 10aa40f

Please sign in to comment.