Created
May 3, 2013 04:04
-
-
Save mapix/5507141 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
| <link rel="stylesheet" href="http://cdn.oesmith.co.uk/morris-0.4.2.min.css"> | |
| <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | |
| <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script> | |
| <script src="http://cdn.oesmith.co.uk/morris-0.4.2.min.js"></script> | |
| <div id="myfirstchart" style="height: 250px; width:600px;"></div> | |
| <script> | |
| var yMax = 1213; | |
| var yMin = 234; | |
| var numLines = 0; | |
| if(yMax - yMin < 5){numLines = yMax - yMin + 1;} | |
| else{numLines = 8;} | |
| new Morris.Line({ | |
| // ID of the element in which to draw the chart. | |
| element: 'myfirstchart', | |
| hoverCallback: function (index, options, content) { | |
| var row = options.data[index]; | |
| return row.value + '个成员'; | |
| }, | |
| // Chart data records -- each entry in this array corresponds to a point on | |
| // the chart. | |
| data: [ | |
| { year: '2012', value: yMax}, | |
| { year: '2011', value: yMin }, | |
| ], | |
| // The name of the data record attribute that contains x-values. | |
| xkey: 'year', | |
| // A list of names of data record attributes that contain y-values. | |
| ykeys: ['value'], | |
| // Labels for the ykeys -- will be displayed when you hover over the | |
| // chart. | |
| ymin: yMin, | |
| ymax: 'auto ' + parseInt((yMax + numLines - 1)/numLines) * numLines, | |
| labels: ['Value'], | |
| smooth: false, | |
| numLines: numLines+1, | |
| //onlyIntegers: true, | |
| }); | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment