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
dceeaf28
Commit
dceeaf28
authored
Dec 06, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix y axis padding when data label shown - #799
parent
bfac88c2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
13 deletions
+28
-13
c3.js
c3.js
+2
-2
c3.min.js
c3.min.js
+0
-0
data-spec.js
spec/data-spec.js
+24
-9
domain.js
src/domain.js
+2
-2
No files found.
c3.js
View file @
dceeaf28
...
...
@@ -1369,8 +1369,8 @@
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
}
else
if
(
showVerticalDataLabel
)
{
lengths
=
$$
.
getDataLabelLength
(
yDomainMin
,
yDomainMax
,
axisId
,
'height'
);
padding_top
+=
lengths
[
1
]
;
padding_bottom
+=
lengths
[
0
]
;
padding_top
+=
domainLength
*
(
lengths
[
1
]
/
$$
.
height
)
;
padding_bottom
+=
domainLength
*
(
lengths
[
0
]
/
$$
.
height
)
;
}
if
(
axisId
===
'y'
&&
notEmpty
(
config
.
axis_y_padding
))
{
padding_top
=
$$
.
getAxisPadding
(
config
.
axis_y_padding
,
'top'
,
padding
,
domainLength
);
...
...
c3.min.js
View file @
dceeaf28
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/data-spec.js
View file @
dceeaf28
...
...
@@ -22,16 +22,8 @@ describe('c3 chart data', function () {
};
beforeEach
(
function
(
done
)
{
if
(
typeof
chart
===
'undefined'
)
{
window
.
initDom
();
}
chart
=
window
.
c3
.
generate
(
args
);
chart
=
window
.
initChart
(
chart
,
args
,
done
);
d3
=
chart
.
internal
.
d3
;
chart
.
internal
.
d3
.
select
(
'.jasmine_html-reporter'
).
style
(
'display'
,
'none'
);
window
.
setTimeout
(
function
()
{
done
();
},
10
);
});
describe
(
'function in data.order'
,
function
()
{
...
...
@@ -147,4 +139,27 @@ describe('c3 chart data', function () {
});
});
describe
(
'data.label'
,
function
()
{
it
(
'should update args to show data label'
,
function
()
{
args
=
{
data
:
{
columns
:
[
[
'data1'
,
0.03
,
0.2
,
0.1
,
0.4
,
0.15
,
0.250
]
],
labels
:
true
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should have proper y domain'
,
function
()
{
var
domain
=
chart
.
internal
.
y
.
domain
();
expect
(
domain
[
0
]).
toBeCloseTo
(
-
0.02
);
expect
(
domain
[
1
]).
toBeCloseTo
(
0.45
);
});
});
});
src/domain.js
View file @
dceeaf28
...
...
@@ -126,8 +126,8 @@ c3_chart_internal_fn.getYDomain = function (targets, axisId, xDomain) {
padding_bottom
+=
domainLength
*
(
ratio
[
0
]
/
(
1
-
ratio
[
0
]
-
ratio
[
1
]));
}
else
if
(
showVerticalDataLabel
)
{
lengths
=
$$
.
getDataLabelLength
(
yDomainMin
,
yDomainMax
,
axisId
,
'height'
);
padding_top
+=
lengths
[
1
]
;
padding_bottom
+=
lengths
[
0
]
;
padding_top
+=
domainLength
*
(
lengths
[
1
]
/
$$
.
height
)
;
padding_bottom
+=
domainLength
*
(
lengths
[
0
]
/
$$
.
height
)
;
}
if
(
axisId
===
'y'
&&
notEmpty
(
config
.
axis_y_padding
))
{
padding_top
=
$$
.
getAxisPadding
(
config
.
axis_y_padding
,
'top'
,
padding
,
domainLength
);
...
...
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