Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
S
sidekick
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
Privat - Marco Schmiedel
sidekick
Commits
ef8a4d9e
Commit
ef8a4d9e
authored
Jul 15, 2022
by
Kevin Yumang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SERV-2286 - chart loading
parent
f339fe45
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
51 additions
and
36 deletions
+51
-36
linechart.init.js
src/Views/Limitless/Linechart/Attachments/linechart.init.js
+51
-36
No files found.
src/Views/Limitless/Linechart/Attachments/linechart.init.js
View file @
ef8a4d9e
function
set_chart
()
{
function
set_chart
()
{
setTimeout
(
function
()
{
let
chartCounter
=
0
;
let
chartCounter
=
0
;
$
(
'
.LimitlessLineChart
'
).
each
(
function
()
{
$
(
'
.LimitlessLineChart
'
).
each
(
function
()
{
...
@@ -9,23 +8,54 @@ function set_chart() {
...
@@ -9,23 +8,54 @@ function set_chart() {
let
elementChart
=
$
(
this
);
let
elementChart
=
$
(
this
);
elementChart
.
attr
(
'
id
'
,
'
LimitlessLineChart
'
+
chartCounter
);
elementChart
.
attr
(
'
id
'
,
'
LimitlessLineChart
'
+
chartCounter
);
init_line
_chart
(
elementChart
[
0
].
id
);
init
_chart
(
elementChart
[
0
].
id
);
});
});
},
300
);
}
}
// main function
// main function
function
init_
line_
chart
(
chartId
)
{
function
init_chart
(
chartId
)
{
// Define element
// Define element
let
lineChartElement
=
document
.
getElementById
(
chartId
);
let
lineChartElement
=
document
.
getElementById
(
chartId
);
if
(
lineChartElement
)
{
if
(
lineChartElement
)
{
let
titles
=
[
'
A
'
,
'
B
'
,
'
C
'
];
let
multichart
=
(
titles
&&
titles
.
length
>
1
);
let
numberOfCharts
=
titles
?
titles
.
length
:
1
;
// adjust container height before initialising the chart.
if
(
multichart
)
{
let
height
=
(
titles
.
length
*
240
);
// (chart height = 160 | charts spacing = 80)
lineChartElement
.
style
.
height
=
height
+
'
px
'
;
console
.
log
(
'
adjusted container height
'
,
height
+
'
px
'
);
}
let
lineChart
=
echarts
.
init
(
lineChartElement
);
lineChart
.
showLoading
({
text
:
'
LADE DATEN
'
,
maskColor
:
'
#353f53
'
,
color
:
'
#fff
'
,
textColor
:
'
#fff
'
,
fontSize
:
15
});
set_data
(
titles
,
multichart
,
numberOfCharts
,
function
(
options
)
{
lineChart
.
hideLoading
();
lineChart
.
setOption
(
options
);
setResizeEvent
(
lineChartElement
,
lineChart
);
})
}
}
function
set_data
(
titles
,
multichart
,
numberOfCharts
,
callback
)
{
setTimeout
(
function
()
{
// variables (this will be set by user)
// variables (this will be set by user)
let
titles
=
[
'
A
'
];
let
color
=
[
'
#5470c6
'
,
'
#91cc75
'
,
'
#fac858
'
,
'
#ee6666
'
,
'
#73c0de
'
,
'
#3ba272
'
,
'
#fc8452
'
,
'
#9a60b4
'
,
'
#ea7ccc
'
,
'
#a1887f
'
];
let
color
=
[
'
#5470c6
'
,
'
#91cc75
'
,
'
#fac858
'
,
'
#ee6666
'
,
'
#73c0de
'
,
'
#3ba272
'
,
'
#fc8452
'
,
'
#9a60b4
'
,
'
#ea7ccc
'
,
'
#a1887f
'
];
let
animationDuration
=
750
;
let
animationDuration
=
750
;
let
seriesNames
=
[
'
ONC
'
,
'
APR
'
,
'
SPR
'
,
'
PHX
'
,
'
SIG
'
,
'
BRG
'
,
'
MNT
'
,
'
SDK
'
,
'
OCT
'
];
let
seriesNames
=
[
'
ONC
'
,
'
APR
'
,
'
SPR
'
,
'
PHX
'
,
'
SIG
'
,
'
BRG
'
,
'
MNT
'
,
'
SDK
'
,
'
OCT
'
];
...
@@ -39,7 +69,7 @@ function init_line_chart(chartId) {
...
@@ -39,7 +69,7 @@ function init_line_chart(chartId) {
let
markLine
=
'
average
'
;
// min | max | average
let
markLine
=
'
average
'
;
// min | max | average
let
series
=
[];
let
series
=
[];
seriesNames
.
forEach
(
function
(
val
,
idx
,
arr
)
{
seriesNames
.
forEach
(
function
(
val
,
idx
,
arr
)
{
let
chartindex
=
Math
.
floor
(
Math
.
random
()
*
titles
.
length
);
let
chartindex
=
Math
.
floor
(
Math
.
random
()
*
titles
.
length
);
...
@@ -54,27 +84,8 @@ function init_line_chart(chartId) {
...
@@ -54,27 +84,8 @@ function init_line_chart(chartId) {
],
showPointValues
,
markLine
,
stacked
,
chartindex
));
],
showPointValues
,
markLine
,
stacked
,
chartindex
));
});
});
// multichart is true if title param is multiple.
// legends and datazoom are disabled if multichart.
let
multichart
=
(
titles
&&
titles
.
length
>
1
);
let
numberOfCharts
=
titles
?
titles
.
length
:
1
;
// adjust container height before initialising the chart.
if
(
multichart
)
{
let
height
=
(
titles
.
length
*
240
);
// (chart height = 160 | charts spacing = 80)
lineChartElement
.
style
.
height
=
height
+
'
px
'
;
console
.
log
(
'
adjusted container height
'
,
height
+
'
px
'
);
}
let
lineChart
=
echarts
.
init
(
lineChartElement
);
// Options
// Options
l
ineChart
.
setOption
(
{
l
et
options
=
{
// Chart title
// Chart title
title
:
setTitles
(
titles
),
title
:
setTitles
(
titles
),
...
@@ -111,10 +122,12 @@ function init_line_chart(chartId) {
...
@@ -111,10 +122,12 @@ function init_line_chart(chartId) {
// Add series
// Add series
series
:
series
series
:
series
});
};
callback
(
options
);
},
1000
);
setResizeEvent
(
lineChartElement
,
lineChart
);
}
}
}
// sub functions
// sub functions
...
@@ -218,6 +231,7 @@ function setYAxis(yAxisLabelValueFormat, numberOfCharts = 1) {
...
@@ -218,6 +231,7 @@ function setYAxis(yAxisLabelValueFormat, numberOfCharts = 1) {
return
yAxisArray
;
return
yAxisArray
;
}
}
// disabled when multichart is true
function
setLegend
(
legendData
,
multichart
=
false
)
{
function
setLegend
(
legendData
,
multichart
=
false
)
{
return
multichart
?
null
:
{
return
multichart
?
null
:
{
data
:
legendData
,
data
:
legendData
,
...
@@ -261,6 +275,7 @@ function setTitles(titles) {
...
@@ -261,6 +275,7 @@ function setTitles(titles) {
return
arrayTitles
;
return
arrayTitles
;
}
}
// disabled when multichart is true
function
setDataZoom
(
show
,
multichart
=
false
)
{
function
setDataZoom
(
show
,
multichart
=
false
)
{
return
multichart
?
null
:
[
return
multichart
?
null
:
[
{
{
...
...
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