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
1b3596b2
Commit
1b3596b2
authored
Jul 29, 2022
by
Kevin Yumang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SERV-2286 - refactor chart data maanger and series data objects
parent
dfc18147
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
58 deletions
+48
-58
ChartDataManager.php
...ews/Limitless/Linechart/ChartManager/ChartDataManager.php
+35
-45
SeriesData.php
src/Views/Limitless/Linechart/ChartManager/SeriesData.php
+13
-13
No files found.
src/Views/Limitless/Linechart/ChartManager/ChartDataManager.php
View file @
1b3596b2
...
...
@@ -3,23 +3,22 @@ namespace Ceetrox\Sidekick\Views\Limitless\Linechart\ChartManager;
Class
ChartDataManager
{
private
$categories
;
private
$series
;
private
$numberOfCharts
;
private
$titles
;
private
$colors
;
private
$hasBoundaryGap
;
private
$isInverted
;
private
$hasDataZoom
;
private
$animationDuration
;
private
$yAxisLabelValueFormat
;
private
$rawData
;
// these attributes should also be available on seriesData object.
private
$showPointValues
;
private
$isStacked
;
private
$isArea
;
private
$markLine
;
private
array
$categories
;
private
Series
$series
;
private
?
int
$numberOfCharts
;
private
array
$titles
;
private
array
$colors
;
private
?
bool
$hasBoundaryGap
;
private
?
bool
$isInverted
;
private
?
bool
$hasDataZoom
;
private
?
int
$animationDuration
;
private
?
string
$yAxisLabelValueFormat
;
private
?
string
$rawData
;
private
?
bool
$showPointValues
;
private
?
bool
$isStacked
;
private
?
bool
$isArea
;
private
?
bool
$markLine
;
public
function
__construct
()
{
...
...
@@ -27,6 +26,7 @@ Class ChartDataManager {
$this
->
series
=
new
Series
();
$this
->
numberOfCharts
=
null
;
$this
->
colors
=
[];
$this
->
titles
=
[];
$this
->
hasBoundaryGap
=
null
;
$this
->
isInverted
=
null
;
$this
->
hasDataZoom
=
null
;
...
...
@@ -50,22 +50,12 @@ Class ChartDataManager {
return
new
SeriesData
();
}
public
function
getSeries
()
:
Series
{
return
$this
->
series
;
}
private
function
getCategories
()
:
array
{
return
$this
->
categories
;
}
private
function
getNumberOfCharts
()
:
int
{
return
$this
->
series
->
numberOfCharts
();
}
private
function
getTitles
()
private
function
getTitles
()
:
array
{
return
$this
->
titles
;
}
...
...
@@ -220,8 +210,8 @@ Class ChartDataManager {
public
function
addSeries
(
SeriesData
$series
)
:
ChartDataManager
{
$this
->
getSeries
()
->
push
(
$series
);
$this
->
numberOfCharts
=
$this
->
getSeries
()
->
numberOfCharts
();
$this
->
series
->
push
(
$series
);
$this
->
numberOfCharts
=
$this
->
series
->
numberOfCharts
();
return
$this
;
}
...
...
@@ -237,24 +227,24 @@ Class ChartDataManager {
if
(
!
is_null
(
$this
->
numberOfCharts
))
$data
[
'charts'
]
=
$this
->
numberOfCharts
;
if
(
count
(
$this
->
series
)
>
0
)
$data
[
'series'
]
=
$this
->
getSeries
()
->
toArray
();
if
(
count
(
$this
->
categories
)
>
0
)
$data
[
'categories'
]
=
$this
->
getCategories
()
;
if
(
!
is_null
(
$this
->
titles
))
$data
[
'titles'
]
=
$this
->
getTitles
()
;
if
(
count
(
$this
->
colors
)
>
0
)
$data
[
'colors'
]
=
$this
->
getColors
()
;
if
(
count
(
$this
->
series
)
>
0
)
$data
[
'series'
]
=
$this
->
series
->
toArray
();
if
(
count
(
$this
->
categories
)
>
0
)
$data
[
'categories'
]
=
$this
->
categories
;
if
(
count
(
$this
->
titles
)
>
0
)
$data
[
'titles'
]
=
$this
->
titles
;
if
(
count
(
$this
->
colors
)
>
0
)
$data
[
'colors'
]
=
$this
->
colors
;
if
(
!
is_null
(
$this
->
hasBoundaryGap
))
$data
[
'boundaryGap'
]
=
$this
->
getHasBoundaryGap
()
;
if
(
!
is_null
(
$this
->
isInverted
))
$data
[
'inverted'
]
=
$this
->
getIsInverted
()
;
if
(
!
is_null
(
$this
->
hasDataZoom
))
$data
[
'dataZoom'
]
=
$this
->
getHasDataZoom
()
;
if
(
!
is_null
(
$this
->
animationDuration
))
$data
[
'animationDuration'
]
=
$this
->
getAnimationDuration
()
;
if
(
!
is_null
(
$this
->
yAxisLabelValueFormat
))
$data
[
'yAxisLabelValueFormat'
]
=
$this
->
getYAxisLabelValueFormat
()
;
if
(
!
is_null
(
$this
->
rawData
))
$data
[
'raw'
]
=
json_encode
(
json_decode
(
$this
->
getRawData
()
));
if
(
!
is_null
(
$this
->
hasBoundaryGap
))
$data
[
'boundaryGap'
]
=
$this
->
hasBoundaryGap
;
if
(
!
is_null
(
$this
->
isInverted
))
$data
[
'inverted'
]
=
$this
->
isInverted
;
if
(
!
is_null
(
$this
->
hasDataZoom
))
$data
[
'dataZoom'
]
=
$this
->
hasDataZoom
;
if
(
!
is_null
(
$this
->
animationDuration
))
$data
[
'animationDuration'
]
=
$this
->
animationDuration
;
if
(
!
is_null
(
$this
->
yAxisLabelValueFormat
))
$data
[
'yAxisLabelValueFormat'
]
=
$this
->
yAxisLabelValueFormat
;
if
(
!
is_null
(
$this
->
rawData
))
$data
[
'raw'
]
=
json_encode
(
json_decode
(
$this
->
rawData
));
if
(
!
is_null
(
$this
->
showPointValues
))
$data
[
'pointValues'
]
=
$this
->
getShowPointValues
()
;
if
(
!
is_null
(
$this
->
isStacked
))
$data
[
'stacked'
]
=
$this
->
getIsStacked
()
;
if
(
!
is_null
(
$this
->
isArea
))
$data
[
'isArea'
]
=
$this
->
getIsArea
()
;
if
(
!
is_null
(
$this
->
markLine
))
$data
[
'markLine'
]
=
$this
->
getMarkLine
()
;
if
(
!
is_null
(
$this
->
showPointValues
))
$data
[
'pointValues'
]
=
$this
->
showPointValues
;
if
(
!
is_null
(
$this
->
isStacked
))
$data
[
'stacked'
]
=
$this
->
isStacked
;
if
(
!
is_null
(
$this
->
isArea
))
$data
[
'isArea'
]
=
$this
->
isArea
;
if
(
!
is_null
(
$this
->
markLine
))
$data
[
'markLine'
]
=
$this
->
markLine
;
return
$data
;
return
$data
??
[]
;
}
}
\ No newline at end of file
src/Views/Limitless/Linechart/ChartManager/SeriesData.php
View file @
1b3596b2
...
...
@@ -3,14 +3,14 @@ namespace Ceetrox\Sidekick\Views\Limitless\Linechart\ChartManager;
class
SeriesData
{
private
$name
;
private
$categoryValues
;
private
$index
;
private
$type
;
private
$stackName
;
private
$showPointValues
;
private
$isArea
;
private
$markLine
;
private
string
$name
;
private
array
$categoryValues
;
private
int
$index
;
private
?
string
$type
;
private
?
string
$stackName
;
private
?
bool
$showPointValues
;
private
?
bool
$isArea
;
private
?
string
$markLine
;
public
function
__construct
()
{
...
...
@@ -125,11 +125,11 @@ class SeriesData
$data
[
'data'
]
=
$this
->
getCategoryValues
();
$data
[
'index'
]
=
$this
->
getIndex
();
if
(
!
is_null
(
$this
->
type
))
$data
[
'type'
]
=
$this
->
getType
()
;
if
(
!
is_null
(
$this
->
stackName
))
$data
[
'stacked'
]
=
$this
->
getStackName
()
;
if
(
!
is_null
(
$this
->
showPointValues
))
$data
[
'pointValues'
]
=
$this
->
getShowPointValues
()
;
if
(
!
is_null
(
$this
->
markLine
))
$data
[
'markLine'
]
=
$this
->
getMarkLine
()
;
if
(
!
is_null
(
$this
->
isArea
))
$data
[
'isArea'
]
=
$this
->
getIsArea
()
;
if
(
!
is_null
(
$this
->
type
))
$data
[
'type'
]
=
$this
->
type
;
if
(
!
is_null
(
$this
->
stackName
))
$data
[
'stacked'
]
=
$this
->
stackName
;
if
(
!
is_null
(
$this
->
showPointValues
))
$data
[
'pointValues'
]
=
$this
->
showPointValues
;
if
(
!
is_null
(
$this
->
markLine
))
$data
[
'markLine'
]
=
$this
->
markLine
;
if
(
!
is_null
(
$this
->
isArea
))
$data
[
'isArea'
]
=
$this
->
isArea
;
return
$data
;
}
...
...
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