go-examples/tpl-ex3/tpl.html

52 lines
1.2 KiB
HTML
Raw Normal View History

2017-07-26 18:34:08 +00:00
<!DOCTYPE html>
<html>
<head><title>Financial</title></head>
<body>
<table border="1">
<tr>
{{ range .Columns }}
<th>{{ . }}</th>
{{ end }}
</tr>
{{ range $index, $element := .Rows }}
<tr class="{{ class $index }}">
{{ with $element }}
<td>{{ .Date }}</td>
<td>{{ .Open }}</td>
<td>{{ .High }}</td>
<td>{{ .Low }}</td>
<td>{{ .Close }}</td>
<td>{{ .Adj_Close }}</td>
<td>{{ .Volume }}</td>
{{ end }}
</tr>
{{ end }}
</table>
<div id="container"></div>
<style>
#container {
min-width: 310px;
max-width: 800px;
height: 400px;
margin: 0 auto
}
tr.odd td {
background-color: black;
color: white;
}
tr.even td {
background-color: white;
color: black;
}
</style>
<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script src="https://code.highcharts.com/highcharts.src.js"></script>
<script>
{{ template "script.js" . }}
</script>
</body>
</html>