Chartjs-How to add another dataset bar with chart.js

1👍

I knew I was close! it was all a matter of proper positioning of " comma’s, brackets, ect "

data: {
  labels: ["<?php echo $barista_pass_code[1] ?>", "<?php echo $barista_pass_code[2] ?>", "<?php echo $barista_pass_code[3] ?>",
    "<?php echo $barista_pass_code[4] ?>", "<?php echo $barista_pass_code[5] ?>", "<?php echo $barista_pass_code[6] ?>",
    "<?php echo $barista_pass_code[7] ?>", "<?php echo $barista_pass_code[8] ?>", "<?php echo $barista_pass_code[9] ?>",
      "<?php echo $barista_pass_code[10] ?>", "<?php echo $barista_pass_code[11] ?>", "<?php echo $barista_pass_code[12] ?>"],
  datasets: [{
    label: "Regular Punches",
    backgroundColor: "rgba(2,117,216,1)",
    borderColor: "rgba(2,117,216,1)",
    data: [<?php echo $last_regular_qty[1] ?>, <?php echo $last_regular_qty[2] ?>, <?php echo $last_regular_qty[3] ?>,
    <?php echo $last_regular_qty[4] ?>, <?php echo $last_regular_qty[5] ?>, <?php echo $last_regular_qty[6] ?>,
    <?php echo $last_regular_qty[7] ?>,<?php echo $last_regular_qty[8] ?>,<?php echo $last_regular_qty[9] ?>,
    <?php echo $last_regular_qty[10] ?>, <?php echo $last_regular_qty[11] ?>, <?php echo $last_regular_qty[12] ?> ]},
    {
    data: [<?php echo $last_regular_qty[1] ?>, <?php echo $last_regular_qty[2] ?>, <?php echo $last_regular_qty[3] ?>,
    <?php echo $last_regular_qty[4] ?>, <?php echo $last_regular_qty[5] ?>, <?php echo $last_regular_qty[6] ?>,
    <?php echo $last_regular_qty[7] ?>,<?php echo $last_regular_qty[8] ?>,<?php echo $last_regular_qty[9] ?>,
    <?php echo $last_regular_qty[10] ?>, <?php echo $last_regular_qty[11] ?>, <?php echo $last_regular_qty[12] ?> ]

  }]
},

Leave a comment