<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>AmCharts</title> <style> #chartdiv { width : 90%; height : 500px; font-size : 11px; overflow : auto; position : absolute; resize : both; } </style> </head> <body> <script src="https://www.amcharts.com/lib/3/amcharts.js"></script> <script src="https://www.amcharts.com/lib/3/serial.js"></script> <script src="https://www.amcharts.com/lib/3/themes/light.js"></script> <div id="chartdiv"></div> <script> var chart = AmCharts.makeChart("chartdiv", { "type": "serial", "theme": "light", "marginRight": 70, "dataProvider": [{ "country": "USA", "visits": 3025, "color": "#FF0F00" }, { "country": "China", "visits": 1882, "color": "#FF6600" }, { "country": "Japan", "visits": 1809, "color": "#FF9E01" }, { "country": "Germany", "visits": 1322, "color": "#FCD202" }, { "country": "UK", "visits": 1122, "color": "#F8FF01" }, { "country": "France", "visits": 1114, "color": "#B0DE09" }, { "country": "India", "visits": 984, "color": "#04D215" }, { "country": "Spain", "visits": 711, "color": "#0D8ECF" }, { "country": "Netherlands", "visits": 665, "color": "#0D52D1" }, { "country": "Russia", "visits": 580, "color": "#2A0CD0" }, { "country": "South Korea", "visits": 443, "color": "#8A0CCF" }, { "country": "Canada", "visits": 441, "color": "#CD0D74" }], "valueAxes": [{ "axisAlpha": 0, "position": "left", "title": "Visitors from country" }], "startDuration": 1, "graphs": [{ "balloonText": "<b>[[category]]: [[value]]</b>", "fillColorsField": "color", "fillAlphas": 0.9, "lineAlpha": 0.2, "type": "column", "valueField": "visits" }], "chartCursor": { "categoryBalloonEnabled": false, "cursorAlpha": 0, "zoomable": false }, "categoryField": "country", "categoryAxis": { "gridPosition": "start", "labelRotation": 45 }, "export": { "enabled": true } }); chart.addListener("init", handleResize); function handleResize(){ setTimeout(function() { var element = document.getElementById('chartdiv'); var resizer = document.createElement('div'); resizer.style.width = '10px'; resizer.style.height = '10px'; resizer.style.position = 'absolute'; resizer.style.right = 0; resizer.style.bottom = 0; resizer.style.cursor = 'se-resize'; element.appendChild(resizer); resizer.addEventListener('mousedown', initResize, false); function initResize(e) { window.addEventListener('mousemove', Resize, false); window.addEventListener('mouseup', stopResize, false); } function Resize(e) { element.style.width = (e.clientX - element.offsetLeft) + 'px'; element.style.height = (e.clientY - element.offsetTop) + 'px'; } function stopResize(e) { window.removeEventListener('mousemove', Resize, false); window.removeEventListener('mouseup', stopResize, false); } }); }
Saludos amigos en esta oportunidad estableceremos conexion con postgre, para realizar la insercion de datos, primero que todo crearemos las variables de la conexion: String driver = "org.postgresql.Driver" ; String ruta = "jdbc:postgresql://localhost:5432/ nombre de la bd " ; String user = "postgres" ; String password = " clave "; Importante: El driver de Postgre para Java lo puedes descargar desde aqui: Driver PostgreSQL para explicar algo que es fundamental sobre la base de datos Ejemplo es que esta tiene tres (3) campos que son: codusuarios : de tipo biginteger serial (lo quiere decir que es un campo auto incremento en postgre). nombre : de tipo text. identificacion : de tipo text . Ahora seguimos con el codigo para insertar datos. Esta es la funcion correspondiente: public void GuardarUsuario ( String nombre, String identificacion){ / / Insertar datos a la bd: try{ Class.forName( d
Comentarios
Publicar un comentario