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
f4a48eb8
Commit
f4a48eb8
authored
Mar 15, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix data.selection.multiple - #66
parent
fd96a8e1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
17 deletions
+22
-17
c3.js
c3.js
+18
-15
selection_line.html
htdocs/samples/selection_line.html
+4
-2
No files found.
c3.js
View file @
f4a48eb8
...
...
@@ -66,7 +66,7 @@
__data_selection_enabled
=
getConfig
([
'data'
,
'selection'
,
'enabled'
],
false
),
__data_selection_grouped
=
getConfig
([
'data'
,
'selection'
,
'grouped'
],
false
),
__data_selection_isselectable
=
getConfig
([
'data'
,
'selection'
,
'isselectable'
],
function
()
{
return
true
;
}),
__data_selection_multi
selected
=
getConfig
([
'data'
,
'selection'
,
'multiselected
'
],
true
);
__data_selection_multi
ple
=
getConfig
([
'data'
,
'selection'
,
'multiple
'
],
true
);
// subchart
...
...
@@ -1461,7 +1461,7 @@
.
remove
();
}
function
togglePoint
(
selected
,
target
,
d
,
i
)
{
(
selected
)
?
selectPoint
(
target
,
d
,
i
)
:
unselectPoint
(
target
,
d
,
i
);
selected
?
selectPoint
(
target
,
d
,
i
)
:
unselectPoint
(
target
,
d
,
i
);
}
function
selectBar
()
{
...
...
@@ -1469,7 +1469,7 @@
function
unselectBar
()
{
}
function
toggleBar
(
selected
,
target
,
d
,
i
)
{
(
selected
)
?
selectBar
(
target
,
d
,
i
)
:
unselectBar
(
target
,
d
,
i
);
selected
?
selectBar
(
target
,
d
,
i
)
:
unselectBar
(
target
,
d
,
i
);
}
function
filterRemoveNull
(
data
)
{
...
...
@@ -2179,13 +2179,12 @@
}
if
(
__data_selection_grouped
||
isWithin
)
{
if
(
__data_selection_enabled
&&
__data_selection_isselectable
(
d
))
{
if
(
!
__data_selection_multiselected
)
{
main
.
selectAll
(
target
.
nodeName
).
each
(
function
(
d
,
i
)
{
toggle
(
false
,
this
,
d
,
i
);
});
if
(
__data_selection_multiple
)
{
_this
.
classed
(
SELECTED
,
!
isSelected
);
toggle
(
!
isSelected
,
_this
,
d
,
i
);
}
else
{
c3
.
select
([
d
.
id
],
[
i
],
true
);
}
_this
.
classed
(
SELECTED
,
!
isSelected
);
toggle
(
!
isSelected
,
_this
,
d
,
i
);
}
__point_onclick
(
d
,
_this
);
// TODO: should be __data_onclick
}
...
...
@@ -3182,9 +3181,11 @@
if
(
!
__data_selection_enabled
)
{
return
;
}
main
.
selectAll
(
'.-shapes'
).
selectAll
(
'.-shape'
).
each
(
function
(
d
,
i
)
{
var
selectShape
=
(
this
.
nodeName
===
'circle'
)
?
selectPoint
:
selectBar
,
unselectShape
=
(
this
.
nodeName
===
'circle'
)
?
unselectPoint
:
unselectBar
;
if
(
indices
.
indexOf
(
i
)
>=
0
)
{
if
(
__data_selection_isselectable
(
d
)
&&
(
__data_selection_grouped
||
isUndefined
(
ids
)
||
ids
.
indexOf
(
d
.
id
)
>=
0
))
{
unselectShape
=
(
this
.
nodeName
===
'circle'
)
?
unselectPoint
:
unselectBar
,
isTargetId
=
__data_selection_grouped
||
!
ids
||
ids
.
indexOf
(
d
.
id
)
>=
0
,
isTargetIndex
=
!
indices
||
indices
.
indexOf
(
i
)
>=
0
;
if
(
isTargetId
&&
isTargetIndex
)
{
if
(
__data_selection_isselectable
(
d
))
{
selectShape
(
d3
.
select
(
this
).
classed
(
SELECTED
,
true
),
d
,
i
);
}
}
else
if
(
isDefined
(
resetOther
)
&&
resetOther
)
{
...
...
@@ -3196,9 +3197,11 @@
c3
.
unselect
=
function
(
ids
,
indices
)
{
if
(
!
__data_selection_enabled
)
{
return
;
}
main
.
selectAll
(
'.-shapes'
).
selectAll
(
'.-shape'
).
each
(
function
(
d
,
i
)
{
var
unselectShape
=
(
this
.
nodeName
===
'circle'
)
?
unselectPoint
:
unselectBar
;
if
(
isUndefined
(
indices
)
||
indices
.
indexOf
(
i
)
>=
0
)
{
if
(
__data_selection_isselectable
(
d
)
&&
(
__data_selection_grouped
||
isUndefined
(
ids
)
||
ids
.
indexOf
(
d
.
id
)
>=
0
))
{
var
unselectShape
=
(
this
.
nodeName
===
'circle'
)
?
unselectPoint
:
unselectBar
,
isTargetId
=
__data_selection_grouped
||
!
ids
||
ids
.
indexOf
(
d
.
id
)
>=
0
,
isTargetIndex
=
!
indices
||
indices
.
indexOf
(
i
)
>=
0
;
if
(
isTargetId
&&
isTargetIndex
)
{
if
(
__data_selection_isselectable
(
d
))
{
unselectShape
(
d3
.
select
(
this
).
classed
(
SELECTED
,
false
),
d
,
i
);
}
}
...
...
htdocs/samples/selection_line.html
View file @
f4a48eb8
...
...
@@ -12,12 +12,14 @@
bindto
:
'#chart'
,
data
:
{
columns
:
[
[
'sample'
,
30
,
200
,
100
,
400
,
150
,
250
]
[
'sample1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'sample2'
,
130
,
300
,
200
,
500
,
250
,
350
],
[
'sample3'
,
230
,
400
,
300
,
600
,
350
,
450
]
],
selection
:
{
enabled
:
true
,
grouped
:
true
,
multi
selected
:
false
multi
ple
:
false
}
}
});
...
...
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