how do I convert pdf report chart to html-to-xlsx?



  • 0_1731436232703_upload-d2965fab-b7d6-4578-9bad-a37d794b9706
    <!-- GRAPHICS-->

    {{if graphTotal}}
    <canvas id="graph" class={{toJSON graphTotal.graphClass}}{{/toJSON}} style="margin:auto;margin-top:45px;"></canvas>
    <script>
        var chart = "graph";
        var ctx = document.getElementById(chart).getContext('2d');
        var myChart = new Chart(ctx, {
          type: {{toJSON graphTotal.graphType}}{{/toJSON}},
          data: {{toJSON graphTotal}}{{/toJSON}},
          options: {
               elements: {
                    line: {
                        tension: 0,
                        fill: false,
                    }
                },
                legend: {
                    display: false,
                    position: "bottom",
                },
                title: {
                    display: true,
                    text: {{toJSON graphTotal.graphTitle}}{{/toJSON}}
                },
                plugins: {
                    datalabels: {
                        display: {{if graphTotal.graphDatalabels == true}}"auto"{{else}}{{toJSON graphTotal.graphDatalabels}}{{/toJSON}}{{/if}},
                        color: "#fff",
                        formatter: function(value, context) {
                            return  value + ' ' + {{toJSON graphTotal.graphSymbol}}{{/toJSON}};
                        }
                    },                
                },
            scales:{
                    xAxes: [{
                        display: {{toJSON graphTotal.displayX}}{{/toJSON}},
                        stacked: {{toJSON graphTotal.graphX}}{{/toJSON}},
                        scaleLabel: {
                            display: {{toJSON graphTotal.scaleLabelDisplayX}}{{/toJSON}},
                            labelString: {{toJSON graphTotal.scaleLablelStringyX}}{{/toJSON}},
                        }                    
                    }],
                    yAxes: [{
                        display: {{toJSON graphTotal.displayY}}{{/toJSON}},
                        stacked: {{toJSON graphTotal.graphY}}{{/toJSON}},
                        ticks: {
                                beginAtZero: {{toJSON graphTotal.beginAtZeroY}}{{/toJSON}}
                            },
                        scaleLabel: {
                            display: {{toJSON graphTotal.scaleLabelDisplayY}}{{/toJSON}},
                            labelString: {{toJSON graphTotal.scaleLablelStringyY}}{{/toJSON}},
                        }
                    }]
                },   
            }
        });
    </script>
    {{/if}}
    


  • This recipe cannot convert your html/js chart into excel chart.

    However you can place your chart into the excel template and reference your future dynamic values
    https://jsreport.net/learn/html-to-xlsx#insert-output-into-xlsx-template
    https://playground.jsreport.net/w/admin/VvaGnaE_


Log in to reply
 

Looks like your connection to jsreport forum was lost, please wait while we try to reconnect.