Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Remi PLANEL
bioviz-js
Commits
c036a3f0
Commit
c036a3f0
authored
Apr 10, 2019
by
Remi PLANEL
Browse files
Rename genome-axis-with-selection.ts to brushable-genome-axis.ts
parent
cca73be6
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/scripts/component/sequence/genome-axis
-with-selection
.ts
→
src/scripts/component/sequence/
brushable-
genome-axis.ts
View file @
c036a3f0
import
{
Global
AxisData
,
GenericAxisData
}
from
"
../../types
"
;
import
{
Brushable
AxisData
,
GenericAxisData
}
from
"
../../types
"
;
import
{
select
,
Selection
}
from
"
d3-selection
"
;
import
{
scaleLinear
}
from
"
d3-scale
"
;
import
GenomeAxis
from
"
./genome-axis
"
;
import
{
brushX
,
BrushBehavior
}
from
"
d3-brush
"
;
export
default
function
()
{
const
G
enomeAxisComponent
=
GenomeAxis
();
const
g
enomeAxisComponent
=
GenomeAxis
();
function
globalGenomeAxis
(
_selection
:
Selection
<
SVGElement
,
Global
AxisData
,
SVGElement
,
any
>
,
_selection
:
Selection
<
SVGElement
,
Brushable
AxisData
,
SVGElement
,
any
>
,
width
:
number
,
yPosition
:
number
)
{
...
...
@@ -16,10 +17,18 @@ export default function () {
.
domain
(
_data
.
interval
)
.
range
([
0
,
width
]);
const
brush
:
BrushBehavior
<
any
>
=
brushX
()
.
extent
([[
0
,
0
],
[
width
,
50
]])
.
on
(
"
brush
"
,
()
=>
{
if
(
_data
.
eventHandler
)
{
_data
.
eventHandler
.
brushed
(
genomeAxisComponent
.
scale
())
}
});
const
container
=
select
(
this
)
.
attr
(
"
transform
"
,
"
translate(0,
"
+
yPosition
+
"
)
"
);
const
globalAxis
=
container
.
selectAll
<
SVGElement
,
Global
AxisData
>
(
"
g.global-axis-container
"
)
.
selectAll
<
SVGElement
,
Brushable
AxisData
>
(
"
g.global-axis-container
"
)
.
data
([
_data
]);
const
globalAxisEnter
=
globalAxis
...
...
@@ -27,32 +36,29 @@ export default function () {
.
append
<
SVGElement
>
(
"
g
"
)
.
classed
(
"
global-axis-container
"
,
true
);
globalAxisEnter
.
append
(
"
g
"
)
.
classed
(
"
generic-axis
"
,
true
);
globalAxisEnter
.
append
(
"
rect
"
)
.
classed
(
"
gen
ome
-axis
-window
"
,
true
);
globalAxisEnter
.
append
(
"
g
"
)
.
classed
(
"
gen
eric
-axis
"
,
true
);
globalAxisEnter
.
append
(
"
g
"
)
.
attr
(
"
transform
"
,
"
translate(0,25)
"
)
.
classed
(
"
brush-selection
"
,
true
);
globalAxis
.
exit
().
remove
();
const
globalAxisUpdate
=
globalAxis
.
merge
(
globalAxisEnter
);
globalAxisUpdate
.
select
(
"
rect
"
)
.
attr
(
"
transform
"
,
function
(
d
:
GlobalAxisData
)
{
const
x
=
xScale
(
d
.
window
[
0
])
return
"
translate(
"
+
x
+
"
, 25)
"
;
})
.
attr
(
"
width
"
,
function
(
d
)
{
return
xScale
(
d
.
window
[
1
]
-
d
.
window
[
0
]);
})
.
attr
(
"
height
"
,
50
);
globalAxisUpdate
.
select
<
any
>
(
"
g.brush-selection
"
)
.
call
(
brush
)
.
call
(
brush
.
move
,
[
xScale
(
_data
.
window
[
0
]),
xScale
(
_data
.
window
[
1
])]);
globalAxisUpdate
.
select
<
SVGElement
>
(
"
g.generic-axis
"
)
.
datum
((
d
:
Global
AxisData
):
GenericAxisData
=>
({
title
:
d
.
title
,
interval
:
[
d
.
interval
[
0
],
d
.
interval
[
1
]]
}))
.
call
(
G
enomeAxisComponent
,
width
,
yPosition
);
.
datum
((
d
:
Brushable
AxisData
):
GenericAxisData
=>
({
title
:
d
.
title
,
interval
:
[
d
.
interval
[
0
],
d
.
interval
[
1
]]
}))
.
call
(
g
enomeAxisComponent
,
width
,
yPosition
);
});
}
return
globalGenomeAxis
;
});
}
return
globalGenomeAxis
;
}
\ No newline at end of file
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