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
439e00f6
Commit
439e00f6
authored
Oct 19, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add zoom API - #610
parent
10e02e59
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
2 deletions
+81
-2
c3.js
c3.js
+4
-1
c3.min.js
c3.min.js
+0
-0
api.zoom-spec.js
spec/api.zoom-spec.js
+73
-0
api.zoom.js
src/api.zoom.js
+4
-1
No files found.
c3.js
View file @
439e00f6
...
...
@@ -5533,7 +5533,10 @@
$$
.
isTargetToShow
(
targetId
)
?
this
.
hide
(
targetId
)
:
this
.
show
(
targetId
);
};
c3_chart_fn
.
zoom
=
function
()
{
c3_chart_fn
.
zoom
=
function
(
domain
)
{
var
$$
=
this
.
internal
;
$$
.
brush
.
extent
(
domain
);
$$
.
redraw
({
withUpdateXDomain
:
true
});
};
c3_chart_fn
.
zoom
.
enable
=
function
(
enabled
)
{
var
$$
=
this
.
internal
;
...
...
c3.min.js
View file @
439e00f6
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/api.zoom-spec.js
0 → 100644
View file @
439e00f6
var
describe
=
window
.
describe
,
expect
=
window
.
expect
,
it
=
window
.
it
,
beforeEach
=
window
.
beforeEach
;
describe
(
'c3 api zoom'
,
function
()
{
'use strict'
;
var
chart
,
d3
;
var
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
],
[
'data3'
,
150
,
120
,
110
,
140
,
115
,
125
]
]
},
zoom
:
{
enabled
:
true
}
};
beforeEach
(
function
(
done
)
{
if
(
typeof
chart
===
'undefined'
)
{
window
.
initDom
();
}
chart
=
window
.
c3
.
generate
(
args
);
d3
=
chart
.
internal
.
d3
;
// chart.internal.d3.select('.jasmine_html-reporter').style('display', 'none');
window
.
setTimeout
(
function
()
{
done
();
},
10
);
});
describe
(
'zoom'
,
function
()
{
it
(
'should be zoomed properly'
,
function
()
{
chart
.
zoom
([
3
,
5
]);
var
domain
=
chart
.
internal
.
x
.
domain
();
expect
(
domain
[
0
]).
toBe
(
3
);
expect
(
domain
[
1
]).
toBe
(
5
);
});
it
(
'should be zoomed properly again'
,
function
()
{
chart
.
zoom
([
1
,
4
]);
var
domain
=
chart
.
internal
.
x
.
domain
();
expect
(
domain
[
0
]).
toBe
(
1
);
expect
(
domain
[
1
]).
toBe
(
4
);
});
});
describe
(
'unzoom'
,
function
()
{
it
(
'should be unzoomed properly'
,
function
()
{
var
domain
;
chart
.
zoom
([
1
,
4
]);
domain
=
chart
.
internal
.
x
.
domain
();
expect
(
domain
[
0
]).
toBe
(
1
);
expect
(
domain
[
1
]).
toBe
(
4
);
chart
.
unzoom
();
domain
=
chart
.
internal
.
x
.
domain
();
expect
(
domain
[
0
]).
toBe
(
-
0.05
);
expect
(
domain
[
1
]).
toBe
(
5.05
);
});
});
});
src/api.zoom.js
View file @
439e00f6
c3_chart_fn
.
zoom
=
function
()
{
c3_chart_fn
.
zoom
=
function
(
domain
)
{
var
$$
=
this
.
internal
;
$$
.
brush
.
extent
(
domain
);
$$
.
redraw
({
withUpdateXDomain
:
true
});
};
c3_chart_fn
.
zoom
.
enable
=
function
(
enabled
)
{
var
$$
=
this
.
internal
;
...
...
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