Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fractalis
fractal.js
Commits
a82ec2bf
Commit
a82ec2bf
authored
Jul 04, 2017
by
Sascha Herzinger
Browse files
Added some scaling related code
parent
3363a745
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/vue/charts/Boxplot.vue
View file @
a82ec2bf
...
...
@@ -52,6 +52,7 @@
return
{
variables
:
this
.
numData
.
map
(
d
=>
`$
${
d
}
$`
),
categories
:
this
.
catData
.
map
(
d
=>
`$
${
d
}
$`
),
id_filter
:
[],
subsets
:
store
.
getters
.
subsets
}
},
...
...
@@ -70,8 +71,26 @@
const
height
=
this
.
height
-
this
.
margin
.
top
-
this
.
margin
.
bottom
return
{
width
,
height
}
},
numOfBoxplots
()
{
return
Object
.
keys
(
this
.
results
.
statistics
).
length
},
boxplotWidth
()
{
return
this
.
padded
.
width
/
this
.
results
.
numOfBoxplots
-
this
.
results
.
numOfBoxplots
const
maxBoxplotWidth
=
this
.
padded
.
width
/
4
let
boxplotWidth
=
this
.
padded
.
width
/
this
.
numOfBoxplots
-
this
.
padded
.
width
*
0.05
boxplotWidth
=
boxplotWidth
>
maxBoxplotWidth
?
maxBoxplotWidth
:
boxplotWidth
return
boxplotWidth
},
scales
()
{
const
values
=
this
.
results
.
data
.
map
(
entry
=>
this
.
results
.
variables
.
map
(
v
=>
entry
[
v
]))
const
flattened
=
[].
concat
.
apply
([],
values
)
const
extent
=
d3
.
extent
(
flattened
)
const
x
=
d3
.
scaleOrdinal
()
.
domain
(
Object
.
keys
(
this
.
statistics
))
.
range
([
0
,
this
.
padded
.
height
])
const
y
=
d3
.
scaleLinear
()
.
domain
(
extent
)
.
range
([
0
,
this
.
padded
.
width
])
return
{
x
,
y
}
}
},
watch
:
{
...
...
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