Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
GeoInt_SIDT
Project
Project
Details
Activity
Releases
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Mario Chirinos Colunga
GeoInt_SIDT
Commits
89095f8f
Commit
89095f8f
authored
May 03, 2019
by
Emmanuel René Huchim Puc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update default values when chart type changes
parent
a62942d0
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
1 deletion
+22
-1
reportImg.js
reports/static/reports/js/reportImg.js
+22
-1
No files found.
reports/static/reports/js/reportImg.js
View file @
89095f8f
...
@@ -145,11 +145,32 @@ function change(newType) {
...
@@ -145,11 +145,32 @@ function change(newType) {
// Remove the old chart and all its event handles
// Remove the old chart and all its event handles
if
(
myChart
)
{
if
(
myChart
)
{
myChart
.
destroy
();
myChart
.
destroy
();
}
}
// Chart.js modifies the object you pass in. Pass a copy of the object so we can use the original object later
// Chart.js modifies the object you pass in. Pass a copy of the object so we can use the original object later
// -------------- set last values when the chart was destroyed ------
let
selectedLayers
=
getSelectedLayersName
().
map
(
layerName
=>
{
const
layerCheckbox
=
$
(
':checkbox[value='
+
layerName
+
']'
);
return
layerCheckbox
.
parent
().
attr
(
'id'
)
});
selectedLayers
=
selectedLayers
.
filter
(
layerId
=>
layerId
!=
null
);
selectedLayers
=
selectedLayers
.
map
(
layerId
=>
layerId
.
replace
(
'sclcheck-'
,
''
).
replace
(
'-'
,
' '
));
config
.
data
.
datasets
.
forEach
(
data
=>
{
const
label
=
data
.
label
.
toLowerCase
().
replace
(
'-'
,
' '
);
data
.
hidden
=
true
;
if
(
selectedLayers
.
includes
(
label
))
{
data
.
hidden
=
false
;
}
})
// -------------------------------------------------------------------
var
temp
=
jQuery
.
extend
(
true
,
{},
config
);
var
temp
=
jQuery
.
extend
(
true
,
{},
config
);
if
(
newType
==
"stackedBar"
){
if
(
newType
==
"stackedBar"
){
temp
.
type
=
"bar"
;
temp
.
type
=
"bar"
;
...
...
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