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
98d4bc45
Commit
98d4bc45
authored
Jan 18, 2015
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix x grid height with padding.top - #903
parent
4522899a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
4 deletions
+42
-4
c3.js
c3.js
+2
-2
c3.min.js
c3.min.js
+0
-0
grid-spec.js
spec/grid-spec.js
+38
-0
grid.js
src/grid.js
+2
-2
No files found.
c3.js
View file @
98d4bc45
...
...
@@ -3488,7 +3488,7 @@
xgridLine
.
append
(
'text'
)
.
attr
(
"text-anchor"
,
"end"
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
'dx'
,
config
.
axis_rotated
?
0
:
-
$$
.
margin
.
top
)
.
attr
(
'dx'
,
-
4
)
.
attr
(
'dy'
,
-
5
)
.
style
(
"opacity"
,
0
);
// udpate
...
...
@@ -3543,7 +3543,7 @@
(
withTransition
?
lines
.
transition
()
:
lines
)
.
attr
(
"x1"
,
config
.
axis_rotated
?
0
:
xv
)
.
attr
(
"x2"
,
config
.
axis_rotated
?
$$
.
width
:
xv
)
.
attr
(
"y1"
,
config
.
axis_rotated
?
xv
:
$$
.
margin
.
top
)
.
attr
(
"y1"
,
config
.
axis_rotated
?
xv
:
0
)
.
attr
(
"y2"
,
config
.
axis_rotated
?
xv
:
$$
.
height
)
.
style
(
"opacity"
,
1
),
(
withTransition
?
texts
.
transition
()
:
texts
)
...
...
c3.min.js
View file @
98d4bc45
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/grid-spec.js
View file @
98d4bc45
...
...
@@ -83,6 +83,44 @@ describe('c3 chart grid', function () {
describe
(
'x grid lines'
,
function
()
{
describe
(
'with padding.top'
,
function
()
{
it
(
'should have correct height'
,
function
()
{
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
],
]
},
grid
:
{
x
:
{
lines
:
[
{
value
:
3
,
text
:
'Label 3'
}
]
}
},
padding
:
{
top
:
50
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should show x grid lines'
,
function
()
{
var
lines
=
chart
.
internal
.
main
.
select
(
'.c3-xgrid-lines .c3-xgrid-line'
),
expectedX1
=
593
,
expectedText
=
[
'Label 3'
];
lines
.
each
(
function
(
id
,
i
)
{
var
line
=
d3
.
select
(
this
),
l
=
line
.
select
(
'line'
),
t
=
line
.
select
(
'text'
);
expect
(
+
l
.
attr
(
'x1'
)).
toBeCloseTo
(
expectedX1
,
-
2
);
expect
(
t
.
text
()).
toBe
(
expectedText
[
i
]);
});
});
});
describe
(
'on category axis'
,
function
()
{
it
(
'should update args'
,
function
()
{
...
...
src/grid.js
View file @
98d4bc45
...
...
@@ -91,7 +91,7 @@ c3_chart_internal_fn.updateGrid = function (duration) {
xgridLine
.
append
(
'text'
)
.
attr
(
"text-anchor"
,
"end"
)
.
attr
(
"transform"
,
config
.
axis_rotated
?
""
:
"rotate(-90)"
)
.
attr
(
'dx'
,
config
.
axis_rotated
?
0
:
-
$$
.
margin
.
top
)
.
attr
(
'dx'
,
-
4
)
.
attr
(
'dy'
,
-
5
)
.
style
(
"opacity"
,
0
);
// udpate
...
...
@@ -146,7 +146,7 @@ c3_chart_internal_fn.redrawGrid = function (withTransition) {
(
withTransition
?
lines
.
transition
()
:
lines
)
.
attr
(
"x1"
,
config
.
axis_rotated
?
0
:
xv
)
.
attr
(
"x2"
,
config
.
axis_rotated
?
$$
.
width
:
xv
)
.
attr
(
"y1"
,
config
.
axis_rotated
?
xv
:
$$
.
margin
.
top
)
.
attr
(
"y1"
,
config
.
axis_rotated
?
xv
:
0
)
.
attr
(
"y2"
,
config
.
axis_rotated
?
xv
:
$$
.
height
)
.
style
(
"opacity"
,
1
),
(
withTransition
?
texts
.
transition
()
:
texts
)
...
...
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