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
cd316b3b
Commit
cd316b3b
authored
Dec 02, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix legend when revert called - #790
parent
2844338b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
68 additions
and
2 deletions
+68
-2
c3.js
c3.js
+3
-1
c3.min.js
c3.min.js
+0
-0
api.focus-spec.js
spec/api.focus-spec.js
+62
-0
api.focus.js
src/api.focus.js
+3
-1
No files found.
c3.js
View file @
cd316b3b
...
...
@@ -5690,7 +5690,9 @@
if
(
$$
.
hasArcType
())
{
$$
.
unexpandArc
(
targetIds
);
}
$$
.
showLegend
(
targetIds
);
if
(
$$
.
config
.
legend_show
)
{
$$
.
showLegend
(
targetIds
);
}
$$
.
focusedTargetIds
=
[];
$$
.
defocusedTargetIds
=
[];
...
...
c3.min.js
View file @
cd316b3b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/api.focus-spec.js
View file @
cd316b3b
...
...
@@ -368,4 +368,66 @@ describe('c3 api load', function () {
});
describe
(
'when legend.show = false'
,
function
()
{
it
(
'should update args to hide legend'
,
function
()
{
args
.
legend
=
{
show
:
false
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should focus all targets without showing legend'
,
function
(
done
)
{
var
main
=
chart
.
internal
.
main
,
legend
=
chart
.
internal
.
legend
;
chart
.
focus
();
setTimeout
(
function
()
{
var
targets
=
main
.
select
(
'.c3-chart-line.c3-target'
),
legendItems
=
legend
.
select
(
'.c3-legend-item'
);
targets
.
each
(
function
()
{
var
line
=
d3
.
select
(
this
);
expect
(
line
.
classed
(
'c3-focused'
)).
toBeTruthy
();
});
expect
(
legendItems
.
size
()).
toBeCloseTo
(
0
);
done
();
},
500
);
});
it
(
'should defocus all targets without showing legend'
,
function
(
done
)
{
var
main
=
chart
.
internal
.
main
,
legend
=
chart
.
internal
.
legend
;
chart
.
defocus
();
setTimeout
(
function
()
{
var
targets
=
main
.
select
(
'.c3-chart-line.c3-target'
),
legendItems
=
legend
.
select
(
'.c3-legend-item'
);
targets
.
each
(
function
()
{
var
line
=
d3
.
select
(
this
);
expect
(
line
.
classed
(
'c3-defocused'
)).
toBeTruthy
();
});
expect
(
legendItems
.
size
()).
toBeCloseTo
(
0
);
done
();
},
500
);
});
it
(
'should revert all targets after focus'
,
function
(
done
)
{
var
main
=
chart
.
internal
.
main
,
legend
=
chart
.
internal
.
legend
;
chart
.
focus
();
setTimeout
(
function
()
{
chart
.
revert
();
setTimeout
(
function
()
{
var
targets
=
main
.
select
(
'.c3-chart-line.c3-target'
),
legendItems
=
legend
.
select
(
'.c3-legend-item'
);
targets
.
each
(
function
()
{
var
line
=
d3
.
select
(
this
);
expect
(
line
.
classed
(
'c3-focused'
)).
toBeFalsy
();
});
expect
(
legendItems
.
size
()).
toBeCloseTo
(
0
);
done
();
},
500
);
},
500
);
});
});
});
src/api.focus.js
View file @
cd316b3b
...
...
@@ -47,7 +47,9 @@ c3_chart_fn.revert = function (targetIds) {
if
(
$$
.
hasArcType
())
{
$$
.
unexpandArc
(
targetIds
);
}
$$
.
showLegend
(
targetIds
);
if
(
$$
.
config
.
legend_show
)
{
$$
.
showLegend
(
targetIds
);
}
$$
.
focusedTargetIds
=
[];
$$
.
defocusedTargetIds
=
[];
...
...
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