It seems to me that this may just be a misunderstanding of how the logarithmic scales work, but I cannot get the D3 log databases to work.
In this script , I try to create three scales with the same set of base10 labels, with a base10 base scale, a base4 log scale, and a base2 scale scale. According to my unprofessional understanding of the logarithmic scales, the scale of the logarithmic scale 10 looks correct - the powers of ten are located at the same distance from each other on the axis. But the scales of base4 and base2 are identical - it seems to me that the labels should be compressed on the right on these two scales. What's happening?
Summary Code:
ticks = [1, 10, 100, 1000, 10000, 100000, 1000000, 10000000]
elems = { ten: 10, four: 4, two: 2 }
for selector, base of elems
dom = d3.select('.scale.' + selector)
scale = (new d3.scale.log()).base(base).domain([ 0.5, 10000000 ]).range([ 0, 500 ])
dom.selectAll('div')
.data(ticks)
.enter().append('div')
.text((x) -> x)
.style('left', (x) -> scale(x) + 'px')
source
share