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
aa9069dc
Commit
aa9069dc
authored
Apr 08, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gray out legend when hidden - #128
parent
f0a80a45
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
4 deletions
+18
-4
c3.js
c3.js
+18
-4
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
aa9069dc
...
...
@@ -60,6 +60,7 @@
legendItem
:
'c3-legend-item'
,
legendItemEvent
:
'c3-legend-item-event'
,
legendItemTile
:
'c3-legend-item-tile'
,
legendItemHidden
:
'c3-legend-item-hidden'
,
dragarea
:
'c3-dragarea'
,
EXPANDED
:
'_expanded_'
,
SELECTED
:
'_selected_'
,
...
...
@@ -3669,12 +3670,15 @@
/*-- Draw Legend --*/
function
opacityForLegend
(
id
)
{
return
d3
.
select
(
selectorLegend
(
id
)).
classed
(
CLASS
.
legendItemHidden
)
?
0.5
:
1
;
}
function
toggleFocusLegend
(
id
,
focus
)
{
var
legendItem
=
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
),
isTarget
=
function
(
d
)
{
return
(
!
id
||
d
===
id
);
},
notTarget
=
function
(
d
)
{
return
!
isTarget
(
d
);
};
legendItem
.
filter
(
notTarget
).
transition
().
duration
(
100
).
style
(
'opacity'
,
focus
?
0.3
:
1
);
legendItem
.
filter
(
isTarget
).
transition
().
duration
(
100
).
style
(
'opacity'
,
focus
?
1
:
0.3
);
legendItem
.
filter
(
notTarget
).
transition
().
duration
(
100
).
style
(
'opacity'
,
focus
?
0.3
:
opacityForLegend
);
legendItem
.
filter
(
isTarget
).
transition
().
duration
(
100
).
style
(
'opacity'
,
focus
?
opacityForLegend
:
0.3
);
}
function
focusLegend
(
id
)
{
toggleFocusLegend
(
id
,
true
);
...
...
@@ -3685,14 +3689,14 @@
function
revertLegend
()
{
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
)
.
transition
().
duration
(
100
)
.
style
(
'opacity'
,
1
);
.
style
(
'opacity'
,
opacityForLegend
);
}
function
showLegend
(
targetIds
)
{
removeHiddenLegendIds
(
targetIds
);
legend
.
selectAll
(
selectorLegends
(
targetIds
))
.
style
(
'visibility'
,
'visible'
)
.
transition
()
.
style
(
'opacity'
,
1
);
.
style
(
'opacity'
,
opacityForLegend
);
updateLegend
(
mapToIds
(
c3
.
data
.
targets
));
}
function
hideLegend
(
targetIds
)
{
...
...
@@ -3936,6 +3940,11 @@
if
(
options
.
withLegend
)
{
showLegend
(
targetIds
);
}
else
{
legend
.
selectAll
(
selectorLegends
(
targetIds
))
.
classed
(
CLASS
.
legendItemHidden
,
false
)
.
transition
()
.
style
(
'opacity'
,
1
);
}
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withTransitionForHorizontalAxis
:
false
});
...
...
@@ -3952,6 +3961,11 @@
if
(
options
.
withLegend
)
{
hideLegend
(
targetIds
);
}
else
{
legend
.
selectAll
(
selectorLegends
(
targetIds
))
.
classed
(
CLASS
.
legendItemHidden
,
true
)
.
transition
()
.
style
(
'opacity'
,
0.5
);
}
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withTransitionForHorizontalAxis
:
false
});
...
...
c3.min.js
View file @
aa9069dc
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