%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.149 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/11584/cwd/html/ppaobm/vendor/bower-asset/chartjs/samples/scales/time/ |
Upload File : |
<!doctype html> <html> <head> <title>Line Chart</title> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script> <script src="../../../dist/Chart.min.js"></script> <script src="../../utils.js"></script> <style> canvas { -moz-user-select: none; -webkit-user-select: none; -ms-user-select: none; } </style> </head> <body> <div style="width:1000px"> <canvas id="chart1"></canvas> </div> <br> <br> Chart Type: <select id="type"> <option value="line">Line</option> <option value="bar">Bar</option> </select> <button id="update">update</button> <script> function randomNumber(min, max) { return Math.random() * (max - min) + min; } function randomBar(date, lastClose) { var open = randomNumber(lastClose * 0.95, lastClose * 1.05).toFixed(2); var close = randomNumber(open * 0.95, open * 1.05).toFixed(2); return { t: date.valueOf(), y: close }; } var dateFormat = 'MMMM DD YYYY'; var date = moment('April 01 2017', dateFormat); var data = [randomBar(date, 30)]; while (data.length < 60) { date = date.clone().add(1, 'd'); if (date.isoWeekday() <= 5) { data.push(randomBar(date, data[data.length - 1].y)); } } var ctx = document.getElementById('chart1').getContext('2d'); ctx.canvas.width = 1000; ctx.canvas.height = 300; var color = Chart.helpers.color; var cfg = { type: 'bar', data: { datasets: [{ label: 'CHRT - Chart.js Corporation', backgroundColor: color(window.chartColors.red).alpha(0.5).rgbString(), borderColor: window.chartColors.red, data: data, type: 'line', pointRadius: 0, fill: false, lineTension: 0, borderWidth: 2 }] }, options: { scales: { xAxes: [{ type: 'time', distribution: 'series', ticks: { source: 'data', autoSkip: true } }], yAxes: [{ scaleLabel: { display: true, labelString: 'Closing price ($)' } }] }, tooltips: { intersect: false, mode: 'index', callbacks: { label: function(tooltipItem, myData) { var label = myData.datasets[tooltipItem.datasetIndex].label || ''; if (label) { label += ': '; } label += parseFloat(tooltipItem.value).toFixed(2); return label; } } } } }; var chart = new Chart(ctx, cfg); document.getElementById('update').addEventListener('click', function() { var type = document.getElementById('type').value; chart.config.data.datasets[0].type = type; chart.update(); }); </script> </body> </html>