Skip to content

Instantly share code, notes, and snippets.

@dogrunjp
Created March 23, 2014 13:15
Show Gist options
  • Save dogrunjp/9722936 to your computer and use it in GitHub Desktop.
Save dogrunjp/9722936 to your computer and use it in GitHub Desktop.
D3.jsのテキストで特定の文字数以上の文字は途中から'…'などに文字を置き換える場合
chart1.append("text")
.text(function(d){if(d.Title.length <= 23){return d.Title;} else if (d.Title.length > 23){txt = d.Title.substr(0,21)+'…';return txt;}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment