krispo / angular-nvd3

AngularJS directive for NVD3 reusable charting library (based on D3). Easily customize your charts via JSON API.
http://krispo.github.io/angular-nvd3
MIT License
1.29k stars 377 forks source link

Small chart (1621 length) already getting unresponsive #637

Open Jmales opened 7 years ago

Jmales commented 7 years ago

I'm using nvd3 to draw some charts in my Electron app.

With a small array with length of 1621 the app already gets somewhat unresponsive, and if I draw 2 more series in the same canvas it gets a lot unresponsive.

Using the Chrome developer tools I can see that 1 Chart is occupying 6.6Mb. Is this normal? Also, I see a lot of drawn things that I don't use like 2542 Objects of type d3_geom_voronoiEdge, 1320 Objects of type d3_geom_voronoiCircle, 8968 Objects of type d3_geom_voronoiBeach, 3509 entries on the DOM Tree (shouldn't I have ~1621 entries? ) and 3247 Objects of type SVGPathElement.

My data type is like: {x:"0",y:"10.2"}. Already tried parsing to float and the unresponsiveness is maintained.

My code:

this.optionsEx` = {
        chart: {
            type: "lineChart",
            //x: function(d){return d[0];},
            //y: function(d){return d[1];},
            useInteractiveGuideline: false,
            xDomain: null,
            clipVoronoi: false,
            xAxis: {
                axisLabel: "Time(s)",
                tickFormat: function(d){
                    return d3.format(",.1f")(d);
                }
            },
            yAxis: {
                axisLabel: "Y Axis",
                tickFormat: function(d){
                    return d3.format(",.2f")(d);
                },
            },
            zoom: {
                enabled: true,
                useFixedDomain: true,
                useNiceScale: false,
                horizontalOff: false,
                verticalOff: true,
                unzoomEventType: "dblclick.zoom"
            }
        }
    };

Edit: link to punkler demonstrating unresponsiveness.

The d3_geom_voronoiCircle and d3_geom_voronoiBeach objects don't seem to appear in plunker, don't know why.