Sha256: d2222b3b6991a3a42b31d81d54b4b1d12b25a5f87f3c6e8517cd992f3d7fe153

Contents?: true

Size: 684 Bytes

Versions: 4

Compression:

Stored size: 684 Bytes

Contents

var CoreChart = (function () {

  function initializeBarChart (chart) {
    var chartData = JSON.parse($(chart).find('.charts__metadata').html())

    var canvas = $(chart).find('.charts__canvas')[0]
    canvas.getContext('2d')

    var chartjs = new Chart(canvas, {
      type: chartData.chart_type,
      data: {
        labels: chartData.labels,
        datasets: chartData.datasets
      }
    })
  }

  function _initBarCharts () {
    var charts = $('.charts-bar')
    charts.each(function () {
      initializeBarChart(this)
    })
  }

  // Init:
  function init () {
    _initBarCharts()
  }

  return {
    init: init,
    initializeBarChart: initializeBarChart
  }

})()
  

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
lato_core-2.2.2 app/assets/javascripts/lato_core/modules/CoreChart.js
lato_core-2.2.0 app/assets/javascripts/lato_core/modules/CoreChart.js
lato_core-2.1.4 app/assets/javascripts/lato_core/modules/CoreChart.js
lato_core-2.1.3 app/assets/javascripts/lato_core/modules/CoreChart.js