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
Evgeny
c3-closed
Commits
6097e108
Commit
6097e108
authored
Feb 17, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tooltip position when size and padding specified - #27
parent
60a43789
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
7 deletions
+18
-7
c3.js
c3.js
+18
-7
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
6097e108
...
...
@@ -818,22 +818,33 @@
//-- Tooltip --//
function
showTooltip
(
selectedData
,
mouse
)
{
var
tWidth
,
tHeight
;
var
svgLeft
,
tooltipLeft
,
tooltipRight
,
tooltipTop
,
chartRight
;
// Construct tooltip
tooltip
.
html
(
__tooltip_contents
(
selectedData
))
.
style
(
"visibility"
,
"hidden"
)
.
style
(
"display"
,
"block"
);
// Get tooltip dimensions
var
tWidth
=
tooltip
.
property
(
'offsetWidth'
),
tWidth
=
tooltip
.
property
(
'offsetWidth'
);
tHeight
=
tooltip
.
property
(
'offsetHeight'
);
// Determin tooltip position
if
(
__axis_rotated
)
{
tooltipLeft
=
mouse
[
0
];
}
else
{
svgLeft
=
svg
.
property
(
'offsetLeft'
);
tooltipLeft
=
svgLeft
+
getCurrentPaddingLeft
()
+
x
(
selectedData
[
0
].
x
)
+
20
;
tooltipRight
=
tooltipLeft
+
tWidth
;
chartRight
=
svgLeft
+
getCurrentWidth
()
-
getCurrentPaddingRight
();
if
(
tooltipRight
>
chartRight
)
{
tooltipLeft
-=
tWidth
+
30
;
}
}
tooltipTop
=
mouse
[
1
]
+
15
+
tHeight
<
getCurrentHeight
()
?
mouse
[
1
]
+
15
:
mouse
[
1
]
-
tHeight
;
// Set tooltip
// todo get rid of magic numbers
tooltip
.
style
(
"top"
,
(
mouse
[
1
]
+
15
+
tHeight
<
getCurrentHeight
()
?
mouse
[
1
]
+
15
:
mouse
[
1
]
-
tHeight
)
+
"px"
)
.
style
(
"left"
,
((
__axis_rotated
?
mouse
[
0
]
:
(
x
(
selectedData
[
0
].
x
)
+
60
+
tWidth
<
getCurrentWidth
())
?
(
x
(
selectedData
[
0
].
x
)
+
60
)
+
"px"
:
(
x
(
selectedData
[
0
].
x
)
-
tWidth
+
30
)
+
"px"
)))
.
style
(
"top"
,
tooltipTop
+
"px"
)
.
style
(
"left"
,
tooltipLeft
+
'px'
)
.
style
(
"visibility"
,
"visible"
);
}
function
hideTooltip
()
{
...
...
c3.min.js
View file @
6097e108
This diff is collapsed.
Click to expand it.
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