首页 > 解决方案 > Echarts 库中是否有任何函数可以在 angulajs 中获取 SVG?

问题描述

我正在尝试在 angularjs 中获取 Echarts 元素的SVG,我搜索了很多但没有找到任何有用的解决方案。我需要一些像我在 highchart 中使用的功能:

    const chartContainerId = `#targetChart-${id}`;
        if ($(chartContainerId).highcharts()) {
            chartElementSVG = $(chartContainerId)
                .highcharts()
                .getSVG();
            $(chartContainerId).html(chartElementSVG);
        }

我现在正在使用 Echart 库,并希望重构此代码,以检查容器是否为 Echart 元素,如果是则 getSVG。任何帮助请..

标签: javascriptangularjssvgdomecharts

解决方案


您可以将较新版本的 eCharts 的渲染器指定为 SVG 而不是画布。

通过 Canvas 或 SVG 渲染 这可能会让您更轻松地提取 svg。


推荐阅读