0

I am trying to export the chart as image but no luck.

I tried searching online but could not find the way am using the google chart

my controller

       $scope.chartObject = {
            "type": "PieChart",
            "displayed": true,
            "data": {
                "cols": [
                {
                    "id": "month",
                    "label": "Month",
                    "type": "string",
                    "p": {}
                },
                {
                    "id": "laptop-id",
                    "label": "Laptop",
                    "type": "number",
                    "p": {}
                },
                {
                    "id": "desktop-id",
                    "label": "Desktop",
                    "type": "number",
                    "p": {}
                },
                {
                    "id": "server-id",
                    "label": "Server",
                    "type": "number",
                    "p": {}
                },
                {
                    "id": "cost-id",
                    "label": "Shipping",
                    "type": "number"
                }
                ],
                "rows": [
                {
                    "c": [
                    {
                        "v": "January"
                    },
                    {
                        "v": 19,
                        "f": "42 items"
                    },
                    {
                        "v": 12,
                        "f": "Ony 12 items"
                    },
                    {
                        "v": 7,
                        "f": "7 servers"
                    },
                    {
                        "v": 4
                    }
                    ]
                },
                {
                    "c": [
                    {
                        "v": "February"
                    },
                    {
                        "v": 13
                    },
                    {
                        "v": 1,
                        "f": "1 unit (Out of stock this month)"
                    },
                    {
                        "v": 12
                    },
                    {
                        "v": 2
                    }
                    ]
                },
                {
                    "c": [
                    {
                        "v": "March"
                    },
                    {
                        "v": 24
                    },
                    {
                        "v": 5
                    },
                    {
                        "v": 11
                    },
                    {
                        "v": 6
                    }
                    ]
                }
                ]
            },
            "options": {
                "title": "Sales per month",
                "isStacked": "true",
                "fill": 20,
                "displayExactValues": true,
                "vAxis": {
                    "title": "Sales unit",
                    "gridlines": {
                        "count": 10
                    }
                },
                "hAxis": {
                    "title": "Date"
                }
            },
            "formatters": {}
        };

HTML code

    <div google-chart chart="chartObject" style="{{cssStyle}}"></div>

Is there any option other than google.visualization?

1 Answer 1

1

I think you can export google chart as images by canvas. Now, i am using html2canvas to capture my chart and export it as PNG file

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.