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
ab3c3826
Commit
ab3c3826
authored
Oct 18, 2013
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable zoom
parent
368573af
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
4 deletions
+35
-4
c3.js
c3.js
+35
-4
c3.min.js
c3.min.js
+0
-0
c3.min.js
htdocs/js/c3.min.js
+0
-0
No files found.
c3.js
View file @
ab3c3826
...
...
@@ -421,8 +421,15 @@
return
[
hasBarType
(
yTargets
)
?
0
:
yDomainMin
-
padding_bottom
,
yDomainMax
+
padding_top
];
}
function
getXDomainRatio
()
{
if
(
brush
.
empty
())
return
1
;
var
domain
=
subX
.
domain
(),
extent
=
brush
.
extent
();
var
domain
,
extent
;
if
(
__subchart_show
)
{
if
(
brush
.
empty
())
return
1
;
domain
=
subX
.
domain
();
extent
=
brush
.
extent
();
}
else
{
domain
=
orgXDomain
;
extent
=
x
.
domain
();
}
return
(
domain
[
1
]
-
domain
[
0
])
/
(
extent
[
1
]
-
extent
[
0
]);
}
...
...
@@ -828,6 +835,7 @@
/*-- Define brush --*/
var
brush
=
d3
.
svg
.
brush
().
x
(
subX
).
on
(
"brush"
,
redrawForBrush
);
var
zoom
=
d3
.
behavior
.
zoom
().
on
(
"zoom"
,
redrawForZoom
);
/*-- Draw Chart --*/
...
...
@@ -835,6 +843,8 @@
var
firstDate
=
null
,
lastDate
=
null
;
var
orgXDomain
;
function
init
(
data
)
{
var
targets
=
c3
.
data
.
targets
=
convertDataToTargets
(
data
);
var
rectX
,
rectW
;
...
...
@@ -855,6 +865,12 @@
yAxis
.
ticks
(
3
).
outerTickSize
(
0
).
tickFormat
(
__axis_y_format
);
yAxis2
.
ticks
(
3
).
outerTickSize
(
0
).
tickFormat
(
__axis_y2_format
);
// Save original x domain for zoom update
orgXDomain
=
x
.
domain
();
// MEMO: must set x here for timeseries data
zoom
.
x
(
x
);
/*-- Main Region --*/
// Add Axis
...
...
@@ -1123,7 +1139,8 @@
dragging
=
false
;
// TODO: add callback here
})
);
)
.
call
(
zoom
);
// Define g for bar chart area
main
.
select
(
".chart"
).
append
(
"g"
)
...
...
@@ -1204,14 +1221,20 @@
var
barIndices
=
getBarIndices
(),
barTargetsNum
=
barIndices
.
__max__
+
1
;
var
barX
,
barY
,
barW
,
barH
;
var
rectX
,
rectW
;
var
withY
,
withSubchart
,
withTransition
,
withUpdateXDomain
;
// Hide tooltip and grid
main
.
select
(
'line.xgrid-focus'
).
style
(
"visibility"
,
"hidden"
);
tooltip
.
style
(
"visibility"
,
"hidden"
);
options
=
isDefined
(
options
)
?
options
:
{};
withY
=
isDefined
(
options
.
withY
)
?
options
.
withY
:
true
;
withSubchart
=
isDefined
(
options
.
withSubchart
)
?
options
.
withSubchart
:
true
;
withTransition
=
isDefined
(
options
.
withTransition
)
?
options
.
withTransition
:
true
;
withUpdateXDomain
=
isDefined
(
options
.
withUpdateXDomain
)
?
options
.
withUpdateXDomain
:
true
;
// ATTENTION: call here to update tickOffset
x
.
domain
(
brush
.
empty
()
?
subX
.
domain
()
:
brush
.
extent
());
if
(
withUpdateXDomain
)
x
.
domain
(
brush
.
empty
()
?
subX
.
domain
()
:
brush
.
extent
());
y
.
domain
(
getYDomain
(
c3
.
data
.
targets
,
'y'
));
y2
.
domain
(
getYDomain
(
c3
.
data
.
targets
,
'y2'
));
...
...
@@ -1387,6 +1410,14 @@
withSubchart
:
false
});
}
function
redrawForZoom
()
{
redraw
({
withTransition
:
false
,
withY
:
false
,
withSubchart
:
false
,
withUpdateXDomain
:
false
});
}
function
resize
()
{
// Update sizes and scales
...
...
c3.min.js
View file @
ab3c3826
This diff is collapsed.
Click to expand it.
htdocs/js/c3.min.js
View file @
ab3c3826
This diff is collapsed.
Click to expand it.
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