|
Server IP : 10.128.40.6 / Your IP : 216.73.216.233 Web Server : Apache System : Linux webd006.cluster128.gra.hosting.ovh.net 5.15.206-ovh-vps-grsec-zfs-classid #1 SMP Fri May 15 02:41:25 UTC 2026 x86_64 User : logmcpe ( 111175) PHP Version : 7.3.33 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0755) : /home/logmcpe/www/TMCPRO/pages/ |
| [ Home ] | [ C0mmand ] | [ Upload File ] |
|---|
<?php
//Php code
//Months
$months = array('Janvier','February','March','April','May','June','July','August','September','October','November','December');
//first Data
$data_1 = array(28, 48, 40, 19, 75, 27, 25,12,54,45,95,70);
//Second Data
$data_2 = array(65, 59, 80, 81, 56, 55, 40,28, 48, 40, 19, 75)
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>ChartJS</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,400i,700&display=fallback">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/css/bootstrap.min.css" integrity="sha384-xOolHFLEh07PJGoPkLv1IbcEPTNtaed2xpHsD9ESMhqIYd0nLMwNLD69Npy4HI+N" crossorigin="anonymous">
<body>
<section class="content">
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<div class="card card-primary">
<div class="card-header bg-danger text-white">
<h3 class="card-title text-uppercase">Area Chart</h3>
</div>
<div class="card-body">
<div class="chart">
<canvas id="areaChart" style="min-height: 500px; height: 1000px; max-height: 250px; max-width: 100%;"></canvas>
</div>
</div>
<script src="https://code.jquery.com/jquery-3.6.1.js" integrity="sha256-3zlB5s2uwoUzrXK3BT7AX3FyvojsraNFxCc2vC/7pNI=" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.6.2/dist/js/bootstrap.bundle.min.js" integrity="sha384-Fy6S3B9q64WdZWQUiU+q4/2Lc9npb8tCaSX9FK7E8HnRr0Jz8D6OP9dO5Vg3Q9ct" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/Chart.js/2.9.4/Chart.bundle.min.js"></script>
<script>
$(function () {
/* ChartJS
* -------
* Here we will create a few charts using ChartJS
*/
//--------------
//- AREA CHART -
//--------------
// Get context with jQuery - using jQuery's .get() method.
var areaChartCanvas = $('#areaChart').get(0).getContext('2d')
var areaChartData = {
labels : <?php echo json_encode($months)?>,
datasets: [
{
label : 'Digital Goods',
backgroundColor : '#E97369',
borderColor : '#E97369',
pointRadius : true,
pointColor : '#3b8bba',
pointStrokeColor : 'rgba(60,141,188,1)',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(60,141,188,1)',
data : <?php echo json_encode($data_1)?>
},
{
label : 'Electronics',
backgroundColor : '#F3C2AE',
borderColor : '#F3C2AE',
pointRadius : true,
pointColor : 'rgba(210, 214, 222, 1)',
pointStrokeColor : '#c1c7d1',
pointHighlightFill : '#fff',
pointHighlightStroke: 'rgba(220,220,220,1)',
data : <?php echo json_encode($data_2)?>
},
]
}
var areaChartOptions = {
maintainAspectRatio : true,
responsive : true,
legend: {
display: true
},
scales: {
xAxes: [{
gridLines : {
display : true,
}
}],
yAxes: [{
gridLines : {
display : true,
}
}]
}
}
// This will get the first returned node in the jQuery collection.
new Chart(areaChartCanvas, {
type: 'line',
data: areaChartData,
options: areaChartOptions
})
//-------------
//- LINE CHART -
//--------------
})
</script>
</body>
</html>
