use d3 scales instead of custom functions

Change-Id: I066cb3cfc58eb49b9b9f623f3526aca92a31492e
Reviewed-on: http://review.couchbase.org/31525
Tested-by: buildbot <build@couchbase.com>
Reviewed-by: Pavel Paulau <pavel.paulau@gmail.com>