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
08e80f27
Commit
08e80f27
authored
Jun 01, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix y domain padding - #296
parent
9a67dce2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
4 deletions
+8
-4
c3.js
c3.js
+8
-4
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
08e80f27
...
...
@@ -1218,7 +1218,8 @@
domainLength
,
padding
,
padding_top
,
padding_bottom
,
center
=
axisId
===
'y2'
?
__axis_y2_center
:
__axis_y_center
,
yDomainAbs
,
lengths
,
diff
,
ratio
,
showHorizontalDataLabel
=
hasDataLabel
()
&&
__axis_rotated
;
showHorizontalDataLabel
=
hasDataLabel
()
&&
__axis_rotated
,
showVerticalDataLabel
=
hasDataLabel
()
&&
!
__axis_rotated
;
if
(
yTargets
.
length
===
0
)
{
// use current domain if target of axisId is none
return
axisId
===
'y2'
?
y2
.
domain
()
:
y
.
domain
();
}
...
...
@@ -1239,7 +1240,7 @@
ratio
=
[
lengths
[
0
]
/
diff
,
lengths
[
1
]
/
diff
];
padding_top
+=
domainLength
*
(
ratio
[
1
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
}
else
{
}
else
if
(
showVerticalDataLabel
)
{
lengths
=
getDataLabelLength
(
yDomainMin
,
yDomainMax
,
axisId
,
'height'
);
padding_top
+=
lengths
[
1
];
padding_bottom
+=
lengths
[
0
];
...
...
@@ -1252,8 +1253,8 @@
padding_top
=
getAxisPadding
(
__axis_y2_padding
,
'top'
,
padding
,
domainLength
);
padding_bottom
=
getAxisPadding
(
__axis_y2_padding
,
'bottom'
,
padding
,
domainLength
);
}
// Bar chart with only positive values should be 0-based
if
(
hasBarType
(
yTargets
)
&&
!
hasNegativeValueInTargets
(
yTargets
))
{
// Bar
/Area
chart with only positive values should be 0-based
if
(
(
hasBarType
(
yTargets
)
||
hasAreaType
(
yTargets
)
)
&&
!
hasNegativeValueInTargets
(
yTargets
))
{
padding_bottom
=
yDomainMin
;
}
return
[
yDomainMin
-
padding_bottom
,
yDomainMax
+
padding_top
];
...
...
@@ -2140,6 +2141,9 @@
return hasType(targets, 'line');
}
*/
function
hasAreaType
(
targets
)
{
return
hasType
(
targets
,
'area'
)
||
hasType
(
targets
,
'area-spline'
)
||
hasType
(
targets
,
'area-step'
);
}
function
hasBarType
(
targets
)
{
return
hasType
(
targets
,
'bar'
);
}
...
...
c3.min.js
View file @
08e80f27
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