Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
ffbs-website
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ffbs
ffbs-website
Commits
3d1a4192
Commit
3d1a4192
authored
4 years ago
by
Kasalehlia
Browse files
Options
Downloads
Patches
Plain Diff
Spendenseite: neuer Graph
parent
7c659d0e
No related branches found
No related tags found
No related merge requests found
Pipeline
#1566
passed
4 years ago
Stage: deploy
Changes
3
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
flamingo/content/spenden.html
+2
-2
2 additions, 2 deletions
flamingo/content/spenden.html
flamingo/static/js/Chart.min.js
+7
-0
7 additions, 0 deletions
flamingo/static/js/Chart.min.js
flamingo/static/js/finanz.js
+38
-11
38 additions, 11 deletions
flamingo/static/js/finanz.js
with
47 additions
and
13 deletions
flamingo/content/spenden.html
+
2
−
2
View file @
3d1a4192
...
...
@@ -58,7 +58,7 @@ title: Spenden
Der folgende Graph gibt dir eine Übersicht über die Finanzierung von Freifunk
Braunschweig über die letzen sechs Monate:
<br
/>
<br
>
<
div
id=
"graph"
style=
"width: 100%; height: 300px;"
></
div
>
<
canvas
id=
"graph"
style=
"width: 100%; height: 300px;"
></
canvas
>
Das aktuelle Guthaben des Freifunk Braunschweig beträgt:
<span
id=
"finanz_total"
>
?
</span>
EUR
</div>
</div>
...
...
@@ -87,6 +87,6 @@ title: Spenden
</div>
</div>
</div>
<script
src=
"/js/
dygraph-combined
.js"
></script>
<script
src=
"/js/
Chart.min
.js"
></script>
<script
src=
"/js/finanz.js"
></script>
This diff is collapsed.
Click to expand it.
flamingo/static/js/Chart.min.js
0 → 100644
+
7
−
0
View file @
3d1a4192
This diff is collapsed.
Click to expand it.
flamingo/static/js/finanz.js
+
38
−
11
View file @
3d1a4192
...
...
@@ -12,18 +12,45 @@ $(function () {
const
typeIds
=
types
.
map
(
function
(
typ
)
{
return
ans
.
types
.
findIndex
(
function
(
t
)
{
return
t
.
indexOf
(
typ
)
>
-
1
;
});
});
const
graphData
=
[];
for
(
let
i
=
0
;
i
<
6
;
i
++
)
{
graphData
.
push
([
i
].
concat
(
typeIds
.
map
(
function
(
typeId
)
{
return
parseFloat
(
ans
.
months
[
i
].
typeTotals
[
typeId
]);
})));
const
income
=
[];
const
expense
=
[];
const
labels
=
[];
for
(
let
i
=
1
;
i
<=
12
;
i
++
)
{
labels
.
unshift
(
ans
.
months
[
i
].
yearmonth
);
for
(
let
j
=
0
;
j
<
typeIds
.
length
;
j
++
)
{
((
j
%
2
)
===
0
?
income
:
expense
).
unshift
(
Math
.
abs
(
parseFloat
(
ans
.
months
[
i
].
typeTotals
[
typeIds
[
j
]])));
}
}
console
.
log
(
graphData
)
const
labels
=
[
'
Monat
'
].
concat
(
types
);
new
Dygraph
(
document
.
getElementById
(
'
graph
'
),
graphData
,
{
labels
:
labels
,
xlabel
:
labels
[
0
],
ylabel
:
'
Euro
'
const
ctx
=
document
.
getElementById
(
'
graph
'
).
getContext
(
'
2d
'
);
const
chart
=
new
Chart
(
ctx
,
{
type
:
'
bar
'
,
data
:
{
labels
,
datasets
:
[{
backgroundColor
:
'
#90ee90
'
,
label
:
'
Einnahmen
'
,
data
:
income
},
{
backgroundColor
:
'
#ff6363
'
,
label
:
'
Ausgaben
'
,
data
:
expense
}],
},
options
:
{
scales
:
{
yAxes
:
[{
scaleLabel
:
{
display
:
true
,
labelString
:
'
EUR
'
,
},
}],
},
tooltips
:
{
callbacks
:
{
label
:
function
(
item
)
{
return
item
.
yLabel
+
'
€
'
;
},
},
},
},
});
});
});
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment