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
9beb0d4a
Commit
9beb0d4a
authored
Apr 05, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix same x on multiple xs - #125
parent
51f2776a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
3 deletions
+11
-3
c3.js
c3.js
+11
-3
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
9beb0d4a
...
@@ -1677,6 +1677,9 @@
...
@@ -1677,6 +1677,9 @@
});
});
return
closest
;
return
closest
;
}
}
function
filterSameX
(
targets
,
x
)
{
return
d3
.
merge
(
targets
.
map
(
function
(
t
)
{
return
t
.
values
;
})).
filter
(
function
(
v
)
{
return
v
.
x
===
x
;
});
}
function
getPathBox
(
path
)
{
function
getPathBox
(
path
)
{
var
box
=
path
.
getBoundingClientRect
(),
var
box
=
path
.
getBoundingClientRect
(),
...
@@ -1981,7 +1984,8 @@
...
@@ -1981,7 +1984,8 @@
}
}
function
dist
(
data
,
pos
)
{
function
dist
(
data
,
pos
)
{
return
Math
.
pow
(
x
(
data
.
x
)
-
pos
[
0
],
2
)
+
Math
.
pow
(
y
(
data
.
value
)
-
pos
[
1
],
2
);
var
yScale
=
getAxisId
(
data
.
id
)
===
'y'
?
y
:
y2
;
return
Math
.
pow
(
x
(
data
.
x
)
-
pos
[
0
],
2
)
+
Math
.
pow
(
yScale
(
data
.
value
)
-
pos
[
1
],
2
);
}
}
function
endall
(
transition
,
callback
)
{
function
endall
(
transition
,
callback
)
{
...
@@ -2695,7 +2699,7 @@
...
@@ -2695,7 +2699,7 @@
unexpandCircles
();
unexpandCircles
();
})
})
.
on
(
'mousemove'
,
function
()
{
.
on
(
'mousemove'
,
function
()
{
var
mouse
,
closest
,
selectedData
;
var
mouse
,
closest
,
s
ameXData
,
s
electedData
;
if
(
dragging
)
{
return
;
}
// do nothing when dragging
if
(
dragging
)
{
return
;
}
// do nothing when dragging
if
(
hasArcType
(
c3
.
data
.
targets
))
{
return
;
}
if
(
hasArcType
(
c3
.
data
.
targets
))
{
return
;
}
...
@@ -2703,8 +2707,12 @@
...
@@ -2703,8 +2707,12 @@
mouse
=
d3
.
mouse
(
this
);
mouse
=
d3
.
mouse
(
this
);
closest
=
findClosestFromTargets
(
c3
.
data
.
targets
,
mouse
);
closest
=
findClosestFromTargets
(
c3
.
data
.
targets
,
mouse
);
sameXData
=
filterSameX
(
c3
.
data
.
targets
,
closest
.
x
);
// show tooltip when cursor is close to some point
// show tooltip when cursor is close to some point
selectedData
=
[
addName
(
closest
)];
selectedData
=
sameXData
.
map
(
function
(
d
)
{
return
addName
(
d
);
});
showTooltip
(
selectedData
,
mouse
);
showTooltip
(
selectedData
,
mouse
);
// expand points
// expand points
...
...
c3.min.js
View file @
9beb0d4a
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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