Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fordecyt_2019
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Rodrigo Tapia-McClung
fordecyt_2019
Commits
eeb995f6
Commit
eeb995f6
authored
Jan 20, 2021
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only update chart on month change
parent
93da8952
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
7 deletions
+16
-7
cuerpos_charts.js
public/js/cuerpos_charts.js
+16
-7
No files found.
public/js/cuerpos_charts.js
View file @
eeb995f6
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
* January 2021
* January 2021
*/
*/
/* globals map, userFiles, userDates, indicators, indicatorVars, indicatorsNames */
/* globals map, userFiles, userDates, indicators, indicatorVars, indicatorsNames
, updateBarChart, barChartData
*/
/* exported makeIndicatorGraph, getData, updateData, getDataInSelection */
/* exported makeIndicatorGraph, getData, updateData, getDataInSelection */
let
mainTextColor
=
getComputedStyle
(
document
.
body
).
getPropertyValue
(
'--main-text-color'
);
let
mainTextColor
=
getComputedStyle
(
document
.
body
).
getPropertyValue
(
'--main-text-color'
);
...
@@ -846,21 +846,21 @@ am4core.ready(function() {
...
@@ -846,21 +846,21 @@ am4core.ready(function() {
var
range_lluvInv
=
categoryAxis
.
axisRanges
.
create
();
var
range_lluvInv
=
categoryAxis
.
axisRanges
.
create
();
range_lluvInv
.
category
=
"December"
;
range_lluvInv
.
category
=
"December"
;
range_lluvInv
.
endcategory
=
"January"
;
;
range_lluvInv
.
endcategory
=
"January"
;
range_lluvInv
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv
.
grid
.
strokeOpacity
=
0
;
range_lluvInv
.
grid
.
strokeOpacity
=
0
;
var
range_lluvInv_1
=
categoryAxis
.
axisRanges
.
create
();
var
range_lluvInv_1
=
categoryAxis
.
axisRanges
.
create
();
range_lluvInv_1
.
category
=
"January"
;
range_lluvInv_1
.
category
=
"January"
;
range_lluvInv_1
.
endcategory
=
"February"
;
;
range_lluvInv_1
.
endcategory
=
"February"
;
range_lluvInv_1
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv_1
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv_1
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv_1
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv_1
.
grid
.
strokeOpacity
=
0
;
range_lluvInv_1
.
grid
.
strokeOpacity
=
0
;
var
range_lluvInv_2
=
categoryAxis
.
axisRanges
.
create
();
var
range_lluvInv_2
=
categoryAxis
.
axisRanges
.
create
();
range_lluvInv_2
.
category
=
"February"
;
range_lluvInv_2
.
category
=
"February"
;
range_lluvInv_2
.
endcategory
=
"March"
;
;
range_lluvInv_2
.
endcategory
=
"March"
;
range_lluvInv_2
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv_2
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv_2
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv_2
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv_2
.
grid
.
strokeOpacity
=
0
;
range_lluvInv_2
.
grid
.
strokeOpacity
=
0
;
...
@@ -1203,6 +1203,7 @@ am4core.ready(function() {
...
@@ -1203,6 +1203,7 @@ am4core.ready(function() {
series3
.
strokeWidth
=
2
;
series3
.
strokeWidth
=
2
;
chart
.
cursor
=
new
am4charts
.
XYCursor
();
chart
.
cursor
=
new
am4charts
.
XYCursor
();
chart
.
snapToSeries
=
series2
;
chart
.
cursor
.
xAxis
=
dateAxis
;
chart
.
cursor
.
xAxis
=
dateAxis
;
chart
.
scrollbarX
=
new
am4core
.
Scrollbar
();
chart
.
scrollbarX
=
new
am4core
.
Scrollbar
();
chart
.
scrollbarX
.
minHeight
=
1
;
chart
.
scrollbarX
.
minHeight
=
1
;
...
@@ -1293,8 +1294,13 @@ am4core.ready(function() {
...
@@ -1293,8 +1294,13 @@ am4core.ready(function() {
/* Set up cursor behavior */
/* Set up cursor behavior */
let
previousDate
=
""
;
chart
.
cursor
.
events
.
on
(
"cursorpositionchanged"
,
function
(
ev
)
{
chart
.
cursor
.
events
.
on
(
"cursorpositionchanged"
,
function
(
ev
)
{
let
xAxis
=
ev
.
target
.
chart
.
xAxes
.
getIndex
(
0
);
let
xAxis
=
ev
.
target
.
chart
.
xAxes
.
getIndex
(
0
);
/*let axis = dateAxis.positionToDate(dateAxis.toAxisPosition(ev.target.xPosition)),
currentYear = axis.getFullYear().toString(),
currentMonth = axis.getMonth().toString();
console.log(currentYear, currentMonth)*/
let
yy
=
xAxis
.
positionToDate
(
xAxis
.
toAxisPosition
(
ev
.
target
.
xPosition
)).
getFullYear
().
toString
();
let
yy
=
xAxis
.
positionToDate
(
xAxis
.
toAxisPosition
(
ev
.
target
.
xPosition
)).
getFullYear
().
toString
();
let
mm
=
xAxis
.
positionToDate
(
xAxis
.
toAxisPosition
(
ev
.
target
.
xPosition
)).
getMonth
().
toString
();
let
mm
=
xAxis
.
positionToDate
(
xAxis
.
toAxisPosition
(
ev
.
target
.
xPosition
)).
getMonth
().
toString
();
let
month
=
0
,
let
month
=
0
,
...
@@ -1304,9 +1310,12 @@ am4core.ready(function() {
...
@@ -1304,9 +1310,12 @@ am4core.ready(function() {
month
=
parseInt
(
mm
)
+
1
;
month
=
parseInt
(
mm
)
+
1
;
month
.
toString
();
month
.
toString
();
}
}
filterDate
=
new
Date
(
`
${
yy
}
-
${
month
}
-01T00:00:00`
);
let
filterDate
=
new
Date
(
`
${
yy
}
-
${
month
}
-01T00:00:00`
);
// only update chart when dates in cursor change month
if
(
filterDate
.
valueOf
()
!=
previousDate
.
valueOf
())
{
previousDate
=
filterDate
;
updateBarChart
(
filterDate
,
barChartData
);
updateBarChart
(
filterDate
,
barChartData
);
}
})
})
/* popChart.cursor = new am4charts.XYCursor();
/* popChart.cursor = new am4charts.XYCursor();
...
...
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