My needs are very similar to those of this question, where a series of records like:
var data = [
// time, text, temperature, count
['1379952000', 'field_1', 91, 56],
['1379952000', 'field_2', 50, 20],
['1379952000', 'field_3', 88, 24],
['1379952000', 'field_4', 50, 37],
['1379953200', 'field_1', 97, 58],
['1379953200', 'field_2', 84, 86],
['1379953200', 'field_3', 85, 62],
['1379953200', 'field_4', 88, 73]
// etc.
];
Need to be plotted as a set of time series lines, each series corresponding to each unique value of the text
field (i.e. field_1
, field_2
, etc.). A working possible implementation was given in the answer to that question here. However, I need the series to be plotted as bars.
I figured I should check how is dc.js's seriesChart
class implemented and try to fork it to use barChart
instead of lineChart
as its internal plotting function. You can find the result here. (See the file seriesbarchart.js
and compare to the source)
The one flaw my test has is the single-pixel width the bars come out with. I'm a newbie to this Web world of Javascript/HTML/CSS and even more so about D3 and dc.js. Can somebody knowledgeable give me a hand with this? Thanks in advance.