Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // JS property
- $label = "";
- // JS property
- $data = [];
- $host = "192.168.0.29";
- $user = "root";
- $password = "";
- $database = "ocomon_rc6";
- $connection = mysqli_connect($host, $user, $password, $database);
- if (!$connection) {
- die("Connection failed: " . mysqli_connect_error());
- }
- $sql = "SELECT * FROM view_chamadosrow";
- $result = mysqli_query($connection, $sql);
- /** @noinspection PhpAssignmentInConditionInspection */
- while ($row = mysqli_fetch_assoc($result)) {
- $label = $row["TEC"];
- unset($row["TEC"]);
- $data[] = $row;
- }
- mysqli_close($connection);
- ?>
- <!doctype html>
- <html>
- <head>
- <title>Line Chart</title>
- <script src="dist/Chart.bundle.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:75%;">
- <canvas id="canvas"></canvas>
- </div>
- <script>
- var config = {
- type: 'line',
- data: {
- labels: ["1", "2", "3",
- "4", "5", "6",
- "7", "8", "9",
- "10", "11", "12",
- "13", "14", "15",
- "16", "17", "18",
- "19", "20", "21",
- "22", "23", "24",
- "25", "26", "27",
- "28", "29", "30",
- "31"],
- datasets: [{
- label: "<?php echo "$label"; ?>",
- data: "<?php echo json_encode($data, JSON_NUMERIC_CHECK); ?>"
- }]
- },
- options: {
- responsive: true,
- title: {
- display: true,
- text: 'CONTROLE DE CHAMADOS FECHADOS'
- },
- tooltips: {
- mode: 'index',
- intersect: false,
- },
- hover: {
- mode: 'nearest',
- intersect: true
- },
- scales: {
- xAxes: [{
- display: true,
- scaleLabel: {
- display: true,
- labelString: 'Dias'
- }
- }],
- yAxes: [{
- display: true,
- scaleLabel: {
- display: true,
- labelString: 'Quantidades'
- }
- }]
- }
- }
- };
- window.onload = function () {
- var ctx = document.getElementById("canvas").getContext("2d");
- window.myLine = new Chart(ctx, config);
- };
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement