Permalink
Browse files

imported chart.min.js

  • Loading branch information...
1 parent 02eda33 commit f21ba0b0f0694bf8312b213f5bf5af43439d8e4f @josip committed Mar 21, 2012
Showing with 3 additions and 2 deletions.
  1. +1 −0 chart.min.js
  2. +2 −2 index.html
View
1 chart.min.js
@@ -0,0 +1 @@
+(function(){function d(a,b){return this.C=a,this.options=b,this.W=b.w,this.H=b.h,this.P=b.padding||20,b.background!==!1&&this.db(),b.grid!==!1&&this.dg(),b.axes!==!1&&this.da(),this}var E=function(a,b){for(var c in b)a[c]=b[c];return a},m=Math.min,M=Math.max;E(d.prototype,{db:function(){var a=this.C;a.fillStyle=this.options.background||"#fff",a.fillRect(0,0,this.W,this.H)},da:function(){var a=this.C,b=this.P;a.strokeStyle=this.options.axes||"#585858",a.lineWidth=2,a.beginPath(),a.moveTo(b,b),a.lineTo(b,this.H-b),a.lineTo(this.W-b,this.H-b),a.stroke(),a.closePath()},dg:function(){var a=this.C,b=this.W,c=this.H,d=this.P,e=this.options.gridSpacing||20,f;a.strokeStyle=this.options.grid||"#c0c0c0",f=Math.ceil(b/e);while(f--)a.beginPath(),a.moveTo(e*f+.5,d),a.lineTo(e*f+.5,c-d),a.stroke(),a.closePath();f=Math.ceil(c/e);while(f--)a.beginPath(),a.moveTo(d,e*f+.5),a.lineTo(b-d,e*f+.5),a.stroke(),a.closePath()},d:function(a,b){return Math.sqrt(Math.pow(a[0]-b[0],2)+Math.pow(a[1]-b[1],2))},tp:function(a){var d=this.W,e=this.H,f=this.P;return[m(f+a[0],d-f),M(e-f-a[1],f)]},_d_point:function(a,b,c){var d=this.C,e=5,f,g;a=this.tp(a),d.save(),d.beginPath(),d.fillStyle=c.fill,d.strokeStyle=c.stroke,d.lineWidth=2,d.arc(f=a[0],g=a[1],e,0,2*Math.PI,!0),d.fill(),b&&(d.fillStyle=c.text,d.fillText(b,f+e+2,g+4)),d.restore()},_d_area:function(a,b,c){var d=this.C,e=this.W,f=this.H,g=this.P,h=this.alp||[g,f-g];a=this.tp(a),d.save(),d.beginPath(),d.fillStyle=c.fill,d.strokeStyle=c.fill,d.moveTo(h[0],f-g),d.lineTo(h[0],h[1]),d.lineTo(a[0],a[1]),d.lineTo(a[0],f-g),d.closePath(),d.fill(),d.restore(),this.alp=a},_d_line:function(a,b,c){var d=this.C,e=this.W,f=this.H,g=this.P,h=this.llp;a=this.tp(a),h||(h=a),d.save(),d.beginPath(),d.strokeStyle=c.fill,d.lineWidth=c.strokeWidth,d.moveTo(h[0],h[1]),d.lineTo(a[0],a[1]),d.stroke(),d.restore(),this.llp=a},pts:function(a,b){return a=a[0],b=b[0],a>b?-1:a<b?1:0},plot:function(a,b){if(!a.length)return;b=E({type:"point",fill:"#d93b3b",stroke:"#f00",text:"#585858",strokeWidth:2},b||{}),this.D=a;var c=a.length,d=this.P,e=new Array(c),f=new Array(c),g=new Array(c),h="_d_"+b.type,i,j,k;a.sort(this.pts);while(c--)f[c]=a[c][0],g[c]=a[c][1];this.sx=i=(this.W-d)/(M.apply(null,f)||1),this.sy=j=(this.H-d)/(M.apply(null,g)||1),c=a.length;while(c--)k=a[c],this[h]([i*k[0],j*k[1]],k[2],b)},ptToCoords:function(a){var d=this.P;return[m(a[0]*this.sx+d,this.W-d),M(this.H-d-a[1]*this.sy,d)]},closestPtX:function(a){a=(a-this.P)/this.sx;var b=this.D,c=b.length,d=new Array(c);while(c--)d[c]=Math.abs(a-b[c][0]);return b[d.indexOf(min.apply(null,d))]}}),this.STC=d})()
View
4 index.html
@@ -2,7 +2,7 @@
<html>
<head>
<title>Simple, tiny &amp; cute.js</title>
- <script type="text/javascript" src="chart.js"></script>
+ <script type="text/javascript" src="chart.min.js"></script>
<style type="text/css">
body {
background: #fff url(exclusive_paper.png) 0 0 fixed; /*#DEDFDE;*/
@@ -285,7 +285,7 @@
[5.5, 5.5],
[10, 0]
];
- hc.plot(triglavHeader, {type: 'point'});
+ hc.plot(hai);
var _header_down = false,
last_pos = [],

0 comments on commit f21ba0b

Please sign in to comment.