This commit is contained in:
skoo87 2013-09-05 01:10:16 +08:00
parent e96da1f860
commit 531d19f530
2 changed files with 15 additions and 13 deletions

3
js.go
View File

@ -1,3 +1,6 @@
//
// Don't modify the file
//
package main
const Chartjs = `var Chart=function(s){function v(a,c,b){a=A((a-c.graphMin)/(c.steps*c.stepValue),1,0);return b*c.steps*a}function x(a,c,b,e){function h(){g+=f;var k=a.animation?A(d(g),null,0):1;e.clearRect(0,0,q,u);a.scaleOverlay?(b(k),c()):(c(),b(k));if(1>=g)D(h);else if("function"==typeof a.onAnimationComplete)a.onAnimationComplete()}var f=a.animation?1/A(a.animationSteps,Number.MAX_VALUE,1):1,d=B[a.animationEasing],g=a.animation?0:1;"function"!==typeof c&&(c=function(){});D(h)}function C(a,c,b,e,h,f){var d;a=

View File

@ -8,25 +8,24 @@ import (
const html = `{{define "T"}}
<!doctype html>
<html>
<head>
<title>Line Chart</title>
<script>
{{.Chartjs}}
<head>
<script>
{{.Chartjs}}
</script>
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
canvas{
<meta name = "viewport" content = "initial-scale = 1, user-scalable = no">
<style>
canvas{
}
</style>
</head>
<body>
</style>
</head>
<body>
<div style="padding-top:30px;"></div>
{{.Canvas}}
<script>
{{.JsonCode}}
{{.NewChart}}
</script>
</body>
</body>
</html>
{{end}}
`
@ -62,10 +61,10 @@ func handler(w http.ResponseWriter, r *http.Request) {
} else {
chart = ChartHandlers[prop.Name]
canvas := chart.Canvas("test", prop.Height, prop.Width)
canvas := chart.Canvas("line", prop.Height, prop.Width)
Args["Canvas"] = canvas
newChart := chart.NewChart("test")
newChart := chart.NewChart("line")
Args["NewChart"] = newChart
if json, err := chart.JsonCode(c); err != nil {