ovko
ovko

Reputation: 1

d3.js calendar view - colours + custom date

I have a few questions regarding his calendar view of mine http://bl.ocks.org/mhska/5333055

enter image description here

data ranges from 1 to 4317 so the colours are not very "evenly" distributed. is there any way to improve it? (i mean basically everything below 100 is just one red colour)

is there a way to change the date format when you hover over the field from yyy-mm-dd to dd-mm-yyyy?

how could one change the colour of fields with no data? (generally this means weekends) at the moment the fileds with no data and with most data (over 1000) are of the same colour.

thanks a bunch.

Upvotes: 0

Views: 1816

Answers (1)

Lars Kotthoff
Lars Kotthoff

Reputation: 109232

You can change the date format that is displayed by adapting the line

date = d3.time.format("%Y-%m-%d")

More information on the specifiers can be found in the documentation.

For changing the colour, you need to provide a different function for mapping values to colours. It looks like you're currently mapping your input values to only 40 output colours.

.range(d3.range([40]))

Increasing this number might be a good starting point. Note that you can provide an arbitrary function, in particular you could handle missing values separately in it.

Upvotes: 3

Related Questions