Skip to content

Instantly share code, notes, and snippets.

@JasonPunyon
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JasonPunyon/9975951 to your computer and use it in GitHub Desktop.
Save JasonPunyon/9975951 to your computer and use it in GitHub Desktop.
<Query Kind="Program">
<NuGetReference>Jil</NuGetReference>
<Namespace>Jil</Namespace>
</Query>
void Main()
{
WriteHtml("<div>Hello World!</div>");
WriteHtml("<div id='chartContainer'></div>");
WriteHtml("<script src='http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.4/d3.min.js'></script>");
WriteHtml("<script src='http://dimplejs.org/dist/dimple.v1.1.5.min.js'></script>");
var data = Enumerable.Range(1, 100).Select((o, i) => new { T = i, Value = o }).ToList();
var json = JSON.Serialize(data);
WriteHtml(@"
<script type='text/javascript'>
var svg = dimple.newSvg('#chartContainer', 590, 400);
var data = " + json + @";
var chart = new dimple.chart(svg, data);
var x = chart.addMeasureAxis('x', 'T');
x.addOrderRule('T');
chart.addMeasureAxis('y', 'Value');
chart.addSeries('T', dimple.plot.line);
chart.draw();
</script>"
);
}
// Define other methods and classes here
public void WriteHtml(string s) {
Util.RawHtml(s).Dump();
}
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="Generator" content="LINQ to XML, baby!" />
<style type='text/css'>
body {
margin: 0.3em 0.3em 0.4em 0.5em;
font-family: Verdana;
font-size: 80%;
background: white;
}
p, pre {
margin:0;
padding:0;
font-family: Verdana;
}
table {
border-collapse: collapse;
border: 2px solid #17b;
margin: 0.3em 0.2em;
}
table.limit {
border-collapse: collapse;
border-bottom: 2px solid #c31;
}
td, th {
vertical-align: top;
border: 1px solid #aaa;
padding: 0.1em 0.2em;
margin: 0;
}
th {
text-align: left;
background-color: #ddd;
border: 1px solid #777;
font-family: tahoma;
font-size:90%;
font-weight: bold;
}
th.member {
padding: 0.1em 0.2em 0.1em 0.2em;
}
td.typeheader {
font-family: tahoma;
font-size: 100%;
font-weight: bold;
background-color: #17b;
color: white;
padding: 0 0.2em 0 0.1em;
}
td.n { text-align: right }
a:link.typeheader, a:visited.typeheader, a:link.extenser, a:visited.extenser {
font-family: tahoma;
font-size: 90%;
font-weight: bold;
text-decoration: none;
background-color: #17b;
color: white;
float:left;
}
a:link.extenser, a:visited.extenser {
float:right;
padding-left:2pt;
margin-left:4pt
}
span.typeglyph, span.typeglyphx {
padding: 0 0.2em 0 0;
margin: 0;
}
span.extenser, span.extenserx {
margin-top:1.2pt;
}
span.typeglyph, span.extenser {
font-family: webdings;
}
span.typeglyphx, span.extenserx {
font-family: arial;
font-weight: bold;
margin: 2px;
}
table.group {
border: none;
margin: 0;
}
td.group {
border: none;
padding: 0 0.1em;
}
div.spacer { margin: 0.6em 0; }
table.headingpresenter {
border: none;
border-left: 3px dotted #1a5;
margin: 1em 0em 1.2em 0.15em;
}
th.headingpresenter {
font-family: Arial;
border: none;
padding: 0 0 0.2em 0.5em;
background-color: white;
color: green;
font-size: 110%;
}
td.headingpresenter {
border: none;
padding: 0 0 0 0.6em;
}
td.summary {
background-color: #def;
color: #024;
font-family: Tahoma;
padding: 0 0.1em 0.1em 0.1em;
}
td.columntotal {
font-family: Tahoma;
background-color: #eee;
font-weight: bold;
color: #17b;
font-size:90%;
text-align:right;
}
span.graphbar {
background: #17b;
color: #17b;
margin-left: -2px;
margin-right: -2px;
}
a:link.graphcolumn, a:visited.graphcolumn {
color: #17b;
text-decoration: none;
font-weight: bold;
font-family: Arial;
font-size: 110%;
letter-spacing: -0.4em;
margin-left: 0.3em;
}
a:link.collection, a:visited.collection { color: green }
a:link.reference, a:visited.reference { color:blue }
i { color: green; }
em { color: red; }
span.highlight { background: #ff8; }
</style>
<script language='JavaScript' type='text/javascript'>
function toggle(id)
{
table = document.getElementById(id);
if (table == null) return false;
updown = document.getElementById(id + 'ud');
if (updown == null) return false;
if (updown.innerHTML == '5' || updown.innerHTML == '6') {
expand = updown.innerHTML == '6';
updown.innerHTML = expand ? '5' : '6';
} else {
expand = updown.innerHTML == '˅';
updown.innerHTML = expand ? '˄' : '˅';
}
table.style.borderBottom = expand ? '2px solid #17b' : 'dashed 2px #17b';
elements = table.rows;
if (elements.length == 0 || elements.length == 1) return false;
for (i = 1; i != elements.length; i++)
if (elements[i].id.substring(0,3) != 'sum')
elements[i].style.display = expand ? 'table-row' : 'none';
return false;
}
</script>
</head>
<body><div><div>Hello World!</div></div>
<div><div id="chartContainer"></div></div>
<div><script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.4.4/d3.min.js"></script></div>
<div><script src="http://dimplejs.org/dist/dimple.v1.1.5.min.js"></script></div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment