Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
c3-closed
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
charts
c3-closed
Commits
61aea727
Commit
61aea727
authored
Jan 28, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'tooltip' of
https://github.com/yojeek/c3
into yojeek-tooltip
parents
a7e485a0
135ee5aa
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
c3.js
c3.js
+26
-11
No files found.
c3.js
View file @
61aea727
...
@@ -985,9 +985,8 @@
...
@@ -985,9 +985,8 @@
.
style
(
"position"
,
"relative"
)
.
style
(
"position"
,
"relative"
)
.
append
(
"div"
)
.
append
(
"div"
)
.
style
(
"position"
,
"absolute"
)
.
style
(
"position"
,
"absolute"
)
.
style
(
"width"
,
"30%"
)
// TODO: cul actual width when show
.
style
(
"z-index"
,
"10"
)
.
style
(
"z-index"
,
"10"
)
.
style
(
"
visibility"
,
"hidden
"
);
.
style
(
"
display"
,
"none
"
);
/*-- Main Region --*/
/*-- Main Region --*/
...
@@ -1129,16 +1128,10 @@
...
@@ -1129,16 +1128,10 @@
.
data
([
selectedData
[
0
]])
.
data
([
selectedData
[
0
]])
.
attr
(
__axis_rotated
?
'y1'
:
'x1'
,
xx
)
.
attr
(
__axis_rotated
?
'y1'
:
'x1'
,
xx
)
.
attr
(
__axis_rotated
?
'y2'
:
'x2'
,
xx
);
.
attr
(
__axis_rotated
?
'y2'
:
'x2'
,
xx
);
// Set tooltip
tooltip
.
style
(
"top"
,
(
d3
.
mouse
(
this
)[
1
]
+
30
)
+
"px"
)
.
style
(
"left"
,
((
__axis_rotated
?
d3
.
mouse
(
this
)[
0
]
:
x
(
selectedData
[
0
].
x
))
+
60
)
+
"px"
);
tooltip
.
html
(
__tooltip_contents
(
selectedData
));
tooltip
.
style
(
"visibility"
,
"visible"
);
})
})
.
on
(
'mouseout'
,
function
(
d
,
i
)
{
.
on
(
'mouseout'
,
function
(
d
,
i
)
{
main
.
select
(
'line.xgrid-focus'
).
style
(
"visibility"
,
"hidden"
);
main
.
select
(
'line.xgrid-focus'
).
style
(
"visibility"
,
"hidden"
);
tooltip
.
style
(
"
visibility"
,
"hidden
"
);
tooltip
.
style
(
"
display"
,
"none
"
);
// Undo expanded circles
// Undo expanded circles
main
.
selectAll
(
'.-circle-'
+
i
)
main
.
selectAll
(
'.-circle-'
+
i
)
.
filter
(
function
()
{
return
d3
.
select
(
this
).
classed
(
EXPANDED
);
})
.
filter
(
function
()
{
return
d3
.
select
(
this
).
classed
(
EXPANDED
);
})
...
@@ -1149,6 +1142,28 @@
...
@@ -1149,6 +1142,28 @@
.
classed
(
EXPANDED
,
false
);
.
classed
(
EXPANDED
,
false
);
})
})
.
on
(
'mousemove'
,
function
(
d
,
i
)
{
.
on
(
'mousemove'
,
function
(
d
,
i
)
{
var
selectedData
=
c3
.
data
.
targets
.
map
(
function
(
d
)
{
return
addName
(
d
.
values
[
i
]);
});
// Construct tooltip
tooltip
.
html
(
__tooltip_contents
(
selectedData
))
.
style
(
"visibility"
,
"hidden"
)
.
style
(
"display"
,
"block"
);
// Get tooltip dimensions
var
tWidth
=
tooltip
.
property
(
'offsetWidth'
),
tHeight
=
tooltip
.
property
(
'offsetHeight'
);
// Set tooltip
// todo get rid of magic numbers
tooltip
.
style
(
"top"
,
(
d3
.
mouse
(
this
)[
1
]
+
15
+
tHeight
<
getCurrentHeight
()
?
d3
.
mouse
(
this
)[
1
]
+
15
:
d3
.
mouse
(
this
)[
1
]
-
tHeight
)
+
"px"
)
.
style
(
"left"
,
((
__axis_rotated
?
d3
.
mouse
(
this
)[
0
]
:
(
x
(
selectedData
[
0
].
x
)
+
60
+
tWidth
<
getCurrentWidth
())
?
(
x
(
selectedData
[
0
].
x
)
+
60
)
+
"px"
:
(
x
(
selectedData
[
0
].
x
)
-
tWidth
+
30
)
+
"px"
)))
.
style
(
"visibility"
,
"visible"
);
if
(
!
__data_selection_enabled
||
dragging
)
{
return
;
}
if
(
!
__data_selection_enabled
||
dragging
)
{
return
;
}
if
(
__data_selection_grouped
)
{
return
;
}
// nothing to do when grouped
if
(
__data_selection_grouped
)
{
return
;
}
// nothing to do when grouped
...
@@ -1352,7 +1367,7 @@
...
@@ -1352,7 +1367,7 @@
})));
})));
tooltip
.
style
(
"top"
,
__tooltip_init_position
.
top
)
tooltip
.
style
(
"top"
,
__tooltip_init_position
.
top
)
.
style
(
"left"
,
__tooltip_init_position
.
left
)
.
style
(
"left"
,
__tooltip_init_position
.
left
)
.
style
(
"
visibility"
,
"visible
"
);
.
style
(
"
display"
,
"block
"
);
}
}
// Bind resize event
// Bind resize event
...
@@ -1398,7 +1413,7 @@
...
@@ -1398,7 +1413,7 @@
subY2
.
domain
(
y2
.
domain
());
subY2
.
domain
(
y2
.
domain
());
// tooltip
// tooltip
tooltip
.
style
(
"
visibility"
,
"hidden
"
);
tooltip
.
style
(
"
display"
,
"none
"
);
// grid
// grid
main
.
select
(
'line.xgrid-focus'
)
main
.
select
(
'line.xgrid-focus'
)
...
...
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