Note that there are some explanatory texts on larger screens.

plurals
  1. POd3.js and nvd3.js how to show graph for number of clicks on a website
    primarykey
    data
    text
    <p>I want to give the user flexibility to choose the datetime range and see the graph of number clicks during that period. The range could be anything like 1 year, 6 month, 1 month, 1 week , 1 day or last 6 hours... At any point of time there is exactly 1 click. So, my dataset is as :</p> <pre><code>Time Click 2012-01-01 01:00:00 1 2012-01-01 02:00:00 1 2012-01-01 03:10:00 1 2012-01-01 03:20:01 1 2012-06-02 11:00:00 1 2012-12-01 01:00:00 1 2013-05-01 12:00:00 1 </code></pre> <p>The graph should be able to adjust it's x-axis as per what the data is available to it. For example if we are checking a days data then it should show HH:00 range and if we are looking for a week data then it should Mon-Tue-Wed like range.</p> <p>My sample code looks like this:</p> <pre><code> `chart.xAxis.showMaxMin(false).tickFormat(function(d) { return d3.time.format('%x')(new Date(d)) }); chart.yAxis.tickFormat(d3.format(',.2f')); d3.select('#chart1 svg') .datum(jsonData) .call(chart);` </code></pre> <p>How to handle the aggregation of the data point? Do I have to provide the data set with the aggregation or chart can do it itself by providing it some function.</p> <hr> <h2>Update</h2> <hr> <p>I tried with rollup and found it gives some aggregation to my data now.</p> <pre><code>rollup = d3.nest().key(function(d) { return (new Date(+d[0])).getMonth(); }).rollup(function(d) { return d3.sum(d, function(e) { return +e[1]; }); }).entries(jsonDataValues) .map(function(d) {data.push([d.key,d.values])}); </code></pre> <p>It aggregates the data on basis of the month. It needs to be modified to be more flexible so that it adjusted itself for the given range (May be domain is my friend here ?)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload