Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
V
visualDataServer
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
standardized
visualDataServer
Commits
fce2ea1b
Commit
fce2ea1b
authored
Nov 11, 2021
by
lixinming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no message
parent
c53182c4
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
21 deletions
+24
-21
excelEnter.ts
src/cal/excelEnter.ts
+23
-20
main.ts
src/main.ts
+1
-1
No files found.
src/cal/excelEnter.ts
View file @
fce2ea1b
...
@@ -106,38 +106,41 @@ export function planarArrBecomeStringListData(dataList, titleInY = false) {
...
@@ -106,38 +106,41 @@ export function planarArrBecomeStringListData(dataList, titleInY = false) {
/**
/**
* planarArrBecomeListData 二维数组转列表需要的结构
* planarArrBecomeListData 二维数组转列表需要的结构
* @param dataList 数据列表 格式 [[标题1, 标题2, 标题3],[a的value1, a的value2, a的value3],[b的value1, b的value2, b的value3]] or
* @param dataList 数据列表 格式 [[标题1, 标题2, 标题3],[a的value1, a的value2, a的value3],[b的value1, b的value2, b的value3]] or
* [[标题1,
标题2, 标题3, 标题4],[a的value1, a的value2, a的value3],[b的value1, b的value2, b的value
3]]
* [[标题1,
a的值1, b的值1],[标题2, a的值2, b的值2],[标题3, a的值3, b的值
3]]
* @param
headerInx
* @param
titleInY titleInY 标题是否垂直排列 or key是否横向排列 or key在x轴上 and 即当为false时输入为(默认为false):[[标题1, 标题2, 标题3],[a的value1, a的value2, a的value3],[b的value1, b的value2, b的value3]]
* @returns 返回 [{key:"
a", values:[a的value1, a的value2, a的value3] }, {key:"b", values:[b的value1, b的value2, b的value3
] }]
* @returns 返回 [{key:"
标题1", values:[a的value1, b的value1, c的value1] }, {key:"标题2", values:[a的value2, b的value2, c的value2
] }]
*/
*/
export
function
planarArrBecomeListData
(
dataList
,
headerInx
?)
{
export
function
planarArrBecomeListData
(
dataList
,
titleInY
=
false
)
{
//todo
let
result
=
[];
let
result
=
[];
if
(
!
titleInY
)
{
let
dataTitle
=
dataList
[
0
];
let
dataTitle
=
dataList
[
0
];
for
(
let
i
=
1
;
i
<=
dataList
.
length
;
i
++
)
{
for
(
let
y
=
1
;
y
<
dataList
.
length
;
y
++
)
{
let
dataValue
=
{};
let
subValue
=
dataList
[
y
];
let
ValueData
=
[];
let
keyData
=
dataTitle
[
i
-
1
];
for
(
let
x
=
0
;
x
<
dataList
[
i
].
length
;
x
++
){
for
(
let
x
=
0
;
x
<
subValue
.
length
;
x
++
){
ValueData
.
push
(
dataList
[
i
][
x
]);
let
value
=
subValue
[
x
];
let
key
=
dataTitle
[
x
];
if
(
!
result
[
x
]
)
result
[
x
].
push
({
key
,
values
:[]
});
result
[
x
].
values
.
push
(
value
);
}
}
}
dataValue
=
{
}
else
{
key
:
keyData
,
for
(
let
y
=
0
;
y
<
dataList
.
length
;
y
++
)
{
values
:
ValueData
let
subValue
=
dataList
[
y
];
};
result
.
push
({
key
:
subValue
[
0
],
result
.
push
(
dataValue
);
values
:
subValue
.
slice
(
1
,
subValue
.
length
)
})
}
}
}
return
result
;
//
return
result
;
}
}
//todo ====
/**
/**
* analysisExcelDataOfMoreObject 将excel解出来的数据块按需求解析成可用数据
* analysisExcelDataOfMoreObject 将excel解出来的数据块按需求解析成可用数据
* @param dataList excel解出来的数据
* @param dataList excel解出来的数据
...
...
src/main.ts
View file @
fce2ea1b
...
@@ -9,7 +9,7 @@ async function lanuch() {
...
@@ -9,7 +9,7 @@ async function lanuch() {
}
}
function
test
()
{
function
test
()
{
let
dataList
=
[[
'
a'
,
'b'
],[
'a的value1'
,
'a的value2'
,
'a的value3'
],[
'b的value1'
,
'b的value2'
,
'b的value3
'
]];
let
dataList
=
[[
'
标题1'
,
'a的value1'
,
'b的value1'
],[
'标题2'
,
'a的value2'
,
'b的value2
'
]];
planarArrBecomeListData
(
dataList
);
planarArrBecomeListData
(
dataList
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment