jiahuang / d3-timeline

Simple JS timeline plugin for d3
1.04k stars 280 forks source link

Add labelFunction method #59

Closed sleepycat closed 9 years ago

sleepycat commented 9 years ago

This method registers a callback function that will be called when the labels a being applied. This means that in cases where datum.label is an object like {en: "", fr: ""}, there is a way to select the right attribute.

Usage:

.labelFunction(function(label){ return label[currentLocale];})

I'm happy to rework this if you have some changes/improvements you would like me to make.

jiahuang commented 9 years ago

Thanks!