mirror of
https://github.com/aclindsa/moneygo.git
synced 2024-12-26 07:33:21 -05:00
lua: Add title, subtitle, axis labels to reports
This commit is contained in:
parent
d2b98c3d4b
commit
9b3e08fa78
@ -27,6 +27,7 @@ function generate()
|
|||||||
|
|
||||||
accounts = get_accounts()
|
accounts = get_accounts()
|
||||||
r = report.new(12)
|
r = report.new(12)
|
||||||
|
r:title(year .. " Monthly Expenses")
|
||||||
series_map = account_series_map(accounts, r)
|
series_map = account_series_map(accounts, r)
|
||||||
|
|
||||||
for month=1,12 do
|
for month=1,12 do
|
||||||
|
@ -81,6 +81,14 @@ func luaReport__index(L *lua.LState) int {
|
|||||||
L.Push(L.NewFunction(luaReportLabel))
|
L.Push(L.NewFunction(luaReportLabel))
|
||||||
case "Series", "series":
|
case "Series", "series":
|
||||||
L.Push(L.NewFunction(luaReportSeries))
|
L.Push(L.NewFunction(luaReportSeries))
|
||||||
|
case "Title", "title":
|
||||||
|
L.Push(L.NewFunction(luaReportTitle))
|
||||||
|
case "Subtitle", "subtitle":
|
||||||
|
L.Push(L.NewFunction(luaReportSubtitle))
|
||||||
|
case "XAxisLabel", "xaxislabel":
|
||||||
|
L.Push(L.NewFunction(luaReportXAxis))
|
||||||
|
case "YAxisLabel", "yaxislabel":
|
||||||
|
L.Push(L.NewFunction(luaReportYAxis))
|
||||||
default:
|
default:
|
||||||
L.ArgError(2, "unexpected report attribute: "+field)
|
L.ArgError(2, "unexpected report attribute: "+field)
|
||||||
}
|
}
|
||||||
@ -120,6 +128,50 @@ func luaReportSeries(L *lua.LState) int {
|
|||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func luaReportTitle(L *lua.LState) int {
|
||||||
|
report := luaCheckReport(L, 1)
|
||||||
|
|
||||||
|
if L.GetTop() == 2 {
|
||||||
|
report.Title = L.CheckString(2)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
L.Push(lua.LString(report.Title))
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func luaReportSubtitle(L *lua.LState) int {
|
||||||
|
report := luaCheckReport(L, 1)
|
||||||
|
|
||||||
|
if L.GetTop() == 2 {
|
||||||
|
report.Subtitle = L.CheckString(2)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
L.Push(lua.LString(report.Subtitle))
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func luaReportXAxis(L *lua.LState) int {
|
||||||
|
report := luaCheckReport(L, 1)
|
||||||
|
|
||||||
|
if L.GetTop() == 2 {
|
||||||
|
report.XAxisLabel = L.CheckString(2)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
L.Push(lua.LString(report.XAxisLabel))
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
|
func luaReportYAxis(L *lua.LState) int {
|
||||||
|
report := luaCheckReport(L, 1)
|
||||||
|
|
||||||
|
if L.GetTop() == 2 {
|
||||||
|
report.YAxisLabel = L.CheckString(2)
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
L.Push(lua.LString(report.YAxisLabel))
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
func luaSeries__index(L *lua.LState) int {
|
func luaSeries__index(L *lua.LState) int {
|
||||||
field := L.CheckString(2)
|
field := L.CheckString(2)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user