jQuery UI Widgets Forums Chart Any recommendations related to: Chart?

This topic contains 1 reply, has 2 voices, and was last updated by  admin 10 months, 3 weeks ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • Any recommendations related to: Chart? #136144

    sande
    Participant

    Is there a built-in method to export a jqxChart as a PNG image using jQuery?

    Any recommendations related to: Chart? #136158

    admin
    Keymaster

    Hi,

    jqxChart has a built-in export method that lets you save the chart as a PNG, JPEG, or even PDF.
    You don’t need extra libraries — it’s included in the widget.

      var sampleData = [
                    { Day: 'Monday', Sales: 30 },
                    { Day: 'Tuesday', Sales: 25 },
                    { Day: 'Wednesday', Sales: 40 },
                    { Day: 'Thursday', Sales: 35 },
                    { Day: 'Friday', Sales: 50 }
                ];
    
                $('#chart').jqxChart({
                    title: "Weekly Sales",
                    description: "Demo Chart",
                    enableAnimations: true,
                    showLegend: true,
                    source: sampleData,
                    xAxis: {
                        dataField: 'Day'
                    },
                    seriesGroups: [{
                        type: 'column',
                        series: [
                            { dataField: 'Sales', displayText: 'Sales' }
                        ]
                    }]
                });
    
                // Export on button click
                $('#exportBtn').on('click', function () {
                    $('#chart').jqxChart('export', 'png', 'WeeklySales.png');
                });

    Best regards,
    Peter Stoev

    jQWidgets Team
    https://www.jqwidgets.com/

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.