dc/d3 line chart crashing down to 0 on the y axis after filtering

前端 未结 2 2145
北恋
北恋 2020-12-22 02:03

When I apply a dimension filter to a dc.js graph, there are ugly lines where the line plummets towards the y axis.

2条回答
  •  不知归路
    2020-12-22 02:06

    Two possible solutions, depending whether you want the line connected or in sections:

    1. Pre-filter the data so that instead of having groups that sum to zero, there aren't groups there at all. This will connect the points with a line segment over the missing data. https://github.com/dc-js/dc.js/wiki/FAQ#filter-the-data-before-its-charted

    2. Use lineChart.defined to put gaps/breaks in the line where there is no data. https://github.com/dc-js/dc.js/blob/master/web/docs/api-latest.md#definedvalue

提交回复
热议问题