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
2035754c
Commit
2035754c
authored
Oct 22, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add zoom.rescale option to rescale y/y2 when zooming - #559
parent
3ed0373e
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
48 additions
and
14 deletions
+48
-14
c3.js
c3.js
+24
-7
c3.min.js
c3.min.js
+0
-0
config.js
src/config.js
+1
-0
core.js
src/core.js
+7
-3
data.js
src/data.js
+11
-0
domain.js
src/domain.js
+3
-2
subchart.js
src/subchart.js
+1
-1
zoom.js
src/zoom.js
+1
-1
No files found.
c3.js
View file @
2035754c
...
...
@@ -423,7 +423,7 @@
var
drawArea
,
drawBar
,
drawLine
,
xForText
,
yForText
;
var
duration
,
durationForExit
,
durationForAxis
;
var
waitForDraw
,
flow
;
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
),
tickValues
,
i
,
intervalForCulling
;
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
),
tickValues
,
i
,
intervalForCulling
,
xDomainForZoom
;
var
xv
=
$$
.
xv
.
bind
(
$$
),
cx
=
(
$$
.
config
.
axis_rotated
?
$$
.
circleY
:
$$
.
circleX
).
bind
(
$$
),
cy
=
(
$$
.
config
.
axis_rotated
?
$$
.
circleX
:
$$
.
circleY
).
bind
(
$$
);
...
...
@@ -469,8 +469,12 @@
$$
.
subXAxis
.
tickValues
([]);
}
$$
.
y
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y'
));
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
));
if
(
withY
)
{
xDomainForZoom
=
$$
.
x
.
orgDomain
();
}
$$
.
y
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y'
,
xDomainForZoom
));
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
,
xDomainForZoom
));
if
(
!
config
.
axis_y_tick_values
&&
config
.
axis_y_tick_count
)
{
tickValues
=
$$
.
generateTickValues
(
$$
.
y
.
domain
(),
config
.
axis_y_tick_count
);
...
...
@@ -889,6 +893,7 @@
zoom_enabled
:
false
,
zoom_extent
:
undefined
,
zoom_privileged
:
false
,
zoom_rescale
:
false
,
zoom_onzoom
:
function
()
{},
zoom_onzoomstart
:
function
()
{},
zoom_onzoomend
:
function
()
{},
...
...
@@ -1248,9 +1253,10 @@
}
return
$$
.
d3
.
max
(
Object
.
keys
(
ys
).
map
(
function
(
key
)
{
return
$$
.
d3
.
max
(
ys
[
key
]);
}));
};
c3_chart_internal_fn
.
getYDomain
=
function
(
targets
,
axisId
)
{
c3_chart_internal_fn
.
getYDomain
=
function
(
targets
,
axisId
,
xDomain
)
{
var
$$
=
this
,
config
=
$$
.
config
,
yTargets
=
targets
.
filter
(
function
(
d
)
{
return
$$
.
getAxisId
(
d
.
id
)
===
axisId
;
}),
targetsByAxisId
=
targets
.
filter
(
function
(
t
)
{
return
$$
.
getAxisId
(
t
.
id
)
===
axisId
;
}),
yTargets
=
xDomain
?
$$
.
filterByXDomain
(
targetsByAxisId
,
xDomain
)
:
targetsByAxisId
,
yMin
=
axisId
===
'y2'
?
config
.
axis_y2_min
:
config
.
axis_y_min
,
yMax
=
axisId
===
'y2'
?
config
.
axis_y2_max
:
config
.
axis_y_max
,
yDomainMin
=
isValue
(
yMin
)
?
yMin
:
$$
.
getYDomainMin
(
yTargets
),
...
...
@@ -1656,6 +1662,17 @@
c3_chart_internal_fn
.
filterRemoveNull
=
function
(
data
)
{
return
data
.
filter
(
function
(
d
)
{
return
isValue
(
d
.
value
);
});
};
c3_chart_internal_fn
.
filterByXDomain
=
function
(
targets
,
xDomain
)
{
return
targets
.
map
(
function
(
t
)
{
return
{
id
:
t
.
id
,
id_org
:
t
.
id_org
,
values
:
t
.
values
.
filter
(
function
(
v
)
{
return
xDomain
[
0
]
<=
v
.
x
&&
v
.
x
<=
xDomain
[
1
];
})
};
});
};
c3_chart_internal_fn
.
hasDataLabel
=
function
()
{
var
config
=
this
.
config
;
if
(
typeof
config
.
data_labels
===
'boolean'
&&
config
.
data_labels
)
{
...
...
@@ -5043,7 +5060,7 @@
var
$$
=
this
,
x
=
$$
.
x
;
$$
.
redraw
({
withTransition
:
false
,
withY
:
fals
e
,
withY
:
$$
.
config
.
zoom_rescal
e
,
withSubchart
:
false
,
withUpdateXDomain
:
true
});
...
...
@@ -5126,7 +5143,7 @@
}
$$
.
redraw
({
withTransition
:
false
,
withY
:
fals
e
,
withY
:
config
.
zoom_rescal
e
,
withSubchart
:
false
});
if
(
d3
.
event
.
sourceEvent
.
type
===
'mousemove'
)
{
...
...
c3.min.js
View file @
2035754c
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/config.js
View file @
2035754c
...
...
@@ -10,6 +10,7 @@ c3_chart_internal_fn.getDefaultConfig = function () {
zoom_enabled
:
false
,
zoom_extent
:
undefined
,
zoom_privileged
:
false
,
zoom_rescale
:
false
,
zoom_onzoom
:
function
()
{},
zoom_onzoomstart
:
function
()
{},
zoom_onzoomend
:
function
()
{},
...
...
src/core.js
View file @
2035754c
...
...
@@ -418,7 +418,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
var
drawArea
,
drawBar
,
drawLine
,
xForText
,
yForText
;
var
duration
,
durationForExit
,
durationForAxis
;
var
waitForDraw
,
flow
;
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
),
tickValues
,
i
,
intervalForCulling
;
var
targetsToShow
=
$$
.
filterTargetsToShow
(
$$
.
data
.
targets
),
tickValues
,
i
,
intervalForCulling
,
xDomainForZoom
;
var
xv
=
$$
.
xv
.
bind
(
$$
),
cx
=
(
$$
.
config
.
axis_rotated
?
$$
.
circleY
:
$$
.
circleX
).
bind
(
$$
),
cy
=
(
$$
.
config
.
axis_rotated
?
$$
.
circleX
:
$$
.
circleY
).
bind
(
$$
);
...
...
@@ -464,8 +464,12 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
$$
.
subXAxis
.
tickValues
([]);
}
$$
.
y
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y'
));
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
));
if
(
withY
)
{
xDomainForZoom
=
$$
.
x
.
orgDomain
();
}
$$
.
y
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y'
,
xDomainForZoom
));
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
,
xDomainForZoom
));
if
(
!
config
.
axis_y_tick_values
&&
config
.
axis_y_tick_count
)
{
tickValues
=
$$
.
generateTickValues
(
$$
.
y
.
domain
(),
config
.
axis_y_tick_count
);
...
...
src/data.js
View file @
2035754c
...
...
@@ -232,6 +232,17 @@ c3_chart_internal_fn.filterByX = function (targets, x) {
c3_chart_internal_fn
.
filterRemoveNull
=
function
(
data
)
{
return
data
.
filter
(
function
(
d
)
{
return
isValue
(
d
.
value
);
});
};
c3_chart_internal_fn
.
filterByXDomain
=
function
(
targets
,
xDomain
)
{
return
targets
.
map
(
function
(
t
)
{
return
{
id
:
t
.
id
,
id_org
:
t
.
id_org
,
values
:
t
.
values
.
filter
(
function
(
v
)
{
return
xDomain
[
0
]
<=
v
.
x
&&
v
.
x
<=
xDomain
[
1
];
})
};
});
};
c3_chart_internal_fn
.
hasDataLabel
=
function
()
{
var
config
=
this
.
config
;
if
(
typeof
config
.
data_labels
===
'boolean'
&&
config
.
data_labels
)
{
...
...
src/domain.js
View file @
2035754c
...
...
@@ -60,9 +60,10 @@ c3_chart_internal_fn.getYDomainMax = function (targets) {
}
return
$$
.
d3
.
max
(
Object
.
keys
(
ys
).
map
(
function
(
key
)
{
return
$$
.
d3
.
max
(
ys
[
key
]);
}));
};
c3_chart_internal_fn
.
getYDomain
=
function
(
targets
,
axisId
)
{
c3_chart_internal_fn
.
getYDomain
=
function
(
targets
,
axisId
,
xDomain
)
{
var
$$
=
this
,
config
=
$$
.
config
,
yTargets
=
targets
.
filter
(
function
(
d
)
{
return
$$
.
getAxisId
(
d
.
id
)
===
axisId
;
}),
targetsByAxisId
=
targets
.
filter
(
function
(
t
)
{
return
$$
.
getAxisId
(
t
.
id
)
===
axisId
;
}),
yTargets
=
xDomain
?
$$
.
filterByXDomain
(
targetsByAxisId
,
xDomain
)
:
targetsByAxisId
,
yMin
=
axisId
===
'y2'
?
config
.
axis_y2_min
:
config
.
axis_y_min
,
yMax
=
axisId
===
'y2'
?
config
.
axis_y2_max
:
config
.
axis_y_max
,
yDomainMin
=
isValue
(
yMin
)
?
yMin
:
$$
.
getYDomainMin
(
yTargets
),
...
...
src/subchart.js
View file @
2035754c
...
...
@@ -164,7 +164,7 @@ c3_chart_internal_fn.redrawForBrush = function () {
var
$$
=
this
,
x
=
$$
.
x
;
$$
.
redraw
({
withTransition
:
false
,
withY
:
fals
e
,
withY
:
$$
.
config
.
zoom_rescal
e
,
withSubchart
:
false
,
withUpdateXDomain
:
true
});
...
...
src/zoom.js
View file @
2035754c
...
...
@@ -55,7 +55,7 @@ c3_chart_internal_fn.redrawForZoom = function () {
}
$$
.
redraw
({
withTransition
:
false
,
withY
:
fals
e
,
withY
:
config
.
zoom_rescal
e
,
withSubchart
:
false
});
if
(
d3
.
event
.
sourceEvent
.
type
===
'mousemove'
)
{
...
...
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