Avatar of Bob Schneider
Bob Schneider
Flag for United States of America

asked on 

Chart.js Question

Hi!  I am implementing a Chart.js into my classic ASP/SQL Server web page.  I have successfully implemented the "demo" code.  How can I replace the demo arrays for x and y with values from my db using classic asp?
                                <script>
                                    var xValues = [50,60,70,80,90,100,110,120,130,140,150];
                                    var yValues = [7,8,8,9,9,9,10,11,14,14,15];
                                    
                                    new Chart("myChart", {
                                    type: "line",
                                    data: {
                                        labels: xValues,
                                        datasets: [{
                                        fill: false,
                                        lineTension: 0,
                                        backgroundColor: "rgba(0,0,255,1.0)",
                                        borderColor: "rgba(0,0,255,0.1)",
                                        data: yValues
                                        }]
                                    },
                                    options: {
                                        legend: {display: false},
                                        scales: {
                                        yAxes: [{ticks: {min: 6, max:16}}],
                                        }
                                    }
                                    });
                                </script>

Open in new window

Thank you!
ASPJavaScriptMicrosoft SQL Server

Avatar of undefined
Last Comment
Bob Schneider

8/22/2022 - Mon