Home Forums Front-end Issues Using chart.js in custom field


Using chart.js in custom field

  • Hi guys,

    I am trying to use custom field to implement chart.js

    This is the required code.

    <canvas id=”doughnut-chart”width=”350″ height=”350″></canvas>

    <canvas id=”bar-chart-horizontal”width=”150″ height=”250″></canvas>

    new Chart(document.getElementById(“doughnut-chart”), {
    type: ‘doughnut’,
    data: {
    labels: [“#ofthing1”, “#ofthing2”, “#ofthing3”, “#ofthing4”],
    datasets: [
    label: “%”,
    backgroundColor: [“rgba(255,159,193,0.7)”, “rgba(254,229,169,0.7)”,”rgba(153,207,244,0.7)”,”rgba(164,222,222,0.7)”],
    data: [33,18,40,3.8]
    options: {
    maintainAspectRatio: false,
    title: {
    fontSize: 20,
    display: true,
    text: ‘titletext’


    what is a correct way to do this?

Viewing 1 post (of 1 total)

The topic ‘Using chart.js in custom field’ is closed to new replies.