lzh
2025-06-24 13c4a636539584ab977fddacfae884b3ec250aee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
ÿþ--[[
    x: hh-mobox-001
     Tðy: ûN¡Rpeϑ
    \O€ÿSGX  
    åegÿ2024-11-27
    ýQpeÿ GenChartJson
 
    ŸRý€:
        ñg¶rþV
 
    ôf9e°‹U_:
    
--]] json = require("json")
mobox = require("OILua_JavelinExt")
m3 = require( "oi_base_mobox" )
 
function GenChartJson(strLuaDEID)
    local nRet, strRetInfo
    --[[ ‡eW[œ˜r‚ ]]
    local strColor = "#fff"
    --[[ ‡eW[h˜˜ ]]
    local strTitle = "ûN¡Rpeϑ"
    --[[ ñg¶rþVñgP[ Tðy ÿù[”^ series  Nname ]]
    local tabLegendData = {'ûN¡Rpeϑ'}
    --[[ Ytpenc ÎN NT
N ]]
    local tabYAxis = {'X›W:g1', 'X›W:g2', 'X›W:g3', 'X›W:g4', 'X›W:g5', 'X›W:g6', 'X›W:g7',
                      'X›W:g8'}
 
    -- ß~¡‹8*NX›W:g„vpeϑ
    local tabSeriesData = {}
    for i = 1 ,8 do
        local strCondition = "N_ROADWAY = "..i
        nRet, strRetInfo = mobox.getDataObjCount(strLuaDEID, "Task", strCondition)
        if (nRet ~= 0) then lua.Error(strLuaDEID, debug.getinfo(1), "getDataObjCount 1Y%! " .. strRetInfo) end
        tabSeriesData[i] = lua.StrToNumber(strRetInfo)
    end
    local option = {
        title = {
            text = strTitle,
            left = 20,
            textStyle = {
                color = strColor
            },
            top = 10
        },
        grid = {
            left = '5%',
            right = '5%',
            bottom = '5%',
            top = '20%',
            containLabel = true
        },
        legend = {
            data = tabLegendData,
            textStyle = {
                color = strColor
            },
            top = 10
        },
        xAxis = {
            type = 'value',
            axisLabel = {
                textStyle = {
                    color = strColor
                }
            }
        },
        yAxis = {
            type = 'category',
            data = tabYAxis,
            axisLabel = {
                textStyle = {
                    color = strColor
                }
            }
        },
        series = {
            name = 'ûN¡Rpeϑ',
            type = 'bar',
            stack = 'total',
            label = {
                show = true
            },
            data = tabSeriesData
        }
    }
 
    local action = {}
    action[1] = {
        action_type = "chart",
        value = {
            graphicType = "echart",
            title = {
                text = strTitle,
                align = "center",
                color = "#515a6e",
                font = "®_oÅ–Ñž",
                fontSize = 12
            },
            option = option
        }
    }
 
    nRet, strRetInfo = mobox.setAction(strLuaDEID, lua.table2str(action))
    if (nRet ~= 0) then
        lua.Error(strLuaDEID, debug.getinfo(1), "setAction1Y%! " .. strRetInfo .. ' action = ' .. strAction)
    end
end