Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready( function() {
- var datosPokemon = [];
- var options = {
- animationEnabled: true,
- theme: "light2",
- title: {
- text: "Valor del Dolor el último mes"
- },
- axisX: {
- title: "Nombre de la Versión",
- },
- axisY: {
- title: "Game Index",
- titleFontSize: 24,
- },
- data: [{
- type: "column", //change it to line, area, bar, pie, etc
- legendText: "Try Resizing with the handle to the bottom right",
- showInLegend: true,
- dataPoints: datosPokemon
- }]
- };
- $.ajax({
- type: "GET",
- url: "https://pokeapi.co/api/v2/pokemon/ditto",
- dataType: "json",
- success: function(datos) {
- //console.log(datos);
- let datosAPI = datos.game_indices;
- for (var iterador=0;iterador<datosAPI.length;iterador++){
- datosPokemon.push({
- label: datosAPI[iterador].version.name,
- y: datosAPI[iterador].game_index,
- });
- }
- console.log(datosPokemon);
- $("#contenedor").CanvasJSChart(options);
- }
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement