Graph chart

To create a graph chart in HTML, you can use various JavaScript charting libraries. One popular choice is Chart.js. Here's a simple example: Chart Example

1. Include the Chart.js library in your HTML file. You can either download it and include it locally or use a CDN:

```html
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Chart Example</title>
  <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
</head>
<body>
  <canvas id="myChart" width="400" height="400"></canvas>

  <script>
    // Your chart data
    var data = {
      labels: ['Label 1', 'Label 2', 'Label 3', 'Label 4', 'Label 5'],
      datasets: [{
        label: 'My Chart',
        data: [10, 20, 15, 25, 30],
        backgroundColor: 'rgba(75, 192, 192, 0.2)',
        borderColor: 'rgba(75, 192, 192, 1)',
        borderWidth: 1
      }]
    };

    // Get the canvas element and render the chart
    var ctx = document.getElementById('myChart').getContext('2d');
    var myChart = new Chart(ctx, {
      type: 'bar',
      data: data,
    });
  </script>
</body>
</html>
```

This example creates a bar chart. You can customize the chart type, labels, data, and appearance based on your specific needs. Check the Chart.js documentation for more customization options: https://www.chartjs.org/docs/latest/
Previous
Next Post »