dc.js icon indicating copy to clipboard operation
dc.js copied to clipboard

LineChart filtering

Open pdaems opened this issue 13 years ago • 8 comments

Im trying to create a lineChart which shows all the querytimes based on the date. However im trying to display it on seconds. But this causes the page to load extremely long it seems like the rendering can't keep up.

Also the filtering doesn't seem right whenever i click on a pie Chart the lineChart doesn't filter correctly. If i select a range in my volumeChart just like in nasdaq example the chart won't filter correctly aswell.

                                var querytime = calls.dimension(function (d) {
                                    return d3.time.seconds(d.dd);
                                });



                                var querytimegroup = querytime.group().reduce(
                                    function (p, v) {
                                        p.querytime = +v[6];
                                        return p;
                                    }, function (p, v) {
                                        p.querytime = +v[6];
                                        return p;
                                    }, function () {
                                        return { querytime: 0 };


                                    }
                                    );

pdaems avatar Apr 10 '13 07:04 pdaems

To get a better for your lineChart, turn off renderArea and renderTitle so that there is less to render.

As for your second problem, you are doing assignment in your map/reduce functions rather than addition/subtraction

...
function (p, v) {
    p.querytime += +v[6];
    return p;
} , function (p, v) {
    p.querytime -= +v[6];
    return p;
} ...

leotcsun avatar Apr 10 '13 14:04 leotcsun

Another question maybe is it possible that the volumeChart in the example zooms in on its own selection so if you select a range from 2000-2001 then it would zoom in on the months of the year 2000.

pdaems avatar Apr 11 '13 07:04 pdaems

hmm.. interesting question. I just tried this in javascript console and it works (sort of):

volumeChart.focus(volumeChart.filter())

but you need to also clear the brush since it will be out of sync.

NickQiZhu avatar Apr 11 '13 15:04 NickQiZhu

Alright will try that tomorrow would be pretty cool if the dimension from the lineChart like in the example would change aswell if you drill down in the volumeChart. So first you would see avg querytime on a year then on a month and so on.

Is their a quick way to clear the brush ?

pdaems avatar Apr 11 '13 21:04 pdaems

It is definitely something interesting. As a matter of fact this is exactly what we have done in some commercial engagement with MongoDB however currently crossfilter does not support drill down/up. I was hoping once I had some time I could experiment something like this. Hopefully my schedule will calm down eventually to allow me to do something like this.

NickQiZhu avatar Apr 13 '13 00:04 NickQiZhu

Alright sounds cool. Btw how can i clear the brush in the barChart ? I tried barChart.brush().clear(); but this basically covers the entire area.

image

pdaems avatar Apr 13 '13 10:04 pdaems

try chart.filter(null)

NickQiZhu avatar Apr 13 '13 19:04 NickQiZhu

Didn't seem to work makes the page crash.

          volumeChart.brush().clear();
          volumeChart.brush().x(null);

This kinda worked however the filtering doesn't seem to apply to the range that you select the second time that you filter.

If you filter again for the second time the brush basically filters again on the values of the first X-axis

pdaems avatar Apr 15 '13 06:04 pdaems