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
1f4e2228
Commit
1f4e2228
authored
Oct 25, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix zoom - #598
parent
ecb2f329
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
32 deletions
+26
-32
c3.js
c3.js
+13
-16
c3.min.js
c3.min.js
+0
-0
core.js
src/core.js
+4
-4
zoom.js
src/zoom.js
+9
-12
No files found.
c3.js
View file @
1f4e2228
...
...
@@ -418,7 +418,7 @@
c3_chart_internal_fn
.
redraw
=
function
(
options
,
transitions
)
{
var
$$
=
this
,
main
=
$$
.
main
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
areaIndices
=
$$
.
getShapeIndices
(
$$
.
isAreaType
),
barIndices
=
$$
.
getShapeIndices
(
$$
.
isBarType
),
lineIndices
=
$$
.
getShapeIndices
(
$$
.
isLineType
);
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
,
withLegend
;
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
,
withLegend
,
withEventRect
;
var
hideAxis
=
$$
.
hasArcType
();
var
drawArea
,
drawBar
,
drawLine
,
xForText
,
yForText
;
var
duration
,
durationForExit
,
durationForAxis
;
...
...
@@ -437,6 +437,7 @@
withUpdateOrgXDomain
=
getOption
(
options
,
"withUpdateOrgXDomain"
,
false
);
withTrimXDomain
=
getOption
(
options
,
"withTrimXDomain"
,
true
);
withLegend
=
getOption
(
options
,
"withLegend"
,
false
);
withEventRect
=
getOption
(
options
,
"withEventRect"
,
true
);
withTransitionForExit
=
getOption
(
options
,
"withTransitionForExit"
,
withTransition
);
withTransitionForAxis
=
getOption
(
options
,
"withTransitionForAxis"
,
withTransition
);
...
...
@@ -575,8 +576,9 @@
.
remove
();
// event rects will redrawn when flow called
if
(
config
.
interaction_enabled
&&
!
options
.
flow
)
{
if
(
config
.
interaction_enabled
&&
!
options
.
flow
&&
withEventRect
)
{
$$
.
redrawEventRect
();
if
(
$$
.
updateZoom
)
{
$$
.
updateZoom
();
}
}
// transition should be derived from one transition
...
...
@@ -618,8 +620,6 @@
$$
.
mapToIds
(
$$
.
data
.
targets
).
forEach
(
function
(
id
)
{
$$
.
withoutFadeIn
[
id
]
=
true
;
});
if
(
$$
.
updateZoom
)
{
$$
.
updateZoom
();
}
};
c3_chart_internal_fn
.
updateAndRedraw
=
function
(
options
)
{
...
...
@@ -5087,23 +5087,19 @@
};
c3_chart_internal_fn
.
initZoom
=
function
()
{
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
,
prevZoomTranslate
,
wheeled
=
false
;
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
$$
.
zoom
=
d3
.
behavior
.
zoom
()
.
on
(
"zoomstart"
,
function
()
{
$$
.
zoom
.
altDomain
=
d3
.
event
.
sourceEvent
.
altKey
?
$$
.
x
.
orgDomain
()
:
null
;
config
.
zoom_onzoomstart
.
call
(
$$
.
api
,
d3
.
event
.
sourceEvent
);
})
.
on
(
"zoom"
,
function
()
{
// prevZoomTranslate is needed for the fix of unexpected zoom.translate after remaining zoom
if
(
prevZoomTranslate
&&
wheeled
)
{
$$
.
zoom
.
translate
(
prevZoomTranslate
);
}
$$
.
redrawForZoom
.
call
(
$$
);
prevZoomTranslate
=
$$
.
zoom
.
translate
();
wheeled
=
d3
.
event
.
sourceEvent
.
type
===
'wheel'
;
})
.
on
(
'zoomend'
,
function
()
{
$$
.
redrawEventRect
();
$$
.
updateZoom
();
config
.
zoom_onzoomend
.
call
(
$$
.
api
,
$$
.
x
.
orgDomain
());
});
$$
.
zoom
.
scale
=
function
(
scale
)
{
...
...
@@ -5126,7 +5122,7 @@
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
eventRect
).
call
(
z
);
};
c3_chart_internal_fn
.
redrawForZoom
=
function
()
{
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
,
zoom
=
$$
.
zoom
,
x
=
$$
.
x
,
orgXDomain
=
$$
.
orgXDomain
;
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
,
zoom
=
$$
.
zoom
,
x
=
$$
.
x
;
if
(
!
config
.
zoom_enabled
)
{
return
;
}
...
...
@@ -5138,13 +5134,14 @@
zoom
.
scale
(
x
).
updateScaleExtent
();
return
;
}
if
(
$$
.
isCategorized
()
&&
x
.
orgDomain
()[
0
]
===
orgXDomain
[
0
])
{
x
.
domain
([
orgXDomain
[
0
]
-
1
e
-
10
,
x
.
orgDomain
()[
1
]]);
if
(
$$
.
isCategorized
()
&&
x
.
orgDomain
()[
0
]
===
$$
.
orgXDomain
[
0
])
{
x
.
domain
([
$$
.
orgXDomain
[
0
]
-
1
e
-
10
,
x
.
orgDomain
()[
1
]]);
}
$$
.
redraw
({
withTransition
:
false
,
withY
:
config
.
zoom_rescale
,
withSubchart
:
false
withSubchart
:
false
,
withEventRect
:
false
});
if
(
d3
.
event
.
sourceEvent
.
type
===
'mousemove'
)
{
$$
.
cancelClick
=
true
;
...
...
c3.min.js
View file @
1f4e2228
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/core.js
View file @
1f4e2228
...
...
@@ -413,7 +413,7 @@ c3_chart_internal_fn.updateTargets = function (targets) {
c3_chart_internal_fn
.
redraw
=
function
(
options
,
transitions
)
{
var
$$
=
this
,
main
=
$$
.
main
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
var
areaIndices
=
$$
.
getShapeIndices
(
$$
.
isAreaType
),
barIndices
=
$$
.
getShapeIndices
(
$$
.
isBarType
),
lineIndices
=
$$
.
getShapeIndices
(
$$
.
isLineType
);
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
,
withLegend
;
var
withY
,
withSubchart
,
withTransition
,
withTransitionForExit
,
withTransitionForAxis
,
withTransform
,
withUpdateXDomain
,
withUpdateOrgXDomain
,
withTrimXDomain
,
withLegend
,
withEventRect
;
var
hideAxis
=
$$
.
hasArcType
();
var
drawArea
,
drawBar
,
drawLine
,
xForText
,
yForText
;
var
duration
,
durationForExit
,
durationForAxis
;
...
...
@@ -432,6 +432,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
withUpdateOrgXDomain
=
getOption
(
options
,
"withUpdateOrgXDomain"
,
false
);
withTrimXDomain
=
getOption
(
options
,
"withTrimXDomain"
,
true
);
withLegend
=
getOption
(
options
,
"withLegend"
,
false
);
withEventRect
=
getOption
(
options
,
"withEventRect"
,
true
);
withTransitionForExit
=
getOption
(
options
,
"withTransitionForExit"
,
withTransition
);
withTransitionForAxis
=
getOption
(
options
,
"withTransitionForAxis"
,
withTransition
);
...
...
@@ -570,8 +571,9 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
.
remove
();
// event rects will redrawn when flow called
if
(
config
.
interaction_enabled
&&
!
options
.
flow
)
{
if
(
config
.
interaction_enabled
&&
!
options
.
flow
&&
withEventRect
)
{
$$
.
redrawEventRect
();
if
(
$$
.
updateZoom
)
{
$$
.
updateZoom
();
}
}
// transition should be derived from one transition
...
...
@@ -613,8 +615,6 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
$$
.
mapToIds
(
$$
.
data
.
targets
).
forEach
(
function
(
id
)
{
$$
.
withoutFadeIn
[
id
]
=
true
;
});
if
(
$$
.
updateZoom
)
{
$$
.
updateZoom
();
}
};
c3_chart_internal_fn
.
updateAndRedraw
=
function
(
options
)
{
...
...
src/zoom.js
View file @
1f4e2228
c3_chart_internal_fn
.
initZoom
=
function
()
{
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
,
prevZoomTranslate
,
wheeled
=
false
;
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
;
$$
.
zoom
=
d3
.
behavior
.
zoom
()
.
on
(
"zoomstart"
,
function
()
{
$$
.
zoom
.
altDomain
=
d3
.
event
.
sourceEvent
.
altKey
?
$$
.
x
.
orgDomain
()
:
null
;
config
.
zoom_onzoomstart
.
call
(
$$
.
api
,
d3
.
event
.
sourceEvent
);
})
.
on
(
"zoom"
,
function
()
{
// prevZoomTranslate is needed for the fix of unexpected zoom.translate after remaining zoom
if
(
prevZoomTranslate
&&
wheeled
)
{
$$
.
zoom
.
translate
(
prevZoomTranslate
);
}
$$
.
redrawForZoom
.
call
(
$$
);
prevZoomTranslate
=
$$
.
zoom
.
translate
();
wheeled
=
d3
.
event
.
sourceEvent
.
type
===
'wheel'
;
})
.
on
(
'zoomend'
,
function
()
{
$$
.
redrawEventRect
();
$$
.
updateZoom
();
config
.
zoom_onzoomend
.
call
(
$$
.
api
,
$$
.
x
.
orgDomain
());
});
$$
.
zoom
.
scale
=
function
(
scale
)
{
...
...
@@ -38,7 +34,7 @@ c3_chart_internal_fn.updateZoom = function () {
$$
.
main
.
selectAll
(
'.'
+
CLASS
.
eventRect
).
call
(
z
);
};
c3_chart_internal_fn
.
redrawForZoom
=
function
()
{
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
,
zoom
=
$$
.
zoom
,
x
=
$$
.
x
,
orgXDomain
=
$$
.
orgXDomain
;
var
$$
=
this
,
d3
=
$$
.
d3
,
config
=
$$
.
config
,
zoom
=
$$
.
zoom
,
x
=
$$
.
x
;
if
(
!
config
.
zoom_enabled
)
{
return
;
}
...
...
@@ -50,13 +46,14 @@ c3_chart_internal_fn.redrawForZoom = function () {
zoom
.
scale
(
x
).
updateScaleExtent
();
return
;
}
if
(
$$
.
isCategorized
()
&&
x
.
orgDomain
()[
0
]
===
orgXDomain
[
0
])
{
x
.
domain
([
orgXDomain
[
0
]
-
1
e
-
10
,
x
.
orgDomain
()[
1
]]);
if
(
$$
.
isCategorized
()
&&
x
.
orgDomain
()[
0
]
===
$$
.
orgXDomain
[
0
])
{
x
.
domain
([
$$
.
orgXDomain
[
0
]
-
1
e
-
10
,
x
.
orgDomain
()[
1
]]);
}
$$
.
redraw
({
withTransition
:
false
,
withY
:
config
.
zoom_rescale
,
withSubchart
:
false
withSubchart
:
false
,
withEventRect
:
false
});
if
(
d3
.
event
.
sourceEvent
.
type
===
'mousemove'
)
{
$$
.
cancelClick
=
true
;
...
...
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