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
a82e83dc
Commit
a82e83dc
authored
Jun 06, 2015
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1142 from Bhamni/1141
Patch for #1141
parents
8392dc70
37c6d721
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
14 deletions
+10
-14
c3.js
c3.js
+5
-7
config.js
src/config.js
+1
-0
data.js
src/data.js
+2
-2
interaction.js
src/interaction.js
+2
-5
No files found.
c3.js
View file @
a82e83dc
...
...
@@ -1205,6 +1205,7 @@
// point - point of each data
point_show
:
true
,
point_r
:
2.5
,
point_sensitivity
:
10
,
point_focus_expand_enabled
:
true
,
point_focus_expand_r
:
undefined
,
point_select_r
:
undefined
,
...
...
@@ -1935,7 +1936,7 @@
return
$$
.
findClosest
(
candidates
,
pos
);
};
c3_chart_internal_fn
.
findClosest
=
function
(
values
,
pos
)
{
var
$$
=
this
,
minDist
=
100
,
closest
;
var
$$
=
this
,
minDist
=
$$
.
config
.
point_sensitivity
,
closest
;
// find mouseovering bar
values
.
filter
(
function
(
v
)
{
return
v
&&
$$
.
isBarType
(
v
.
id
);
}).
forEach
(
function
(
v
)
{
...
...
@@ -1962,7 +1963,7 @@
yIndex
=
config
.
axis_rotated
?
0
:
1
,
y
=
$$
.
circleY
(
data
,
data
.
index
),
x
=
$$
.
x
(
data
.
x
);
return
Math
.
pow
(
x
-
pos
[
xIndex
],
2
)
+
Math
.
pow
(
y
-
pos
[
yIndex
],
2
);
return
Math
.
sqrt
(
Math
.
pow
(
x
-
pos
[
xIndex
],
2
)
+
Math
.
pow
(
y
-
pos
[
yIndex
],
2
)
);
};
c3_chart_internal_fn
.
convertValuesToStep
=
function
(
values
)
{
var
converted
=
[].
concat
(
values
),
i
;
...
...
@@ -2579,7 +2580,7 @@
$$
.
showXGridFocus
(
selectedData
);
// Show cursor as pointer if point is close to mouse position
if
(
$$
.
isBarType
(
closest
.
id
)
||
$$
.
dist
(
closest
,
mouse
)
<
100
)
{
if
(
$$
.
isBarType
(
closest
.
id
)
||
$$
.
dist
(
closest
,
mouse
)
<
config
.
point_sensitivity
)
{
$$
.
svg
.
select
(
'.'
+
CLASS
.
eventRect
).
style
(
'cursor'
,
'pointer'
);
if
(
!
$$
.
mouseover
)
{
config
.
data_onmouseover
.
call
(
$$
.
api
,
closest
);
...
...
@@ -2590,16 +2591,13 @@
.
on
(
'click'
,
function
()
{
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
);
var
mouse
,
closest
;
if
(
$$
.
hasArcType
(
targetsToShow
))
{
return
;
}
mouse
=
d3
.
mouse
(
this
);
closest
=
$$
.
findClosestFromTargets
(
targetsToShow
,
mouse
);
if
(
!
closest
)
{
return
;
}
// select if selection enabled
if
(
$$
.
isBarType
(
closest
.
id
)
||
$$
.
dist
(
closest
,
mouse
)
<
100
)
{
if
(
$$
.
isBarType
(
closest
.
id
)
||
$$
.
dist
(
closest
,
mouse
)
<
config
.
point_sensitivity
)
{
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
shapes
+
$$
.
getTargetSelectorSuffix
(
closest
.
id
)).
selectAll
(
'.'
+
CLASS
.
shape
+
'-'
+
closest
.
index
).
each
(
function
()
{
if
(
config
.
data_selection_grouped
||
$$
.
isWithinShape
(
this
,
closest
))
{
$$
.
toggleShape
(
this
,
closest
,
closest
.
index
);
...
...
src/config.js
View file @
a82e83dc
...
...
@@ -151,6 +151,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
// point - point of each data
point_show
:
true
,
point_r
:
2.5
,
point_sensitivity
:
10
,
point_focus_expand_enabled
:
true
,
point_focus_expand_r
:
undefined
,
point_select_r
:
undefined
,
...
...
src/data.js
View file @
a82e83dc
...
...
@@ -305,7 +305,7 @@ c3_chart_internal_fn.findClosestFromTargets = function (targets, pos) {
return
$$
.
findClosest
(
candidates
,
pos
);
};
c3_chart_internal_fn
.
findClosest
=
function
(
values
,
pos
)
{
var
$$
=
this
,
minDist
=
100
,
closest
;
var
$$
=
this
,
minDist
=
$$
.
config
.
point_sensitivity
,
closest
;
// find mouseovering bar
values
.
filter
(
function
(
v
)
{
return
v
&&
$$
.
isBarType
(
v
.
id
);
}).
forEach
(
function
(
v
)
{
...
...
@@ -332,7 +332,7 @@ c3_chart_internal_fn.dist = function (data, pos) {
yIndex
=
config
.
axis_rotated
?
0
:
1
,
y
=
$$
.
circleY
(
data
,
data
.
index
),
x
=
$$
.
x
(
data
.
x
);
return
Math
.
pow
(
x
-
pos
[
xIndex
],
2
)
+
Math
.
pow
(
y
-
pos
[
yIndex
],
2
);
return
Math
.
sqrt
(
Math
.
pow
(
x
-
pos
[
xIndex
],
2
)
+
Math
.
pow
(
y
-
pos
[
yIndex
],
2
)
);
};
c3_chart_internal_fn
.
convertValuesToStep
=
function
(
values
)
{
var
converted
=
[].
concat
(
values
),
i
;
...
...
src/interaction.js
View file @
a82e83dc
...
...
@@ -288,7 +288,7 @@ c3_chart_internal_fn.generateEventRectsForMultipleXs = function (eventRectEnter)
$$
.
showXGridFocus
(
selectedData
);
// Show cursor as pointer if point is close to mouse position
if
(
$$
.
isBarType
(
closest
.
id
)
||
$$
.
dist
(
closest
,
mouse
)
<
100
)
{
if
(
$$
.
isBarType
(
closest
.
id
)
||
$$
.
dist
(
closest
,
mouse
)
<
config
.
point_sensitivity
)
{
$$
.
svg
.
select
(
'.'
+
CLASS
.
eventRect
).
style
(
'cursor'
,
'pointer'
);
if
(
!
$$
.
mouseover
)
{
config
.
data_onmouseover
.
call
(
$$
.
api
,
closest
);
...
...
@@ -299,16 +299,13 @@ c3_chart_internal_fn.generateEventRectsForMultipleXs = function (eventRectEnter)
.
on
(
'click'
,
function
()
{
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
);
var
mouse
,
closest
;
if
(
$$
.
hasArcType
(
targetsToShow
))
{
return
;
}
mouse
=
d3
.
mouse
(
this
);
closest
=
$$
.
findClosestFromTargets
(
targetsToShow
,
mouse
);
if
(
!
closest
)
{
return
;
}
// select if selection enabled
if
(
$$
.
isBarType
(
closest
.
id
)
||
$$
.
dist
(
closest
,
mouse
)
<
100
)
{
if
(
$$
.
isBarType
(
closest
.
id
)
||
$$
.
dist
(
closest
,
mouse
)
<
config
.
point_sensitivity
)
{
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
shapes
+
$$
.
getTargetSelectorSuffix
(
closest
.
id
)).
selectAll
(
'.'
+
CLASS
.
shape
+
'-'
+
closest
.
index
).
each
(
function
()
{
if
(
config
.
data_selection_grouped
||
$$
.
isWithinShape
(
this
,
closest
))
{
$$
.
toggleShape
(
this
,
closest
,
closest
.
index
);
...
...
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