33 lines
942 B
HTML
33 lines
942 B
HTML
|
|
<script>
|
|
let rawLabels = [{{range .Graph.Labels}}
|
|
{{.}},{{end}}
|
|
];
|
|
let seriesData = [{{range .Graph.Series}}[{{range .}}
|
|
{{.}},{{end}}
|
|
],{{end}}
|
|
];
|
|
let legendNames = [{{range .Graph.Legends}}
|
|
{{.}},{{end}}
|
|
];
|
|
const noPre = ["twelve-hours","one-day","two-days","one-week","one-month"];
|
|
const preStats = () => {
|
|
if((!"{{.TimeRange}}" in noPre) && seriesData.length > 0 && seriesData[0].length > 12) {
|
|
let elem = document.getElementsByClassName("colstack_graph_holder")[0];
|
|
let w = elem.clientWidth;
|
|
console.log("w:",w);
|
|
elem.classList.add("scrolly");
|
|
console.log("elem.clientWidth:",elem.clientWidth);
|
|
elem.setAttribute("style","width:"+w+"px;");
|
|
console.log("elem.clientWidth:",elem.clientWidth);
|
|
}
|
|
};
|
|
addInitHook("after_phrases", () => {
|
|
addInitHook("end_init", () => {
|
|
addInitHook("analytics_loaded", () => {
|
|
preStats();
|
|
buildStatsChart(rawLabels, seriesData, "{{.TimeRange}}",legendNames);
|
|
});
|
|
});
|
|
});
|
|
</script> |