add sample graph

This commit is contained in:
Zeni Kim 2024-10-28 11:34:54 -05:00
parent 80520260c9
commit 801c5c107f
5 changed files with 39 additions and 10 deletions

View file

@ -6,6 +6,7 @@ package controllers
import (
"fmt"
"math/rand/v2"
"os"
"strconv"
@ -644,6 +645,7 @@ func Themecontent(c *core.Context) *core.Response {
type templateData struct {
ContentTable components.ContentTable
ContentTabledetail components.ContentTabledetail
ContentGraph components.ContentGraph
}
// TABLES
@ -715,6 +717,12 @@ func Themecontent(c *core.Context) *core.Response {
}
allTdetail = append(allTdetail, thd)
// random values for pie
one := rand.IntN(50)
two := rand.IntN(50)
three := rand.IntN(50)
valuesgraph := fmt.Sprintf("%d|%d|%d", one, two, three)
// now fill data of the components
tmplData := templateData{
ContentTable: components.ContentTable{
@ -723,10 +731,15 @@ func Themecontent(c *core.Context) *core.Response {
AllTD: allTd,
},
ContentTabledetail: components.ContentTabledetail{
ID: "table_demodetail",
Title: "Sample table detail",
//HeadClass: "table-warning",
AllTD: allTdetail,
ID: "table_demodetail",
Title: "Sample table detail",
HeadClass: "table-warning",
AllTD: allTdetail,
},
ContentGraph: components.ContentGraph{
Graph: "pie",
Labels: "Berlin|Paris|Venecia",
Values: valuesgraph,
},
}