Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
frag.jetzt SWTP 2022
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Marc Tröll
frag.jetzt SWTP 2022
Commits
da809002
Commit
da809002
authored
6 years ago
by
Lukas Mauß
Browse files
Options
Downloads
Patches
Plain Diff
Implement change-bar-colors function
parent
71bdea69
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/app/components/shared/statistic/statistic.component.html
+1
-1
1 addition, 1 deletion
src/app/components/shared/statistic/statistic.component.html
src/app/components/shared/statistic/statistic.component.ts
+62
-2
62 additions, 2 deletions
src/app/components/shared/statistic/statistic.component.ts
with
63 additions
and
3 deletions
src/app/components/shared/statistic/statistic.component.html
+
1
−
1
View file @
da809002
...
...
@@ -6,7 +6,7 @@
<h4>
{{subject}}
</h4>
</mat-card-title>
<span
class=
"fill-remaining-space"
></span>
<button
mat-icon-button
color=
"primary"
>
<button
mat-icon-button
(click)=
"switchAnswers()"
color=
"primary"
>
<mat-icon>
info
</mat-icon>
</button>
</mat-card-header>
...
...
This diff is collapsed.
Click to expand it.
src/app/components/shared/statistic/statistic.component.ts
+
62
−
2
View file @
da809002
...
...
@@ -26,6 +26,7 @@ export class StatisticComponent implements OnInit {
chart
=
Chart
;
colors
:
string
[]
=
[
'
rgba(33,150,243, 0.8)
'
,
'
rgba(76,175,80, 0.8)
'
,
'
rgba(255,235,59, 0.8)
'
,
'
rgba(244,67,54, 0.8)
'
,
'
rgba(96,125,139, 0.8)
'
,
'
rgba(63,81,181, 0.8)
'
,
'
rgba(233,30,99, 0.8)
'
,
'
rgba(121,85,72, 0.8)
'
];
ccolors
:
string
[]
=
[];
label
=
'
ABCDEFGH
'
;
labels
:
string
[];
// = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H'];
answers
:
string
[];
...
...
@@ -36,7 +37,6 @@ export class StatisticComponent implements OnInit {
maxLength
:
number
;
isLoading
=
true
;
showsCorrect
=
false
;
correctIndexes
:
number
[];
constructor
(
protected
route
:
ActivatedRoute
,
private
contentService
:
ContentService
,
...
...
@@ -52,7 +52,6 @@ export class StatisticComponent implements OnInit {
this
.
labels
=
new
Array
<
string
>
();
this
.
answerList
=
new
Array
<
AnswerList
>
();
this
.
data
=
new
Array
<
number
>
();
this
.
correctIndexes
=
new
Array
<
number
>
();
this
.
route
.
params
.
subscribe
(
params
=>
{
this
.
contentId
=
params
[
'
contentId
'
];
});
...
...
@@ -71,10 +70,66 @@ export class StatisticComponent implements OnInit {
}
showCorrect
()
{
this
.
chart
=
new
Chart
(
'
chart
'
,
{
type
:
'
bar
'
,
data
:
{
labels
:
this
.
labels
,
datasets
:
[{
data
:
this
.
data
,
backgroundColor
:
this
.
ccolors
}]
},
options
:
{
legend
:
{
display
:
false
},
tooltips
:
{
mode
:
'
index
'
},
responsive
:
true
,
maintainAspectRatio
:
false
,
scales
:
{
yAxes
:
[{
ticks
:
{
beginAtZero
:
true
,
precision
:
0
}
}]
}
}
});
this
.
showsCorrect
=
true
;
}
showNormal
()
{
this
.
chart
=
new
Chart
(
'
chart
'
,
{
type
:
'
bar
'
,
data
:
{
labels
:
this
.
labels
,
datasets
:
[{
data
:
this
.
data
,
backgroundColor
:
this
.
colors
}]
},
options
:
{
legend
:
{
display
:
false
},
tooltips
:
{
mode
:
'
index
'
},
responsive
:
true
,
maintainAspectRatio
:
false
,
scales
:
{
yAxes
:
[{
ticks
:
{
beginAtZero
:
true
,
precision
:
0
}
}]
}
}
});
this
.
showsCorrect
=
false
;
}
...
...
@@ -90,6 +145,11 @@ export class StatisticComponent implements OnInit {
}
else
{
this
.
answerList
[
i
].
answer
=
content
.
options
[
i
].
label
;
}
if
(
content
.
options
[
i
].
points
<=
0
)
{
this
.
ccolors
[
i
]
=
'
rgba(244,67,54, 0.8)
'
;
}
else
{
this
.
ccolors
[
i
]
=
'
rgba(76,175,80, 0.8)
'
;
}
}
this
.
translateService
.
get
(
'
statistic.abstentions
'
).
subscribe
(
label
=>
{
this
.
labels
.
push
(
label
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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