• Resolved takuyakato

    (@takuyakato)


    Hello,
    I’d like to put a pie chart of the Quiz result on result page,
    I wrote it in HTML and javascript but it may doesn’t work in [class-qsm-results-pages.php], I am wondering where should I Insert it?
    here is my HTML and javascript code.

    [HTML]
    <p>this is your quiz result chart.</p>
    <p>number of correct answers you had : <span id=”Correnct”>%AMOUNT_CORRECT%</span></p>
    <!– read Chart.js –>
    <script src=”https://cdnjs.cloudflare.com/ajax/libs/Chart.js/1.0.2/Chart.min.js”></script&gt;
    <!–draw pie chart –>
    <canvas id=”mycanvas” height=”250″ width=”250″></canvas>

    – – – – – – – –
    [javascript]
    var %AMOUNT_CORRECT% = document.getElementById(‘Correnct’).value;
    %AMOUNT_CORRECT% = Number(%AMOUNT_CORRECT%);

    var data = [
    {
    value: %AMOUNT_CORRECT%,
    color:”#F7464A”,
    highlight: “#FF5A5E”,
    label: “Correct Answers”
    },
    {
    value: 100 – %AMOUNT_CORRECT%,
    color: “#46BFBD”,
    highlight: “#5AD3D1”,
    label: “Incorrect Answers”
    }
    ];

    var myChart = new Chart(document.getElementById(“mycanvas”).getContext(“2d”)).Doughnut(data);

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How can I put a pie chart on the result page?’ is closed to new replies.