Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

textwrap with text containing "." expands to ".." #427

Closed
rmatejka opened this issue Feb 18, 2016 · 4 comments
Closed

textwrap with text containing "." expands to ".." #427

rmatejka opened this issue Feb 18, 2016 · 4 comments
Assignees

Comments

@rmatejka
Copy link

I'm using d3Plus to wrap IP addresses and it works great except for this odd edge case. When passed "10.199.2.4", it is rendered as "10.199..2.4". Same occurs for "10.199.0.3". This is the call I'm using:

d3plus.textwrap()
.container(nodeText)
.x(-69)
.width(138)
.resize(false)
.padding(0)
.text("10.199.2.4")
.draw();

OUTPUT:
<text xmlns="http://www.w3.org/2000/svg" class="nodeName resolution-big bg-success" font-size="11px" style="font-size: 11px;" text-anchor="middle" transform="rotate(0) translate(0 -2.42)" x="-69" y="35"><tspan style="baseline-shift: 0%;" dominant-baseline="alphabetic" x="0px" dy="12.1px">10.199..2.4</tspan></text>

@davelandry davelandry self-assigned this Feb 19, 2016
@davelandry
Copy link
Member

Great catch, thanks!

NikkiDreams added a commit to NikkiDreams/d3plus that referenced this issue Mar 14, 2016
* commit 'c4e523868bab4c2d29a858667fbb26d0563c892d': (26 commits)
  adds resize support for D3 selections (d3plus#433)
  adds specific ID to window resize event (d3plus#433)
  fixes d3plus#433, responsive layout
  fixes hide/isolate buttons
  fixes tree map percentages and closes d3plus#218
  removes period from default textwrap split (closes d3plus#442)
  adds textwrap support for multiple spaces
  Remove deprecated SVGElement.offsetHeight property
  adds new "area" type (closes d3plus#284)
  compiled v1.9.1
  bump to v1.9.1
  fixes IP address textwrapping (closes d3plus#427)
  fixes edge label background in IE (d3plus#428)
  fixes back button position in IE (closes d3plus#428)
  removes y axis labels from box plot (closes d3plus#426)
  adds text stroke catches for use with canvg
  change numeric to numeric.js
  adds back buttons to rings and sankey
  mouse pointer only appears when clickable
  fixes rotated bar chart label positioning on redraw
  ...

# Conflicts:
#	d3plus.full.js
#	d3plus.full.min.js
#	d3plus.js
#	d3plus.min.js
#	package.json
@rmatejka
Copy link
Author

I just had a chance to pull latest and revert my code to set the split array manually - but the original problem is back - not splitting on period. Am I not making the call correct?

d3plus.textwrap()
.container(nodeText)
.x(leftSideOffset)
.width(textLabelWidth)
.resize(false)
.padding(0)
.text({ value: label, split: ["-", "/", ";", ":", "&", "."] }) /// Added "."
.draw();

@davelandry
Copy link
Member

@rmatejka whoops, sorry about that. Don't know what happened, but it's fixed now. Will be a part of the next release.

@rmatejka
Copy link
Author

Chuckle - been there - way too any times! Thanks.

bryanph pushed a commit to bryanph/d3plus that referenced this issue May 18, 2016
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

No branches or pull requests

2 participants