Amcharts 用图像填充圆圈
Amcharts fill the circle with an image
我正在使用 amcharts 库制作示例。我要图片填满红圈
这是我尝试做的
icon.circle.strokeWidth = 0;
icon.image.properties.width = "100%";
icon.image.properties.height = "100%";
icon.image.properties.maxWidth = "100%";
icon.image.properties.maxHeight = "100%";
这是上传到 codePen
的完整代码片段
我声明我不精通 amcharts。
在你的示例中,我从
icon.circle.radius = am4core.percent(100);
icon.image.properties.scale = 1;
至
icon.circle.radius = am4core.percent(350);
icon.image.properties.scale = 3.5;
我得到了几乎要求的结果,带有漂亮的红色边框,将比例增加到大约 3.8,图像覆盖了所有红色表面。
即使没有也能正常工作。
icon.image.properties.width = "100%";
icon.image.properties.height = "100%";
icon.image.properties.maxWidth = "100%";
icon.image.properties.maxHeight = "100%";
可能在您最终应用该概念时,您需要执行更多计算以获得我更改的两个选项所需的比例...我不能说。
希望能给你一些建议。
我正在使用 amcharts 库制作示例。我要图片填满红圈
这是我尝试做的
icon.circle.strokeWidth = 0;
icon.image.properties.width = "100%";
icon.image.properties.height = "100%";
icon.image.properties.maxWidth = "100%";
icon.image.properties.maxHeight = "100%";
这是上传到 codePen
的完整代码片段我声明我不精通 amcharts。
在你的示例中,我从
icon.circle.radius = am4core.percent(100);
icon.image.properties.scale = 1;
至
icon.circle.radius = am4core.percent(350);
icon.image.properties.scale = 3.5;
我得到了几乎要求的结果,带有漂亮的红色边框,将比例增加到大约 3.8,图像覆盖了所有红色表面。
即使没有也能正常工作。
icon.image.properties.width = "100%";
icon.image.properties.height = "100%";
icon.image.properties.maxWidth = "100%";
icon.image.properties.maxHeight = "100%";
可能在您最终应用该概念时,您需要执行更多计算以获得我更改的两个选项所需的比例...我不能说。
希望能给你一些建议。