테이블의 기능적 측면에서든, ui적 측면에서든 테이블을 간편하게 만들어준다.

 

www.datatables.net/

 

DataTables | Table plug-in for jQuery

DataTables Table plug-in for jQuery Advanced tables, instantly DataTables is a plug-in for the jQuery Javascript library. It is a highly flexible tool, built upon the foundations of progressive enhancement, that adds all of these advanced features to any H

www.datatables.net

 

'플러그인' 카테고리의 다른 글

owlCarousel  (0) 2021.05.02
echarts 차트 그리기  (0) 2020.09.19
지도에 화살표와 팝업 띄우기 open layers (https://openlayers.org/)  (0) 2020.09.13

슬라이드 형태를 만들어 주는 플러그 인 

 

owlcarousel2.github.io/OwlCarousel2/

 

Home | Owl Carousel | 2.3.4

Modules and Plugins Owl Carousel supports plugin modular structure. Therefore, you can detach plugins that you won't use on your project or create new ones that fit your needs

owlcarousel2.github.io

 

기본형태 :

                    $('.my_p_list').owlCarousel({
                        loop: false,
                        rewind: true,
                        margin : 0,
                        nav : true,
                        dots : true,
                        autoplay : true,
                        autoplayTimeout : 6000,
                        autoplayHoverPause : true,
                        smartSpeed : 1000,
                        responsive : {
                            0 : {
                                items : 3,
                            },
                            1600 : {
                                items : 4
                            }
                        }
                    })

 

 

$('.project_list').owlCarousel('destroy');

echarts.apache.org/en/index.html

 

Apache ECharts (incubating)

ECharts: A Declarative Framework for Rapid Construction of Web-based Visualization Please cite the following paper whenever you use ECharts in your R&D projects, products, research papers, technical reports, news reports, books, presentations, teaching, pa

echarts.apache.org

 

 

 

 

echarts로 그린 간단한 그래프

                                                                

 

 

 

maria DB 데이터 

 

<!-- prepare a DOM container with width and height -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<div class="">
	<div id="chart" style="width: 600px; height: 400px;"></div>
</div>

<script language="javascript" type="text/javascript">
	g_cttPage = (function() {

		// 초기 설정 정의
		$(document).ready(function() {
			fn_initSetting();
		});

		// 이벤트 정의

		function fn_initSetting() {

			var params = {};

			params["fn_success"] = function(data, params) {
				fn_sourceGenSuccess(data, params);

				console.log(data);
			}
			fn_ajax("/echart/inEchart.do", params);
		}
		;
		function fn_sourceGenSuccess(data, params) {

			var a = [];
			var b = [];
			var c = [];
			var d = [];
			var e = [];

			for (var i = 15; i >= 0; i--) {
				if (data.result[i].ex_chart == 1) {
					d.push(data.result[i].ex_week);
				}
			}

			for (var i = 15; i >= 0; i--) {
				if (data.result[i].ex_chart == 1) {
					a.push(data.result[i].ex_value);
				} else if (data.result[i].ex_chart == 2) {
					b.push(data.result[i].ex_value);
				} else if (data.result[i].ex_chart == 3) {
					c.push(data.result[i].ex_value);
					//c.push(data.result[i].ex_week);
				}
			}
			for (var i = 15; i >= 0; i--) {
				if (data.result[i].ex_chart == 3) {
					e.push(data.result[i].ex_week);
				}
			}

			console.log('a', a);
			console.log('b', b);
			console.log('c', c[1]);
			console.log('e', e[0]);

			// based on prepared DOM, initialize echarts instance
			var myChart = echarts.init(document.getElementById('chart'));

			// specify chart configuration item and data
			var option = {
				title : {
					text : 'ECharts entry example'
				},
				tooltip : {},
				legend : {
					data : [ 'Sales' ]
				},
				xAxis : {
					type : 'category',
					data : d
				},
				yAxis : {
					type : 'value'
				},
				series : [ {
					data : a,
					type : 'line'
				}, {
					data : b,
					type : 'line'
				}, {
					data : [ [ e[0], c[0] ], [ e[1], c[1] ] ],
					type : 'line'
				} ]
			};
			// use configuration item and data specified to show chart
			myChart.setOption(option);

		}
	})();
</script>

 

위의 초기설정과 이벤트정의 부분은 미리 정의된 함수가 있으니 fn_sourceGenSuccess부분만 참고해야한다.

'플러그인' 카테고리의 다른 글

dataTable 플러그인  (0) 2021.05.02
owlCarousel  (0) 2021.05.02
지도에 화살표와 팝업 띄우기 open layers (https://openlayers.org/)  (0) 2020.09.13

openlayers.org/

 

OpenLayers - Welcome

A high-performance, feature-packed library for all your mapping needs.

openlayers.org

오픈레이어스에서 example과 api 보며 만들 수 있다. 

비주얼 스튜디오로 서버켜서 확인 가능

 

 

 

<!DOCTYPE html>
<html>
  <head>
    <title>Accessible Map</title>
    <link rel="stylesheet" href="https://openlayers.org/en/v3.20.1/css/ol.css" type="text/css">
    <!-- The line below is only needed for old environments like Internet Explorer and Android 4.x -->
    <script src="https://cdn.polyfill.io/v2/polyfill.min.js?features=requestAnimationFrame,Element.prototype.classList,URL"></script>
    <script src="https://openlayers.org/en/v3.20.1/build/ol.js"></script>
    <script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
    <link href="https://openlayers.org/en/v4.6.5/css/ol.css" rel="stylesheet" />
    <script src="https://openlayers.org/en/v4.6.5/build/ol-debug.js"></script>

    <style>
      #popup{
        width: 150px;
      }
    </style>
  </head>
  <body>
    
    <div id="map" class="map" tabindex="0"><div id="popup"></div></div>
  
    <script>
      //아이콘들 
      var iconFeature = new ol.Feature({
        geometry: new ol.geom.Point([-0.1277583,51.5073509]).transform('EPSG:4326', 'EPSG:3857'),
        name: '런던<br>위도51.5073509<br>경도-0.1277583',
      
      });
      var iconFeature1 = new ol.Feature({
        geometry: new ol.geom.Point([2.3522219,48.856614]).transform('EPSG:4326', 'EPSG:3857'),
        name: '파리<br>위도48.856614<br>경도2.3522219',
        
      });
      var iconFeature2 = new ol.Feature({
        geometry: new ol.geom.Point([ 13.4081,52.5186]).transform('EPSG:4326', 'EPSG:3857'),
        name: '베를린<br>위도52.5186<br>경도13.4081',
       
      });
      var iconStyle = new ol.style.Style({
        image: new ol.style.Icon(/** @type {olx.style.IconOptions} */ ({
          anchor: [0.5, 46],
          anchorXUnits: 'fraction',
          anchorYUnits: 'pixels',
          src: 'https://openlayers.org/en/v3.20.1/examples/data/icon.png'
        }))
      });

      iconFeature.setStyle(iconStyle);
      iconFeature1.setStyle(iconStyle);
      iconFeature2.setStyle(iconStyle);
      



      // 화살표 
      var points = [
         [-0.1277583,51.5073509],
         [2.3522219,48.856614],
         [13.4081,52.5186],
         [-0.1277583,51.5073509]
      ];
      var route = new ol.geom.LineString(points);
      route.transform('EPSG:4326', 'EPSG:3857');

      var routeFeature = new ol.Feature({
        type: 'route',
        geometry: route
      });

      var stylesMap = {
        'route': function(feature) {
          var geometry = feature.getGeometry();
          var styles = [
            // linestring
            new ol.style.Style({
              stroke: new ol.style.Stroke({
                color: '#ffcc33',
                width: 2
              })
            })
          ];

          geometry.forEachSegment(function(start, end) {
            var dx = end[0] - start[0];
            var dy = end[1] - start[1];
            var rotation = Math.atan2(dy, dx);
            
            // arrows
            styles.push(new ol.style.Style({
              geometry: new ol.geom.Point(end),
              image: new ol.style.Icon({
                src: 'https://openlayers.org/en/v4.6.5/examples/data/arrow.png',
                anchor: [0.75, 0.5],
                rotateWithView: true,
                rotation: -rotation
              })
            }));
          });

          return styles;
        }
      };

      var vectorLayer = new ol.layer.Vector({
        source: new ol.source.Vector({
          features: [routeFeature]
        }),
        style: function(feature) {
          const myStyle = stylesMap[feature.get('type')];
          if (myStyle instanceof Function) {
            return myStyle(feature);
          }
          return myStyle;
        }
      });


      // 지도 설정 
      var map = new ol.Map({
        layers: [
          new ol.layer.Tile({
            source: new ol.source.OSM()
          }),
          new ol.layer.Vector({
            style: function(feature) {
              return feature.get('style');
            },
          source: new ol.source.Vector({features: [iconFeature, iconFeature1, iconFeature2]})
          }),         
          vectorLayer
        ],      
        target: document.getElementById('map'),
        controls: ol.control.defaults({
          attributionOptions: /** @type {olx.control.AttributionOptions} */ ({
            collapsible: false
          })
        }),
        view: new ol.View({
          center: ol.proj.transform([-0.1277583,51.5073509], 'EPSG:4326', 'EPSG:3857'),
          zoom: 4
        })
      });





      // 팝업 설정
      var element = document.getElementById('popup');

      var popup = new ol.Overlay({
        element: element,
        positioning: 'bottom-center',
        stopEvent: false,
        offset: [0, -50]
      });
      map.addOverlay(popup);




      // 팝업 클릭 
      map.on('click', function(evt) {
        var feature = map.forEachFeatureAtPixel(evt.pixel,
            function(feature) {
              return feature;
            });
        if (feature) {
          var coordinates = feature.getGeometry().getCoordinates();
          popup.setPosition(coordinates);
          $(element).attr('data-placement', 'top');
          $(element).attr('data-html', true);
          $(element).attr('data-content', feature.get('name'));
          $(element).popover('show');
        } else {
          $(element).popover('destroy');
        }
      });

  //    매개 변수를 사용하여 popover 함수를 호출하는 대신
  //    사용자 정의하려는 팝 오버의 각 속성에 대해 
  //    html 데이터 속성을 설정 한 다음 popover()매개 변수없이 호출
  //   $(element).popover({
  //   'placement': 'top',
  //   'html': true,
  //   'content': feature.get('information')
  // });



      // change mouse cursor when over marker
      map.on('pointermove', function(e) {
        var pixel = map.getEventPixel(e.originalEvent);
        var hit = map.hasFeatureAtPixel(pixel);
        map.getTarget().style.cursor = hit ? 'pointer' : '';
      });


      
    </script>
  </body>
</html>

 

 

 

 

'플러그인' 카테고리의 다른 글

dataTable 플러그인  (0) 2021.05.02
owlCarousel  (0) 2021.05.02
echarts 차트 그리기  (0) 2020.09.19

+ Recent posts