d3.js liquid fill gauge clip-path not working

前端 未结 2 1289
走了就别回头了
走了就别回头了 2021-01-26 20:40

I\'m trying to use d3.js liquid fill gauge in my angular2 webapp, but the clippath not working, which means there\'s no wave created at all.

rather than

Since

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-26 21:16

    You need to add location.href to the clip-path in liquidFillGauge.js

    this:

    var fillCircleGroup = gaugeGroup.append("g")
        .attr("clip-path", "url(#clipWave" + elementId + ")");
    

    becomes this:

    var fillCircleGroup = gaugeGroup.append("g")
        .attr("clip-path", "url(" + location.href + "#clipWave" + elementId + ")");
    

    Here's my fork of the gist with the fix applied. https://gist.github.com/jonbgallant/e85bc5440a4372aff9452e15a4e3276c

提交回复
热议问题