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
cf29e8f7
Commit
cf29e8f7
authored
Apr 05, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix y axis padding - #126
parent
9beb0d4a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
c3.js
c3.js
+12
-12
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
cf29e8f7
...
...
@@ -176,7 +176,7 @@
__axis_y_label
=
getConfig
([
'axis'
,
'y'
,
'label'
],
{}),
__axis_y_inner
=
getConfig
([
'axis'
,
'y'
,
'inner'
],
false
),
__axis_y_tick_format
=
getConfig
([
'axis'
,
'y'
,
'tick'
,
'format'
]),
__axis_y_padding
=
getConfig
([
'axis'
,
'y'
,
'padding'
]),
__axis_y_padding
=
getConfig
([
'axis'
,
'y'
,
'padding'
]
,
{}
),
__axis_y_ticks
=
getConfig
([
'axis'
,
'y'
,
'ticks'
],
10
),
__axis_y2_show
=
getConfig
([
'axis'
,
'y2'
,
'show'
],
false
),
__axis_y2_max
=
getConfig
([
'axis'
,
'y2'
,
'max'
]),
...
...
@@ -185,7 +185,7 @@
__axis_y2_label
=
getConfig
([
'axis'
,
'y2'
,
'label'
],
{}),
__axis_y2_inner
=
getConfig
([
'axis'
,
'y2'
,
'inner'
],
false
),
__axis_y2_tick_format
=
getConfig
([
'axis'
,
'y2'
,
'tick'
,
'format'
]),
__axis_y2_padding
=
getConfig
([
'axis'
,
'y2'
,
'padding'
]),
__axis_y2_padding
=
getConfig
([
'axis'
,
'y2'
,
'padding'
]
,
{}
),
__axis_y2_ticks
=
getConfig
([
'axis'
,
'y2'
,
'ticks'
],
10
);
// grid
...
...
@@ -1149,7 +1149,7 @@
domainLength
,
padding
,
padding_top
,
padding_bottom
,
center
=
axisId
===
'y2'
?
__axis_y2_center
:
__axis_y_center
,
yDomainAbs
,
widths
,
diff
,
ratio
,
showDataLabel
=
hasDataLabel
()
&&
__axis_rotated
;
show
Horizontal
DataLabel
=
hasDataLabel
()
&&
__axis_rotated
;
if
(
yTargets
.
length
===
0
)
{
// use current domain if target of axisId is none
return
axisId
===
'y2'
?
y2
.
domain
()
:
y
.
domain
();
}
...
...
@@ -1157,12 +1157,20 @@
yDomainMin
<
0
?
yDomainMax
=
0
:
yDomainMin
=
0
;
}
domainLength
=
Math
.
abs
(
yDomainMax
-
yDomainMin
);
padding
=
padding_top
=
padding_bottom
=
showDataLabel
?
0
:
domainLength
*
0.1
;
padding
=
padding_top
=
padding_bottom
=
show
Horizontal
DataLabel
?
0
:
domainLength
*
0.1
;
if
(
center
)
{
yDomainAbs
=
Math
.
max
(
Math
.
abs
(
yDomainMin
),
Math
.
abs
(
yDomainMax
));
yDomainMax
=
yDomainAbs
-
center
;
yDomainMin
=
center
-
yDomainAbs
;
}
// add padding for data label
if
(
showHorizontalDataLabel
)
{
widths
=
getDataLabelWidth
(
yDomainMin
,
yDomainMax
);
diff
=
diffDomain
(
y
.
range
());
ratio
=
[
widths
[
0
]
/
diff
,
widths
[
1
]
/
diff
];
padding_top
+=
domainLength
*
(
ratio
[
1
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
}
if
(
axisId
===
'y'
&&
__axis_y_padding
)
{
padding_top
=
isValue
(
__axis_y_padding
.
top
)
?
__axis_y_padding
.
top
:
padding
;
padding_bottom
=
isValue
(
__axis_y_padding
.
bottom
)
?
__axis_y_padding
.
bottom
:
padding
;
...
...
@@ -1171,14 +1179,6 @@
padding_top
=
isValue
(
__axis_y2_padding
.
top
)
?
__axis_y2_padding
.
top
:
padding
;
padding_bottom
=
isValue
(
__axis_y2_padding
.
bottom
)
?
__axis_y2_padding
.
bottom
:
padding
;
}
// add padding for data label
if
(
showDataLabel
)
{
widths
=
getDataLabelWidth
(
yDomainMin
,
yDomainMax
);
diff
=
diffDomain
(
y
.
range
());
ratio
=
[
widths
[
0
]
/
diff
,
widths
[
1
]
/
diff
];
padding_top
+=
domainLength
*
(
ratio
[
1
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
}
// Bar chart with only positive values should be 0-based
if
(
hasBarType
(
yTargets
)
&&
!
hasNegativeValueInTargets
(
yTargets
))
{
padding_bottom
=
yDomainMin
;
...
...
c3.min.js
View file @
cf29e8f7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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