Search code examples
iosionic-frameworkpngamcharts

AmCharts on iOS : Ranges aren't displayed correctly on export (Ionic App, AmCharts 4)


I'm looking for help as I really don't know where the bug would come from.

I have a chart in my Ionic App that is well displayed like that : chart well displayed

But when I export as png, the chart looks like that : badly displayed chart

The blue range totally changed here and I don't know why. Can you help me ?

The problem only appears on iOS


Solution

  • The problem is on amCharts JS library. If I comment a line in the case 1 of simplifiedImageExport function, this works well. Here is the line to delete :

    case 1:
                        _a.trys.push([1, 6, , 7]);
                        canvas = document.createElement("canvas");
                        canvas.width = 1;
                        canvas.height = 1;
                        // Line to delete
                        // ctx = canvas.getContext("2d");
                        DOMURL = this.getDOMURL();
                        svg = new Blob([this.normalizeSVG("<g></g>", {}, 1, 1)], {
                            type: "image/svg+xml"
                        });
                        url = DOMURL.createObjectURL(svg);
                        img = void 0;
                        _a.label = 2;