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
4b3219fd
Commit
4b3219fd
authored
Jan 22, 2021
by
Rodrigo Tapia-McClung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Improve radar chart ceation
parent
4643d048
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
201 deletions
+80
-201
cuerpos_charts.js
public/js/cuerpos_charts.js
+47
-143
cuerpos_functions.js
public/js/cuerpos_functions.js
+33
-58
No files found.
public/js/cuerpos_charts.js
View file @
4b3219fd
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*/
*/
/* globals updateBarChart, barChartData, am4charts, am4core, am4themes_animated */
/* globals updateBarChart, barChartData, am4charts, am4core, am4themes_animated */
/* export makeRadialChart */
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
function
grijalva_theme
(
target
)
{
function
grijalva_theme
(
target
)
{
...
@@ -35,15 +36,10 @@ function customizeGrip(grip) {
...
@@ -35,15 +36,10 @@ function customizeGrip(grip) {
img
.
valign
=
"middle"
;
img
.
valign
=
"middle"
;
}
}
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ RADAR- LINES
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ RADAR- LINES
am4core
.
ready
(
function
()
{
// Themes begin
let
mainTextColor
=
getComputedStyle
(
document
.
body
).
getPropertyValue
(
'--main-text-color'
);
am4core
.
useTheme
(
am4themes_animated
);
am4core
.
useTheme
(
grijalva_theme
);
let
mainTextColor
=
getComputedStyle
(
document
.
body
).
getPropertyValue
(
'--main-text-color'
);
// Themes end
// radial chart
const
makeRadialChart
=
(
data
,
months
,
years
)
=>
{
var
radialChart
=
am4core
.
create
(
"radial_chart"
,
am4charts
.
RadarChart
);
var
radialChart
=
am4core
.
create
(
"radial_chart"
,
am4charts
.
RadarChart
);
let
radialTitle
=
radialChart
.
titles
.
create
();
let
radialTitle
=
radialChart
.
titles
.
create
();
...
@@ -52,13 +48,11 @@ am4core.ready(function() {
...
@@ -52,13 +48,11 @@ am4core.ready(function() {
radialTitle
.
marginBottom
=
10
;
radialTitle
.
marginBottom
=
10
;
radialTitle
.
fill
=
am4core
.
color
(
mainTextColor
);
radialTitle
.
fill
=
am4core
.
color
(
mainTextColor
);
var
radialData
=
[];
radialChart
.
data
=
data
;
radialChart
.
data
=
radialData
;
//console.log(data);
/* Create axes */
/* Create axes */
//var categoryAxis = chart.xAxes.push(new am4charts.DateAxis());
var
radialCategoryAxis
=
radialChart
.
xAxes
.
push
(
new
am4charts
.
CategoryAxis
());
let
radialCategoryAxis
=
radialChart
.
xAxes
.
push
(
new
am4charts
.
CategoryAxis
());
radialCategoryAxis
.
dataFields
.
category
=
"month"
;
radialCategoryAxis
.
dataFields
.
category
=
"month"
;
radialCategoryAxis
.
fontSize
=
9
;
radialCategoryAxis
.
fontSize
=
9
;
radialCategoryAxis
.
renderer
.
labels
.
template
.
fill
=
am4core
.
color
(
mainTextColor
);
radialCategoryAxis
.
renderer
.
labels
.
template
.
fill
=
am4core
.
color
(
mainTextColor
);
...
@@ -75,48 +69,23 @@ am4core.ready(function() {
...
@@ -75,48 +69,23 @@ am4core.ready(function() {
//radialValueAxis.renderer.labels.template.fontSize = 15;
//radialValueAxis.renderer.labels.template.fontSize = 15;
/* Create and configure series */
/* Create and configure series */
//TODO: make these series in a more efficient way
const
createRadialSeries
=
(
chart
,
value
,
category
,
name
,
color
)
=>
{
var
radialSeries1
=
radialChart
.
series
.
push
(
new
am4charts
.
RadarSeries
());
let
radialSeries
=
chart
.
series
.
push
(
new
am4charts
.
RadarSeries
());
radialSeries1
.
dataFields
.
valueY
=
"value1"
;
radialSeries
.
dataFields
.
valueY
=
value
;
radialSeries1
.
dataFields
.
categoryX
=
"month"
//"date";
radialSeries
.
dataFields
.
categoryX
=
category
;
radialSeries1
.
strokeWidth
=
1.5
;
radialSeries
.
strokeWidth
=
1.5
;
radialSeries1
.
tooltipText
=
"{valueY}"
;
radialSeries
.
tooltipText
=
"{valueY}"
;
radialSeries1
.
name
=
"2016"
radialSeries
.
name
=
name
radialSeries1
.
stroke
=
am4core
.
color
(
"#F98293"
);
// red
radialSeries
.
stroke
=
am4core
.
color
(
color
);
// red
radialSeries1
.
tooltip
.
getFillFromObject
=
false
;
radialSeries
.
tooltip
.
getFillFromObject
=
false
;
radialSeries1
.
tooltipText
=
"[bold] {name}: [/]{valueY.formatNumber('#,###.0')} Ha[/]"
;
radialSeries
.
tooltipText
=
"[bold] {name}: [/]{valueY.formatNumber('#,###.0')} Ha[/]"
;
radialSeries1
.
tooltip
.
background
.
fill
=
am4core
.
color
(
"#F98293"
);
radialSeries
.
tooltip
.
background
.
fill
=
am4core
.
color
(
color
);
}
//radialSeries1.bullets.create(am4charts.CircleBullet);
//radialSeries1.dataItems.template.locations.dateX = 0.5;
let
seriesColor
=
[
"#F98293"
,
"#2AC2BB"
,
"#FDA259"
];
years
.
forEach
(
(
year
,
i
)
=>
{
var
radialSeries2
=
radialChart
.
series
.
push
(
new
am4charts
.
RadarSeries
());
createRadialSeries
(
radialChart
,
year
,
"month"
,
year
,
seriesColor
[
i
]);
radialSeries2
.
dataFields
.
valueY
=
"value2"
;
});
radialSeries2
.
dataFields
.
categoryX
=
"month"
;
//"date";
radialSeries2
.
strokeWidth
=
1.5
;
radialSeries2
.
tooltipText
=
"{valueY}"
;
radialSeries2
.
name
=
"2017"
;
radialSeries2
.
stroke
=
am4core
.
color
(
"#2AC2BB"
);
// red
radialSeries2
.
tooltip
.
getFillFromObject
=
false
;
//radialSeries2.tooltip.background.fill = am4core.color("#");
radialSeries2
.
tooltipText
=
"[bold] {name}: [/]{valueY.formatNumber('#,###.0')} Ha[/]"
;
radialSeries2
.
tooltip
.
background
.
fill
=
am4core
.
color
(
"#2AC2BB"
);
// red
//radialSeries2.tooltip.background.fill = am4core.
//radialSeries2.bullets.create(am4charts.CircleBullet);
//radialSeries2.dataItems.template.locations.dateX = 0.5;
var
radialSeries3
=
radialChart
.
series
.
push
(
new
am4charts
.
RadarSeries
());
radialSeries3
.
dataFields
.
valueY
=
"value3"
;
radialSeries3
.
dataFields
.
categoryX
=
"month"
;
//"date";
radialSeries3
.
strokeWidth
=
1.5
;
radialSeries3
.
tooltipText
=
"{valueY}"
;
radialSeries3
.
name
=
"2018"
;
radialSeries3
.
stroke
=
am4core
.
color
(
"#FDA259"
);
// red
radialSeries3
.
tooltipText
=
"[bold] {name}: [/]{valueY.formatNumber('#,###.0')} Ha[/]"
;
radialSeries3
.
tooltip
.
getFillFromObject
=
false
;
radialSeries3
.
tooltip
.
background
.
fill
=
am4core
.
color
(
"#FDA259"
);
//radialSeries2.bullets.create(am4charts.CircleBullet);
//radialSeries3.dataItems.template.locations.X = 0.5;
radialChart
.
scrollbarX
=
new
am4core
.
Scrollbar
();
radialChart
.
scrollbarX
=
new
am4core
.
Scrollbar
();
radialChart
.
scrollbarX
.
minHeight
=
1
;
radialChart
.
scrollbarX
.
minHeight
=
1
;
...
@@ -128,94 +97,22 @@ am4core.ready(function() {
...
@@ -128,94 +97,22 @@ am4core.ready(function() {
customizeGrip
(
radialChart
.
scrollbarY
.
startGrip
);
customizeGrip
(
radialChart
.
scrollbarY
.
startGrip
);
customizeGrip
(
radialChart
.
scrollbarY
.
endGrip
);
customizeGrip
(
radialChart
.
scrollbarY
.
endGrip
);
//TODO: make these ranges in a more efficient way
const
makeRadialRange
=
(
start
,
end
,
color
,
span
)
=>
{
var
range_estiaje
=
radialCategoryAxis
.
axisRanges
.
create
();
let
radialRange
=
radialCategoryAxis
.
axisRanges
.
create
();
range_estiaje
.
category
=
"March"
;
radialRange
.
category
=
start
;
range_estiaje
.
endcategory
=
"April"
;
radialRange
.
endcategory
=
end
;
range_estiaje
.
axisFill
.
fill
=
am4core
.
color
(
"#595952"
);
radialRange
.
axisFill
.
fill
=
am4core
.
color
(
color
);
//range_estiaje.axisFill.fill = am4core.color("#DFA34D");
radialRange
.
axisFill
.
fillOpacity
=
0.4
;
range_estiaje
.
axisFill
.
fillOpacity
=
0.4
;
radialRange
.
grid
.
strokeOpacity
=
0
;
range_estiaje
.
grid
.
strokeOpacity
=
0
;
radialRange
.
locations
.
endCategory
=
span
?
span
:
""
;
}
var
range_estiaje_1
=
radialCategoryAxis
.
axisRanges
.
create
();
range_estiaje_1
.
category
=
"April"
;
let
radialRangeColors
=
[
"#E1DBC8"
,
"#595952"
,
"#838278"
,
"#B1AE9F"
];
range_estiaje_1
.
endcategory
=
"May"
;
makeRadialRange
(
"enero"
,
"marzo"
,
radialRangeColors
[
0
],
2
);
range_estiaje_1
.
axisFill
.
fill
=
am4core
.
color
(
"#595952"
);
makeRadialRange
(
"marzo"
,
"mayo"
,
radialRangeColors
[
1
],
2
);
//range_estiaje_1.axisFill.fill = am4core.color("#DFA34D");
makeRadialRange
(
"mayo"
,
"septiembre"
,
radialRangeColors
[
2
],
4
);
range_estiaje_1
.
axisFill
.
fillOpacity
=
0.4
;
makeRadialRange
(
"septiembre"
,
"diciembre"
,
radialRangeColors
[
3
],
3
);
range_estiaje_1
.
grid
.
strokeOpacity
=
0
;
makeRadialRange
(
"diciembre"
,
"diciembre"
,
radialRangeColors
[
0
],
1
);
var
range_lluvTropical
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvTropical
.
category
=
"May"
;
range_lluvTropical
.
endcategory
=
"June"
;
//range_lluvTropical.date = new Date(2020, 4, 1);
//range_lluvTropical.endDate = new Date(2020, 8, 1);
range_lluvTropical
.
axisFill
.
fill
=
am4core
.
color
(
"#838278"
);
range_lluvTropical
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvTropical
.
grid
.
strokeOpacity
=
0
;
var
range_lluvTropical_1
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvTropical_1
.
category
=
"June"
;
range_lluvTropical_1
.
endcategory
=
"July"
;
range_lluvTropical_1
.
axisFill
.
fill
=
am4core
.
color
(
"#838278"
);
range_lluvTropical_1
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvTropical_1
.
grid
.
strokeOpacity
=
0
;
var
range_lluvTropical_2
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvTropical_2
.
category
=
"July"
;
range_lluvTropical_2
.
endcategory
=
"August"
;
range_lluvTropical_2
.
axisFill
.
fill
=
am4core
.
color
(
"#838278"
);
range_lluvTropical_2
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvTropical_2
.
grid
.
strokeOpacity
=
0
;
var
range_lluvTropical_3
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvTropical_3
.
category
=
"August"
;
range_lluvTropical_3
.
endcategory
=
"September"
;
range_lluvTropical_3
.
axisFill
.
fill
=
am4core
.
color
(
"#838278"
);
range_lluvTropical_3
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvTropical_3
.
grid
.
strokeOpacity
=
0
;
var
range_lluvTropicalInv
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvTropicalInv
.
category
=
"September"
;
range_lluvTropicalInv
.
endcategory
=
"October"
;
range_lluvTropicalInv
.
axisFill
.
fill
=
am4core
.
color
(
"#B1AE9F"
);
range_lluvTropicalInv
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvTropicalInv
.
grid
.
strokeOpacity
=
0
;
var
range_lluvTropicalInv_1
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvTropicalInv_1
.
category
=
"October"
;
range_lluvTropicalInv_1
.
endcategory
=
"November"
;
range_lluvTropicalInv_1
.
axisFill
.
fill
=
am4core
.
color
(
"#B1AE9F"
);
range_lluvTropicalInv_1
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvTropicalInv_1
.
grid
.
strokeOpacity
=
0
;
var
range_lluvTropicalInv_2
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvTropicalInv_2
.
category
=
"November"
;
range_lluvTropicalInv_2
.
endcategory
=
"December"
;
range_lluvTropicalInv_2
.
axisFill
.
fill
=
am4core
.
color
(
"#B1AE9F"
);
range_lluvTropicalInv_2
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvTropicalInv_2
.
grid
.
strokeOpacity
=
0
;
var
range_lluvInv
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvInv
.
category
=
"December"
;
range_lluvInv
.
endcategory
=
"January"
;
range_lluvInv
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv
.
grid
.
strokeOpacity
=
0
;
var
range_lluvInv_1
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvInv_1
.
category
=
"January"
;
range_lluvInv_1
.
endcategory
=
"February"
;
range_lluvInv_1
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv_1
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv_1
.
grid
.
strokeOpacity
=
0
;
var
range_lluvInv_2
=
radialCategoryAxis
.
axisRanges
.
create
();
range_lluvInv_2
.
category
=
"February"
;
range_lluvInv_2
.
endcategory
=
"March"
;
range_lluvInv_2
.
axisFill
.
fill
=
am4core
.
color
(
"#E1DBC8"
);
range_lluvInv_2
.
axisFill
.
fillOpacity
=
0.4
;
range_lluvInv_2
.
grid
.
strokeOpacity
=
0
;
radialChart
.
cursor
=
new
am4charts
.
RadarCursor
();
radialChart
.
cursor
=
new
am4charts
.
RadarCursor
();
...
@@ -228,7 +125,6 @@ am4core.ready(function() {
...
@@ -228,7 +125,6 @@ am4core.ready(function() {
{
name
:
"Tropical"
,
fill
:
am4core
.
color
(
"#838278"
)
},
{
name
:
"Tropical"
,
fill
:
am4core
.
color
(
"#838278"
)
},
{
name
:
"Tropical-Invernal"
,
fill
:
am4core
.
color
(
"#B1AE9F"
)
},
{
name
:
"Tropical-Invernal"
,
fill
:
am4core
.
color
(
"#B1AE9F"
)
},
{
name
:
"Invernal"
,
fill
:
am4core
.
color
(
"#E1DBC8"
)
}
{
name
:
"Invernal"
,
fill
:
am4core
.
color
(
"#E1DBC8"
)
}
];
];
radialChart
.
legend
.
data
=
legenddata
;
radialChart
.
legend
.
data
=
legenddata
;
...
@@ -237,6 +133,14 @@ am4core.ready(function() {
...
@@ -237,6 +133,14 @@ am4core.ready(function() {
var
markerTemplate
=
radialChart
.
legend
.
markers
.
template
;
var
markerTemplate
=
radialChart
.
legend
.
markers
.
template
;
markerTemplate
.
width
=
20
;
markerTemplate
.
width
=
20
;
markerTemplate
.
height
=
20
;
markerTemplate
.
height
=
20
;
}
am4core
.
ready
(
function
()
{
// Themes begin
am4core
.
useTheme
(
am4themes_animated
);
am4core
.
useTheme
(
grijalva_theme
);
//let mainTextColor = getComputedStyle(document.body).getPropertyValue('--main-text-color');
// Themes end
// linea chart
// linea chart
let
lineChart
=
am4core
.
create
(
"linesChart"
,
am4charts
.
XYChart
);
let
lineChart
=
am4core
.
create
(
"linesChart"
,
am4charts
.
XYChart
);
...
...
public/js/cuerpos_functions.js
View file @
4b3219fd
...
@@ -5,8 +5,8 @@
...
@@ -5,8 +5,8 @@
* January 2021
* January 2021
*/
*/
/* globals omnivore, Promise, makeBaseMap, am4core */
/* globals omnivore, Promise, makeBaseMap, am4core
, makeRadialChart
*/
/* exported. userFiles, userDates, timeParse, layerControl */
/* exported. userFiles, userDates, timeParse, layerControl
, yearList
*/
let
timeParse
,
let
timeParse
,
timeFormat
,
timeFormat
,
...
@@ -282,72 +282,47 @@ const setupMap = (dates) => {
...
@@ -282,72 +282,47 @@ const setupMap = (dates) => {
});
});
}
}
let
barChartData
=
[];
let
barChartData
=
[],
yearList
;
const
populateMap
=
async
(
mapData
)
=>
{
const
populateMap
=
async
(
mapData
)
=>
{
let
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
let
baseUrl
=
new
URL
(
`/data`
,
window
.
location
.
href
).
href
;
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ RADIAL CHART
// RADIAL CHART
let
data
=
[];
// empty array to hold chart data
// get am chart - may need this to update chart on date change
// get am chart
//let radialChart = am4core.registry.baseSprites.find(c => c.htmlContainer.id === "radial_chart");
let
radialChart
=
am4core
.
registry
.
baseSprites
.
find
(
c
=>
c
.
htmlContainer
.
id
===
"radial_chart"
);
// async queries for each date that has been loaded
// async queries for each date that has been loaded
const
queries
=
userFiles
.
map
(
async
(
mes
,
i
)
=>
{
const
queries
=
userFiles
.
map
(
async
(
mes
,
i
)
=>
{
//let query = `${baseUrl}/query/${mes}?columns=sum(areacpo)/10000 value1,sum(perimcpo) value2, sum(dimfrcpo) value3`;
//let query = `${baseUrl}/query/${mes}?columns=sum(areacpo)/10000 value1,sum(perimcpo) value2, sum(dimfrcpo) value3`;
let
query
=
`
${
baseUrl
}
/query/
${
mes
}
?columns=sum(areacpo)/10000
value1
`
;
let
query
=
`
${
baseUrl
}
/query/
${
mes
}
?columns=sum(areacpo)/10000
area
`
;
const
queryData
=
await
d3
.
json
(
query
);
const
queryData
=
await
d3
.
json
(
query
);
let
date
=
new
Date
(
dateArray
[
i
]);
queryData
[
0
].
date
=
new
Date
(
userDates
[
i
])
queryData
[
0
].
date
=
date
;
return
new
Promise
(
resolve
=>
{
data
.
push
(
queryData
[
0
]);
resolve
(
queryData
[
0
]);
});
});
// wait for all queries to complete
});
const
dataQueries
=
await
Promise
.
all
(
queries
);
// wait for all queries to complete and then set chart data
// and then set chart data
Promise
.
all
(
queries
).
then
(
data
=>
{
let
data_1
=
data
;
data_1
.
sort
((
a
,
b
)
=>
(
a
.
date
>
b
.
date
)
?
1
:
-
1
)
var
month
=
new
Array
();
month
[
0
]
=
"January"
;
month
[
1
]
=
"February"
;
month
[
2
]
=
"March"
;
month
[
3
]
=
"April"
;
month
[
4
]
=
"May"
;
month
[
5
]
=
"June"
;
month
[
6
]
=
"July"
;
month
[
7
]
=
"August"
;
month
[
8
]
=
"September"
;
month
[
9
]
=
"October"
;
month
[
10
]
=
"November"
;
month
[
11
]
=
"December"
;
var
year
=
new
Array
();
year
[
116
]
=
"2016"
;
year
[
117
]
=
"2017"
;
year
[
118
]
=
"2018"
;
let
cc
;
for
(
cc
=
0
;
cc
<
data_1
.
length
;
cc
++
)
{
data_1
[
cc
].
mm
=
month
[(
data_1
[
cc
].
date
).
getMonth
()];
data_1
[
cc
].
yy
=
year
[(
data_1
[
cc
].
date
).
getYear
()];
}
// TODO: check this for loop to use selected months and years
// create sets of unique months and years
yearList
=
[...
new
Set
(
userDates
.
map
(
date
=>
new
Date
(
date
).
getFullYear
()
))];
var
element
=
{},
//let formatter = new Intl.DateTimeFormat('es', { month: 'long' });
cart
=
[],
cntr
;
for
(
cntr
=
0
;
cntr
<
12
;
cntr
++
)
{
//console.log(month[cntr]);
element
=
{};
element
.
month
=
(
month
[
cntr
]).
toString
();
element
.
value1
=
(
data_1
.
filter
(
function
(
d
)
{
return
d
.
mm
==
month
[
cntr
]
&&
d
.
yy
==
2016
}))[
0
].
value1
;
element
.
value2
=
(
data_1
.
filter
(
function
(
d
)
{
return
d
.
mm
==
month
[
cntr
]
&&
d
.
yy
==
2017
}))[
0
].
value1
;
element
.
value3
=
(
data_1
.
filter
(
function
(
d
)
{
return
d
.
mm
==
month
[
cntr
]
&&
d
.
yy
==
2018
}))[
0
].
value1
;
cart
.
push
(
element
);
}
radialChart
.
data
=
cart
;
// TODO: maybe make this a function so it can be used to update chart when changing dates
let
chartaData
=
[];
monthArray
.
forEach
(
(
month
,
index
)
=>
{
let
element
=
{};
yearList
.
forEach
(
year
=>
{
//element.month = formatter.format(new Date(year, month, 1, 0, 0, 0));
element
.
month
=
month
.
toLowerCase
();
let
yearData
=
data
.
filter
(
d
=>
new
Date
(
d
.
date
).
getMonth
()
==
index
&&
new
Date
(
d
.
date
).
getFullYear
()
==
year
);
element
[
year
]
=
yearData
.
length
>
0
?
yearData
[
0
].
area
:
null
;
});
chartaData
.
push
(
element
);
});
makeRadialChart
(
chartaData
,
monthArray
,
yearList
);
});
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LINE CHART
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ LINE CHART
let
data_ls
=
[];
let
data_ls
=
[];
...
...
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