-
Notifications
You must be signed in to change notification settings - Fork 2
/
GaugeServer.aspx.cs
37 lines (35 loc) · 1.31 KB
/
GaugeServer.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Saved.Code;
namespace Saved
{
public partial class GaugeServer : Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
public string RenderChart()
{
string s = "<script type=text/javascript> google.load( *visualization*, *1*, {packages:[*gauge*]});"
+ " google.setOnLoadCallback(drawChart);"
+ " function drawChart() {"
+ " var data = new google.visualization.DataTable();"
+ " data.addColumn('string', 'item');"
+ " data.addColumn('number', 'value'); "
+ " data.addRows(1);";
s += "data.setValue(0,0,'Oops');";
s += "data.setValue(0,1,1000000);";
s += "var options = {width: 600, height: 300,redFrom: 90, redTo: 100,yellowFrom:75, yellowTo: 90,minorTicks: 5};";
s += " var chart = new google.visualization.Gauge(document.getElementById('chart_div'));";
s += "chart.draw(data, options); }";
s += "</script>";
s = s.TrimEnd(',').Replace('*', '"');
return s;
}
}
}