Skip to content
Snippets Groups Projects
chart.html 3.36 KiB
Newer Older
Rafael Ostertag's avatar
Rafael Ostertag committed
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Chart</title>
</head>
<body>

<div style="height: 1024px; width: 640px;">
    <h1>Runtime Comparison</h1>
    <canvas id="barchart" width="1240" height="640"></canvas>
    <canvas id="linechart" width="1240" height="640"></canvas>
    <canvas id="piechart" width="1240" height="640"></canvas>
</div>

<script src="../js/jquery.min.js"></script>
<script src="../js/Chart.min.js"></script>

<script>
    $(function () {
        var ctx = document.getElementById("barchart");
        var barChart = new Chart(ctx, {
            type: 'bar',
            data: {
                labels: ['C++', 'Java 8', 'JavaScript', 'Fortran'],
                datasets: [
                    {
                        label: "3,636 Forests",
                        data: [
                            0.01, 0.24, 0.04, 0.01
                        ],
                        backgroundColor: "steelblue"
                    },
                    {
                        label: "517,236 Forests",
                        data: [0.05, 0.62, 1.49, 1.95, 0.10,],
                        backgroundColor: "#91C3DC"
                    },
                    {
                        label: "2,600,836 Forests",
                        data: [0.35, 1.46, 8.70, 10.54, 0.96,],
                        backgroundColor: "#87907D"

                    }, {
                        label: "7,254,436 Forests",
                        data: [1.20, 3.58, 25.59, 29.94, 4.58,],
                        backgroundColor: "#AAB6A2"
                    }

                ]
            }
        });

        ctx = document.getElementById("linechart");
        var lineChart = new Chart(ctx, {
            type: 'line',
            data: {
                labels: ['C++', 'Java 8', 'JavaScript', 'Fortran'],
                datasets: [
                    {
                        label: "3,636 Forests",
                        data: [
                            0.01, 0.24, 0.04, 0.01
                        ],
                        backgroundColor: "steelblue"
                    },
                    {
                        label: "517,236 Forests",
                        data: [0.05, 0.62, 1.49, 1.95, 0.10,],
                        backgroundColor: "#91C3DC"
                    },
                    {
                        label: "2,600,836 Forests",
                        data: [0.35, 1.46, 8.70, 10.54, 0.96,],
                        backgroundColor: "#87907D"

                    }, {
                        label: "7,254,436 Forests",
                        data: [1.20, 3.58, 25.59, 29.94, 4.58,],
                        backgroundColor: "#AAB6A2"
                    }

                ]
            }
        });

        ctx = document.getElementById("piechart");
        var pieChart = new Chart(ctx, {
            type: 'pie',
            data: {
                labels: ['C++', 'Java 8', 'JavaScript', 'Fortran'],
                datasets: [
                    {
                        data: [1.20, 3.58, 25.59, 29.94, 4.58,],
                        backgroundColor: [
                            "steelblue",
                            "#91C3DC",
                            "#87907D",
                            "#AAB6A2"
                        ]
                    }
                ]
            }
        });
    });
</script>

</body>
</html>