title: How to remove Failed to create chart: can't acquire context from the given item error while using it with Ruby on Rails?
body: <p>I installed frappe charts for ruby on rails through gem.</p>
  
  <p>Then I tried to run one of the frappe-chart code which is given in their <a href="https://frappe.github.io/charts/" rel="nofollow noreferrer">website</a>:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> let data = {
      labels: ["12am-3am", "3am-6am", "6am-9am", "9am-12pm",
        "12pm-3pm", "3pm-6pm", "6pm-9pm", "9pm-12am"],
  
      datasets: [
        {
          title: "Some Data",
          values: [25, 40, 30, 35, 8, 52, 17, -4]
        },
        {
          title: "Another Set",
          values: [25, 50, -10, 15, 18, 32, 27, 14]
        },
        {
          title: "Yet Another",
          values: [15, 20, -3, -15, 58, 12, -17, 37]
        }
      ]
    };
  
    let chart = new Chart({
      parent: "#note-graph", // or a DOM element
      title: "My Awesome Chart",
      data: data,
      type: 'bar', // or 'line', 'scatter', 'pie', 'percentage'
      height: 250,
  
      colors: ['#7cd6fd', 'violet', 'blue'],
      // hex-codes or these preset colors;
      // defaults (in order):
      // ['light-blue', 'blue', 'violet', 'red',
      // 'orange', 'yellow', 'green', 'light-green',
      // 'purple', 'magenta', 'grey', 'dark-grey']
  
      format_tooltip_x: d =&gt; (d + '').toUpperCase(),
      format_tooltip_y: d =&gt; d + ' pts'
    });</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;canvas id="note-graph"&gt;&lt;/canvas&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I also tried with div instead of canvas but it's always showing the same error.</p>