스프링

http://morrisjs.github.com/morris.js

 

원하는 형태의 데이터로 가공해서 보내 주면 된다.

 

<!doctype html>
<head>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/raphael/2.1.2/raphael-min.js"></script>
  <script src="/morris.js"></script>
  <script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.js"></script>
  <script src="lib/example.js"></script>
  <link rel="stylesheet" href="lib/example.css">
  <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/prettify/r224/prettify.min.css">
  <link rel="stylesheet" href="/morris.css">
<script src="http://braverokmc.dothome.co.kr/include/admin-1.0.4/js/plugins/morris/morris.js"></script>
<script>
$(function () {
  eval($('#code').text());
  prettyPrint();
});  
</script>
<style type="text/css">

body {
  width: 800px;
  margin: 0 auto;
}
#graph {
  width: 800px;
  height: 250px;
  margin: 20px auto 0 auto;
}
pre {
  height: 250px;
  overflow: auto;
}

</style>
  
</head>
<body>
<h1>Bar charts</h1>
<div id="graph"></div>
<pre id="code" class="prettyprint linenums">
// Use Morris.Bar
Morris.Bar({
  element: 'graph',
  data: [
    {x: '2011 Q1', y: 0},
    {x: '2011 Q2', y: 1},
    {x: '2011 Q3', y: 2},
    {x: '2011 Q4', y: 3},
    {x: '2012 Q1', y: 4},
    {x: '2012 Q2', y: 5},
    {x: '2012 Q3', y: 6},
    {x: '2012 Q4', y: 7},
    {x: '2013 Q1', y: 8}
  ],
  xkey: 'x',
  ykeys: ['y'],
  labels: ['Y'],
  barColors: function (row, series, type) {
    if (type === 'bar') {
      var red = Math.ceil(255 * row.y / this.ymax);
      return 'rgb(' + red + ',0,0)';
    }
    else {
      return '#000';
    }
  }
});
</pre>
</body>

morris.css

.morris-hover{position:absolute;z-index:1000}.morris-hover.morris-default-style{border-radius:10px;padding:6px;color:#666;background:rgba(255,255,255,0.8);border:solid 2px rgba(230,230,230,0.8);font-family:sans-serif;font-size:12px;text-align:center}.morris-hover.morris-default-style .morris-hover-row-label{font-weight:bold;margin:0.25em 0}
.morris-hover.morris-default-style .morris-hover-point{white-space:nowrap;margin:0.1em 0}

 

 

테스트 사이트

http://jsbin.com/ukaxod/144/embed?html,output

 

 

spring

 

about author

PHRASE

Level 60  머나먼나라

Never put off till tomorrow what may be done today. (오늘 할수 있는 일을 내일로 미루지 말라.)

댓글 ( 4)

댓글 남기기

작성

스프링 목록    more