Created
May 17, 2020 00:08
-
-
Save gavilanch/3c3778858fb0798cbf9527c44d8b9735 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function initializeCounterComponent(container) { | |
var chart = container.querySelector('#myChart'); | |
inicializarChart(chart); | |
var boton = container.querySelector("#counterClick"); | |
var title = container.querySelector("h1"); | |
if (boton) { | |
boton.addEventListener("click", (e) => { | |
let button = e.target; | |
button.innerHTML = "Hola"; | |
title.innerHTML = "El botón ha sido clickeado!"; | |
}); | |
} | |
var $fechaEntrada = $(container.querySelector('#fechaEntrada')); | |
var $fechaSalida = $(container.querySelector('#fechaSalida')); | |
$fechaEntrada.datetimepicker( | |
{ useCurrent: false } | |
); | |
$fechaSalida.datetimepicker(); | |
$fechaEntrada.on("change.datetimepicker", function (e) { | |
$fechaSalida.datetimepicker('minDate', e.date); | |
}); | |
$fechaSalida.on("change.datetimepicker", function (e) { | |
$fechaEntrada.datetimepicker('maxDate', e.date); | |
}); | |
}; | |
function inicializarChart(chart) { | |
var ctx = chart.getContext('2d'); | |
var data = [0, 10, 5, 2, 20, 30, 45]; | |
var chart = new Chart(ctx, { | |
// The type of chart we want to create | |
type: 'line', | |
// The data for our dataset | |
data: { | |
labels: ['January', 'February', 'March', 'April', 'May', 'June', 'July'], | |
datasets: [{ | |
label: 'My First dataset', | |
backgroundColor: 'rgb(255, 99, 132)', | |
borderColor: 'rgb(255, 99, 132)', | |
data: data | |
}] | |
}, | |
// Configuration options go here | |
options: {} | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment