Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
WiKoDa - Dashboard
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
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
innohs_one
WiKoDa - Dashboard
Commits
2369ec37
Commit
2369ec37
authored
2 years ago
by
Lewin Kästner
Browse files
Options
Downloads
Patches
Plain Diff
remove stacked-bar service
parent
f7618233
No related branches found
No related tags found
1 merge request
!157
Documentation improvements and removing unused files
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/app/services/vis/stacked-bar.service.ts
+0
-119
0 additions, 119 deletions
src/app/services/vis/stacked-bar.service.ts
with
0 additions
and
119 deletions
src/app/services/vis/stacked-bar.service.ts
deleted
100644 → 0
+
0
−
119
View file @
f7618233
import
{
Injectable
}
from
'
@angular/core
'
;
import
*
as
d3
from
'
d3
'
;
@
Injectable
({
providedIn
:
'
root
'
,
})
export
class
StackedBarService
{
constructor
()
{}
createChart
(
element
:
any
,
height
:
number
,
width
:
number
,
stackedData
:
any
,
indicators
:
any
)
{
const
margin
=
{
top
:
10
,
right
:
10
,
bottom
:
40
,
left
:
10
};
const
rawData
=
stackedData
.
getAllSingleFeedbacks
();
const
series
=
d3
.
stack
()
.
keys
(
indicators
)(
rawData
)
.
map
((
d
)
=>
(
d
.
forEach
((
v
)
=>
(
v
.
key
=
d
.
key
)),
d
));
const
y
=
d3
.
scaleLinear
()
.
domain
([
0
,
d3
.
max
(
series
,
(
d
)
=>
d3
.
max
(
d
,
(
d
)
=>
d
[
1
]))])
.
rangeRound
([
height
-
margin
.
bottom
,
margin
.
top
]);
const
x
=
d3
.
scaleBand
()
.
domain
(
rawData
.
map
((
d
)
=>
d
.
name
))
.
range
([
margin
.
left
,
width
-
margin
.
right
])
.
padding
(
0.1
);
const
xDomain
=
d3
.
scaleBand
()
.
domain
(
rawData
.
map
((
d
)
=>
d
.
title
))
.
range
([
margin
.
left
,
width
-
margin
.
right
])
.
padding
(
0.1
);
const
xAxis
=
(
g
)
=>
g
.
attr
(
'
transform
'
,
`translate(0,
${
height
-
margin
.
bottom
}
)`
)
.
call
(
d3
.
axisBottom
(
x
)
.
tickSizeOuter
(
0
)
.
tickFormat
((
d
)
=>
this
.
getStatus
(
d
,
stackedData
))
)
.
call
((
g
)
=>
g
.
selectAll
(
'
.domain
'
).
remove
());
const
xDomainAxis
=
(
g
)
=>
g
.
attr
(
'
transform
'
,
`translate(0,
${
height
-
margin
.
bottom
/
2
}
)`
)
.
call
(
d3
.
axisBottom
(
xDomain
).
tickSize
(
0
).
tickSizeOuter
(
0
))
.
call
((
g
)
=>
g
.
selectAll
(
'
.domain
'
).
remove
());
const
color
=
d3
.
scaleOrdinal
()
.
domain
(
series
.
map
((
d
)
=>
d
.
key
))
.
range
(
d3
.
schemeBlues
[
d3
.
max
([
3
,
series
.
length
])])
.
unknown
(
'
#ccc
'
);
const
svg
=
d3
.
select
(
element
)
.
append
(
'
svg
'
)
.
attr
(
'
viewBox
'
,
[
0
,
0
,
width
,
height
])
.
attr
(
'
width
'
,
width
)
.
attr
(
'
height
'
,
height
);
svg
.
append
(
'
g
'
)
.
selectAll
(
'
g
'
)
.
data
(
series
)
.
join
(
'
g
'
)
.
attr
(
'
fill
'
,
(
d
)
=>
color
(
d
.
key
))
.
selectAll
(
'
rect
'
)
.
data
((
d
)
=>
d
)
.
join
(
'
rect
'
)
.
attr
(
'
x
'
,
(
d
,
i
)
=>
x
(
d
.
data
.
name
))
.
attr
(
'
y
'
,
(
d
)
=>
y
(
d
[
1
]))
.
attr
(
'
height
'
,
(
d
)
=>
y
(
d
[
0
])
-
y
(
d
[
1
]))
.
attr
(
'
width
'
,
x
.
bandwidth
())
.
append
(
'
title
'
)
.
text
(
(
d
)
=>
`
${
d
.
data
.
name
}
${
d
.
key
}
${
d
.
data
[
d
.
key
]}
`
);
svg
.
append
(
'
g
'
).
call
(
xAxis
);
svg
.
append
(
'
g
'
).
call
(
xDomainAxis
);
svg
.
selectAll
(
'
.tick text
'
).
call
(
this
.
wrap
,
xDomain
.
bandwidth
());
}
// copied from https://observablehq.com/@dagonar/text-wrap-axis
wrap
(
text
,
wrapWidth
,
yAxisAdjustment
=
0
)
{
text
.
each
(
function
()
{
const
text
=
d3
.
select
(
this
);
const
words
=
text
.
text
().
split
(
/
\s
+/
).
reverse
();
let
word
;
let
line
=
[];
let
lineNumber
=
0
;
const
lineHeight
=
1.1
;
// ems
const
y
=
text
.
attr
(
'
y
'
);
const
dy
=
parseFloat
(
text
.
attr
(
'
dy
'
))
-
yAxisAdjustment
;
let
tspan
=
text
.
text
(
null
).
append
(
'
tspan
'
).
attr
(
'
x
'
,
0
).
attr
(
'
y
'
,
y
).
attr
(
'
dy
'
,
`
${
dy
}
em`
);
while
((
word
=
words
.
pop
()))
{
line
.
push
(
word
);
tspan
.
text
(
line
.
join
(
'
'
));
if
(
tspan
.
node
().
getComputedTextLength
()
>
wrapWidth
)
{
line
.
pop
();
tspan
.
text
(
line
.
join
(
'
'
));
line
=
[
word
];
tspan
=
text
.
append
(
'
tspan
'
)
.
attr
(
'
x
'
,
0
)
.
attr
(
'
y
'
,
y
)
.
attr
(
'
dy
'
,
++
lineNumber
*
lineHeight
+
dy
+
'
em
'
)
.
text
(
word
);
}
}
});
return
0
;
}
private
getStatus
(
name
:
string
,
data
:
any
)
{
const
foundDO
:
any
=
data
.
getSingleFeedbackByName
(
name
);
return
foundDO
.
status
;
}
}
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