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
740b5581
Commit
740b5581
authored
Apr 30, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert chart state when legend clicked
parent
0121bb7e
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
12 deletions
+10
-12
c3.js
c3.js
+10
-12
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
740b5581
...
@@ -1747,9 +1747,9 @@
...
@@ -1747,9 +1747,9 @@
return
targetId
||
targetId
===
0
?
'-'
+
(
targetId
.
replace
?
targetId
.
replace
(
/
([^
a-zA-Z0-9-_
])
/g
,
'-'
)
:
targetId
)
:
''
;
return
targetId
||
targetId
===
0
?
'-'
+
(
targetId
.
replace
?
targetId
.
replace
(
/
([^
a-zA-Z0-9-_
])
/g
,
'-'
)
:
targetId
)
:
''
;
}
}
function
selectorTarget
(
id
)
{
return
'.'
+
CLASS
.
target
+
getTargetSelectorSuffix
(
id
);
}
function
selectorTarget
(
id
)
{
return
'.'
+
CLASS
.
target
+
getTargetSelectorSuffix
(
id
);
}
function
selectorTargets
(
ids
)
{
return
ids
.
map
(
function
(
id
)
{
return
selectorTarget
(
id
);
})
;
}
function
selectorTargets
(
ids
)
{
return
ids
.
length
?
ids
.
map
(
function
(
id
)
{
return
selectorTarget
(
id
);
})
:
null
;
}
function
selectorLegend
(
id
)
{
return
'.'
+
CLASS
.
legendItem
+
getTargetSelectorSuffix
(
id
);
}
function
selectorLegend
(
id
)
{
return
'.'
+
CLASS
.
legendItem
+
getTargetSelectorSuffix
(
id
);
}
function
selectorLegends
(
ids
)
{
return
ids
.
map
(
function
(
id
)
{
return
selectorLegend
(
id
);
})
;
}
function
selectorLegends
(
ids
)
{
return
ids
.
length
?
ids
.
map
(
function
(
id
)
{
return
selectorLegend
(
id
);
})
:
null
;
}
function
initialOpacity
(
d
)
{
function
initialOpacity
(
d
)
{
return
d
.
value
!==
null
&&
withoutFadeIn
[
d
.
id
]
?
1
:
0
;
return
d
.
value
!==
null
&&
withoutFadeIn
[
d
.
id
]
?
1
:
0
;
...
@@ -4090,6 +4090,12 @@
...
@@ -4090,6 +4090,12 @@
.
attr
(
'x'
,
xForLegend
)
.
attr
(
'x'
,
xForLegend
)
.
attr
(
'y'
,
yForLegend
);
.
attr
(
'y'
,
yForLegend
);
// toggle legend state
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
)
.
classed
(
CLASS
.
legendItemHidden
,
function
(
id
)
{
return
!
isTargetToShow
(
id
);
})
.
transition
()
.
style
(
'opacity'
,
function
(
id
)
{
return
isTargetToShow
(
id
)
?
1
:
legendOpacityForHidden
;
});
// Update all to reflect change of legend
// Update all to reflect change of legend
updateLegendItemWidth
(
maxWidth
);
updateLegendItemWidth
(
maxWidth
);
updateLegendItemHeight
(
maxHeight
);
updateLegendItemHeight
(
maxHeight
);
...
@@ -4183,14 +4189,10 @@
...
@@ -4183,14 +4189,10 @@
if
(
options
.
withLegend
)
{
if
(
options
.
withLegend
)
{
showLegend
(
targetIds
);
showLegend
(
targetIds
);
}
else
{
legend
.
selectAll
(
selectorLegends
(
targetIds
))
.
classed
(
CLASS
.
legendItemHidden
,
false
)
.
transition
()
.
style
(
'opacity'
,
1
);
}
}
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
c3
.
revert
();
};
};
c3
.
hide
=
function
(
targetIds
,
options
)
{
c3
.
hide
=
function
(
targetIds
,
options
)
{
...
@@ -4204,14 +4206,10 @@
...
@@ -4204,14 +4206,10 @@
if
(
options
.
withLegend
)
{
if
(
options
.
withLegend
)
{
hideLegend
(
targetIds
);
hideLegend
(
targetIds
);
}
else
{
legend
.
selectAll
(
selectorLegends
(
targetIds
))
.
classed
(
CLASS
.
legendItemHidden
,
true
)
.
transition
()
.
style
(
'opacity'
,
legendOpacityForHidden
);
}
}
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
c3
.
revert
();
};
};
c3
.
toggle
=
function
(
targetId
)
{
c3
.
toggle
=
function
(
targetId
)
{
...
...
c3.min.js
View file @
740b5581
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