Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Fractalis
fractal.js
Commits
1cb5243d
Commit
1cb5243d
authored
Apr 24, 2017
by
Sascha Herzinger
Browse files
Fixed issues related to histogram creation and animation
parent
7d31a186
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/components/charts/CorrelationAnalysis.vue
View file @
1cb5243d
...
...
@@ -322,13 +322,15 @@
return
{
xBins
,
yBins
}
},
histogramScales
()
{
const
xExtent
=
d3
.
extent
(
this
.
histograms
.
xBins
.
map
(
d
=>
d
.
length
))
const
yExtent
=
d3
.
extent
(
this
.
histograms
.
yBins
.
map
(
d
=>
d
.
length
))
// no, I didn't mix up xBins and yBins.
const
x
=
d3
.
scaleLinear
()
.
domain
(
d3
.
e
xtent
(
this
.
histograms
.
yBins
.
map
(
d
=>
d
.
length
))
)
.
range
([
0
,
this
.
margin
.
left
])
.
domain
(
yE
xtent
)
.
range
([
yExtent
[
0
]
?
10
:
0
,
this
.
margin
.
left
])
const
y
=
d3
.
scaleLinear
()
.
domain
(
d3
.
extent
(
this
.
histograms
.
xBins
.
map
(
d
=>
d
.
length
))
)
.
range
([
0
,
this
.
margin
.
bottom
])
.
domain
(
xExtent
)
.
range
([
xExtent
[
0
]
?
10
:
0
,
this
.
margin
.
bottom
])
return
{
x
,
y
}
},
histogramAttr
()
{
...
...
@@ -376,23 +378,26 @@
},
'
histogramAttr
'
:
{
handler
:
function
(
newHistogramAttr
,
oldHistogramAttr
)
{
// this is a bit like fibonacci. We need a previous value to start with initially
if
(
!
oldHistogramAttr
.
xAttr
.
length
||
!
oldHistogramAttr
.
yAttr
.
length
)
{
this
.
tweened
.
histogramAttr
=
newHistogramAttr
return
let
i
=
Math
.
max
.
apply
(
null
,
[
newHistogramAttr
.
xAttr
.
length
,
oldHistogramAttr
.
xAttr
.
length
])
let
j
=
Math
.
max
.
apply
(
null
,
[
newHistogramAttr
.
yAttr
.
length
,
oldHistogramAttr
.
yAttr
.
length
])
while
(
i
--
)
{
const
ii
=
i
const
xAttr
=
oldHistogramAttr
.
xAttr
[
i
]
?
oldHistogramAttr
.
xAttr
[
i
]
:
{
x
:
this
.
padded
.
width
/
2
,
y
:
this
.
padded
.
height
,
width
:
0
,
height
:
0
}
const
xAttr_target
=
newHistogramAttr
.
xAttr
[
i
]
?
newHistogramAttr
.
xAttr
[
i
]
:
{
width
:
0
}
xAttr_target
.
onUpdate
=
()
=>
{
this
.
tweened
.
histogramAttr
.
xAttr
[
ii
]
=
xAttr
}
TweenLite
.
to
(
xAttr
,
0.5
,
xAttr_target
)
}
while
(
j
--
)
{
const
jj
=
j
const
yAttr
=
oldHistogramAttr
.
yAttr
[
j
]
?
oldHistogramAttr
.
yAttr
[
j
]
:
{
x
:
0
,
y
:
this
.
padded
.
height
/
2
,
width
:
0
,
height
:
0
}
const
yAttr_target
=
newHistogramAttr
.
yAttr
[
j
]
?
newHistogramAttr
.
yAttr
[
j
]
:
{
height
:
0
}
yAttr_target
.
onUpdate
=
()
=>
{
this
.
tweened
.
histogramAttr
.
yAttr
[
jj
]
=
yAttr
}
TweenLite
.
to
(
yAttr
,
0.5
,
yAttr_target
)
}
oldHistogramAttr
.
xAttr
.
forEach
((
d
,
i
)
=>
{
const
attr
=
oldHistogramAttr
.
xAttr
[
i
]
const
targetAttr
=
newHistogramAttr
.
xAttr
[
i
]
targetAttr
.
onUpdate
=
()
=>
{
this
.
tweened
.
histogramAttr
.
xAttr
[
i
]
=
attr
}
TweenLite
.
to
(
attr
,
0.5
,
targetAttr
)
})
oldHistogramAttr
.
yAttr
.
forEach
((
d
,
i
)
=>
{
const
attr
=
oldHistogramAttr
.
yAttr
[
i
]
const
targetAttr
=
newHistogramAttr
.
yAttr
[
i
]
targetAttr
.
onUpdate
=
()
=>
{
this
.
tweened
.
histogramAttr
.
yAttr
[
i
]
=
attr
}
TweenLite
.
to
(
attr
,
0.5
,
targetAttr
)
})
}
}
},
...
...
Write
Preview
Supports
Markdown
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!
Cancel
Please
register
or
sign in
to comment