Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
kigrig
/
Andmetootlus-Joe-Andmete-Alusel
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
d8afa1f8
authored
May 05, 2022
by
kigrig
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
To solo chart added avg value
parent
ae70bee4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
7 deletions
scr/func.h
scr/func.h
View file @
d8afa1f8
...
@@ -237,8 +237,30 @@ string createChartsOfOneYear(string name, int &pos, string aastadeVahemik){
...
@@ -237,8 +237,30 @@ string createChartsOfOneYear(string name, int &pos, string aastadeVahemik){
for
(
int
totalCounter
=
0
;
totalCounter
<
riversPlaceCount
;
totalCounter
++
){
for
(
int
totalCounter
=
0
;
totalCounter
<
riversPlaceCount
;
totalCounter
++
){
HTMLcode
.
append
(
addChart
(
riversPlaceNames
[
totalCounter
],
valgla
[
totalCounter
],
pos
));
HTMLcode
.
append
(
addChart
(
riversPlaceNames
[
totalCounter
],
valgla
[
totalCounter
],
pos
));
//SQL paring
//SQL paringud
string
command
=
"SELECT DISTINCT seire_jogi_hydrol.hkuu, round(AVG(seire_jogi_hydrol.vaartus))\
string
command
=
"SELECT DISTINCT seire_jogi_hydrol.haasta, AVG(seire_jogi_hydrol.vaartus)\
FROM seire_jogi_hydrol\
INNER JOIN seire_jogi_hydrol_jaamad USING (id_jaam)\
INNER JOIN joe_andmed\
ON joe_andmed.id_jogi/10 = seire_jogi_hydrol_jaamad.id_jogi\
AND joe_andmed.id_peajogi = joe_andmed.id_jogi\
AND seire_jogi_hydrol_jaamad.lavendi_nimi = '{lavendi_nimi}'\
GROUP BY seire_jogi_hydrol.haasta\
ORDER BY seire_jogi_hydrol.haasta;"
;
replaceInString
(
command
,
"{lavendi_nimi}"
,
riversPlaceNames
[
totalCounter
]);
res
=
PQexec
(
conn
,
command
.
c_str
());
double
keskmine
;
for
(
int
i
=
0
;
i
<
PQntuples
(
res
);
i
++
){
keskmine
+=
stod
(
PQgetvalue
(
res
,
i
,
1
),
nullptr
);
}
keskmine
/=
PQntuples
(
res
);
command
=
"SELECT DISTINCT seire_jogi_hydrol.hkuu, round(AVG(seire_jogi_hydrol.vaartus))\
FROM seire_jogi_hydrol\
FROM seire_jogi_hydrol\
INNER JOIN seire_jogi_hydrol_jaamad USING (id_jaam)\
INNER JOIN seire_jogi_hydrol_jaamad USING (id_jaam)\
INNER JOIN joe_andmed\
INNER JOIN joe_andmed\
...
@@ -307,16 +329,20 @@ string createChartsOfOneYear(string name, int &pos, string aastadeVahemik){
...
@@ -307,16 +329,20 @@ string createChartsOfOneYear(string name, int &pos, string aastadeVahemik){
if
(
rec_count
>
0
){
if
(
rec_count
>
0
){
toWrite
+=
"]},
\n\t\n\t\t
{ name: 'Maksimum-5%', data: ["
;
toWrite
+=
"]},
\n\t\n\t\t
{ name: 'Keskmine', data: ["
;
toWrite
+=
" {max-5%}"
;
for
(
int
i
=
0
;
i
<
rec_count
;
i
++
){
toWrite
+=
", {kesk}"
;
replaceInString
(
toWrite
,
"{kesk}"
,
to_string
(
keskmine
));
}
toWrite
+=
"]},
\n\t\n\t\t
{ name: 'Maksimum-5%', data: [ {max-5%}"
;
replaceInString
(
toWrite
,
"{max-5%}"
,
to_string
(
0
.
001
+
(
long
)
maxValue
*
0
.
95
));
replaceInString
(
toWrite
,
"{max-5%}"
,
to_string
(
0
.
001
+
(
long
)
maxValue
*
0
.
95
));
for
(
int
i
=
1
;
i
<
rec_count
;
i
++
){
for
(
int
i
=
1
;
i
<
rec_count
;
i
++
){
toWrite
+=
", {max-5%}"
;
toWrite
+=
", {max-5%}"
;
replaceInString
(
toWrite
,
"{max-5%}"
,
to_string
((
long
)
maxValue
*
0
.
95
));
replaceInString
(
toWrite
,
"{max-5%}"
,
to_string
((
long
)
maxValue
*
0
.
95
));
}
}
toWrite
+=
"]},
\n\t\n\t\t
{ name: 'Maksimum+5%', data: ["
;
toWrite
+=
"]},
\n\t\n\t\t
{ name: 'Maksimum+5%', data: [ {max+5%}"
;
toWrite
+=
" {max+5%}"
;
replaceInString
(
toWrite
,
"{max+5%}"
,
to_string
(
0
.
001
+
(
long
)
maxValue
*
1
.
05
));
replaceInString
(
toWrite
,
"{max+5%}"
,
to_string
(
0
.
001
+
(
long
)
maxValue
*
1
.
05
));
for
(
int
i
=
1
;
i
<
rec_count
;
i
++
){
for
(
int
i
=
1
;
i
<
rec_count
;
i
++
){
toWrite
+=
", {max+5%}"
;
toWrite
+=
", {max+5%}"
;
...
@@ -345,7 +371,7 @@ string createChartsOfOneYear(string name, int &pos, string aastadeVahemik){
...
@@ -345,7 +371,7 @@ string createChartsOfOneYear(string name, int &pos, string aastadeVahemik){
toWrite
+=
"
\t\t\t
summary: 'Voolu hulgad, mis olid DB
\\
's, teie valitud aasta eest.',
\n
"
;
toWrite
+=
"
\t\t\t
summary: 'Voolu hulgad, mis olid DB
\\
's, teie valitud aasta eest.',
\n
"
;
toWrite
+=
"
\t\t
visuallyHiddenStyles: 'position: relative; text-align: center; top: 100%; width: 80%; left: 10%; font-size: 24px; overflow-x: auto;'
\n\t\t
}),
\n
"
;
toWrite
+=
"
\t\t
visuallyHiddenStyles: 'position: relative; text-align: center; top: 100%; width: 80%; left: 10%; font-size: 24px; overflow-x: auto;'
\n\t\t
}),
\n
"
;
toWrite
+=
"
\n
Chartist.plugins.ctThreshold({ threshold:"
;
toWrite
+=
"
\n
Chartist.plugins.ctThreshold({ threshold:"
;
if
(
rec_count
>
0
)
toWrite
+=
to_string
(
sum
);
if
(
rec_count
>
0
)
toWrite
+=
to_string
(
keskmine
);
else
toWrite
+=
to_string
(
0
);
else
toWrite
+=
to_string
(
0
);
toWrite
+=
"}),"
;
toWrite
+=
"}),"
;
toWrite
+=
"
\t\t
Chartist.plugins.ctAxisTitle({
\n
\
toWrite
+=
"
\t\t
Chartist.plugins.ctAxisTitle({
\n
\
...
...
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