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
38fbd9e2
Commit
38fbd9e2
authored
Mar 20, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bar selection - #66
parent
a2940b2e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
20 deletions
+11
-20
c3.css
c3.css
+1
-11
c3.js
c3.js
+10
-9
c3.min.js
c3.min.js
+0
-0
No files found.
c3.css
View file @
38fbd9e2
...
...
@@ -61,17 +61,7 @@ text {
/*-- Bar --*/
.-bar._expanded_
{
stroke-width
:
1px
;
fill-opacity
:
0.6
;
}
/* TODO: use this*/
.-bar._selected_
{
stroke-width
:
1px
;
fill-opacity
:
0.3
;
}
.selected-bar
{
fill
:
white
;
stroke-width
:
2px
;
fill-opacity
:
0.75
;
}
/*-- Arc --*/
...
...
c3.js
View file @
38fbd9e2
...
...
@@ -1502,8 +1502,8 @@
return
Math
.
sqrt
(
Math
.
pow
(
cx
-
mouse
[
0
],
2
)
+
Math
.
pow
(
cy
-
mouse
[
1
],
2
))
<
_r
;
}
function
isWithinBar
(
_this
)
{
var
mouse
=
d3
.
mouse
(
_this
),
d3_this
=
d3
.
select
(
_this
);
var
x
=
d3_this
.
attr
(
"x"
)
*
1
,
y
=
d3_this
.
attr
(
"y"
)
*
1
,
w
=
d3_this
.
attr
(
"width"
)
*
1
;
var
mouse
=
d3
.
mouse
(
_this
),
box
=
_this
.
getBBox
(
);
var
x
=
box
.
x
,
y
=
box
.
y
,
w
=
box
.
width
;
var
sx
=
x
-
10
,
ex
=
x
+
w
+
10
,
ey
=
y
-
10
;
return
sx
<
mouse
[
0
]
&&
mouse
[
0
]
<
ex
&&
ey
<
mouse
[
1
];
}
...
...
@@ -1554,9 +1554,11 @@
selected
?
selectPoint
(
target
,
d
,
i
)
:
unselectPoint
(
target
,
d
,
i
);
}
function
selectBar
()
{
function
selectBar
(
target
,
d
)
{
target
.
transition
().
duration
(
100
).
style
(
"fill"
,
function
()
{
return
d3
.
rgb
(
color
(
d
.
id
)).
darker
(
1
);
});
}
function
unselectBar
()
{
function
unselectBar
(
target
,
d
)
{
target
.
transition
().
duration
(
100
).
style
(
"fill"
,
function
()
{
return
color
(
d
.
id
);
});
}
function
toggleBar
(
selected
,
target
,
d
,
i
)
{
selected
?
selectBar
(
target
,
d
,
i
)
:
unselectBar
(
target
,
d
,
i
);
...
...
@@ -1586,7 +1588,7 @@
return
main
.
selectAll
(
".-bar"
+
(
isValue
(
i
)
?
'-'
+
i
:
''
));
}
function
expandBars
(
i
)
{
getBars
(
i
).
classed
(
EXPANDED
,
fals
e
);
getBars
(
i
).
classed
(
EXPANDED
,
tru
e
);
}
function
unexpandBars
(
i
)
{
getBars
(
i
).
classed
(
EXPANDED
,
false
);
...
...
@@ -2168,12 +2170,11 @@
svg
.
select
(
'.event-rect-'
+
i
).
style
(
'cursor'
,
null
);
})
.
filter
(
function
()
{
var
_this
=
d3
.
select
(
this
);
if
(
this
.
nodeName
===
'circle'
)
{
return
isWithinCircle
(
this
,
__point_select_r
);
}
else
if
(
this
.
nodeName
===
'
rect
'
)
{
return
isWithinBar
(
this
,
_this
.
attr
(
'x'
),
_this
.
attr
(
'y'
)
);
else
if
(
this
.
nodeName
===
'
path
'
)
{
return
isWithinBar
(
this
);
}
})
.
each
(
function
()
{
...
...
@@ -2276,7 +2277,7 @@
isWithin
=
isWithinCircle
(
target
,
__point_select_r
*
1.5
);
toggle
=
togglePoint
;
}
else
if
(
target
.
nodeName
===
'
rect
'
)
{
else
if
(
target
.
nodeName
===
'
path
'
)
{
isWithin
=
isWithinBar
(
target
);
toggle
=
toggleBar
;
}
...
...
c3.min.js
View file @
38fbd9e2
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