如何将SVG和字体过滤器应用于amcharts4?

问题描述:

我正在尝试将过滤器应用于我的JS对象,其中<%=strKey%>是动态编写脚本的对象名称,因此,每次迭代时,名称都会更改.

I am trying to apply filters to my JS object, where <%=strKey%> is a dynamically scripted object name, so, each iteration, the name changes.

        // dynamically writing JS - key value is the chart name
        var <%=strKey%> = am4core.create("<%=strKey%>", am4charts.GaugeChart);      // has to mach the HTML IDs
        <%=strKey%>.innerRadius = am4core.percent(82);    // innerRadius begins at 82%, leaving white-space inside the gauge

文档仅列出JSON格式.我如何将其应用到我的实施中?

The documentation lists JSON format only. How would I apply this to my implementation?

我实际上是想让阴影出现在半圆规的下面.有建议吗?

I'm actually trying to get a shadow to appear under the semi-circular gauge. Suggestions please?

您可以只使用

You can just use a DropShadowFilter to add a shadow to your chart:

chart.filters.push(new am4core.DropShadowFilter());

您可以使用blurdxdy自定义阴影:

You can use blur, dx and dy to customize the shadow:

var shadow = new am4core.DropShadowFilter();
shadow.blur = 3.5;
shadow.dx = 5;
shadow.dy = 7;
chart.filters.push(shadow);

此处是显示该阴影的代码笔.要创建自定义SVG过滤器,您可以遵循此官方教程.

Here is a code pen showing that shadow. To create a custom SVG filter you can follow this official tutorial.