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
ad38e566
Commit
ad38e566
authored
Aug 15, 2016
by
Evgeny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bug when setting axis_x_tick_rotate to 0 didn't turn ticks
parent
cf3fdf7e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
4 deletions
+22
-4
c3.js
c3.js
+11
-2
c3.min.js
c3.min.js
+0
-0
axis.js
src/axis.js
+11
-2
No files found.
c3.js
View file @
ad38e566
...
...
@@ -4917,7 +4917,15 @@
};
c3_chart_internal_fn
.
rotateTickText
=
function
(
axis
,
transition
,
rotate
)
{
axis
.
selectAll
(
'.tick text'
)
.
style
(
"text-anchor"
,
rotate
>
0
?
"start"
:
"end"
);
.
style
(
"text-anchor"
,
function
(){
if
(
rotate
>
0
){
return
'start'
;
}
else
if
(
rotate
<
0
){
return
'end'
;
}
else
{
return
'middle'
;
}
});
transition
.
selectAll
(
'.tick text'
)
.
attr
(
"y"
,
this
.
yForRotatedTickText
(
rotate
))
.
attr
(
"transform"
,
"rotate("
+
rotate
+
")"
)
...
...
@@ -4963,6 +4971,7 @@
// assume padding is pixels if unit is not specified
return
this
.
convertPixelsToAxisPadding
(
padding
[
key
],
domainLength
);
};
c3_chart_internal_fn
.
convertPixelsToAxisPadding
=
function
(
pixels
,
domainLength
)
{
var
length
=
this
.
config
.
axis_rotated
?
this
.
width
:
this
.
height
;
return
domainLength
*
(
pixels
/
length
);
...
...
@@ -5014,7 +5023,7 @@
transitions
.
axisY2
.
call
(
$$
.
y2Axis
);
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
// rotate tick text if needed
if
(
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
if
(
!
config
.
axis_rotated
)
{
$$
.
rotateTickText
(
$$
.
axes
.
x
,
transitions
.
axisX
,
config
.
axis_x_tick_rotate
);
$$
.
rotateTickText
(
$$
.
axes
.
subx
,
transitions
.
axisSubX
,
config
.
axis_x_tick_rotate
);
}
...
...
c3.min.js
View file @
ad38e566
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/axis.js
View file @
ad38e566
...
...
@@ -295,7 +295,15 @@ c3_chart_internal_fn.yForRotatedTickText = function (r) {
};
c3_chart_internal_fn
.
rotateTickText
=
function
(
axis
,
transition
,
rotate
)
{
axis
.
selectAll
(
'.tick text'
)
.
style
(
"text-anchor"
,
rotate
>
0
?
"start"
:
"end"
);
.
style
(
"text-anchor"
,
function
(){
if
(
rotate
>
0
){
return
'start'
;
}
else
if
(
rotate
<
0
){
return
'end'
;
}
else
{
return
'middle'
;
}
});
transition
.
selectAll
(
'.tick text'
)
.
attr
(
"y"
,
this
.
yForRotatedTickText
(
rotate
))
.
attr
(
"transform"
,
"rotate("
+
rotate
+
")"
)
...
...
@@ -341,6 +349,7 @@ c3_chart_internal_fn.getAxisPadding = function (padding, key, defaultValue, doma
// assume padding is pixels if unit is not specified
return
this
.
convertPixelsToAxisPadding
(
padding
[
key
],
domainLength
);
};
c3_chart_internal_fn
.
convertPixelsToAxisPadding
=
function
(
pixels
,
domainLength
)
{
var
length
=
this
.
config
.
axis_rotated
?
this
.
width
:
this
.
height
;
return
domainLength
*
(
pixels
/
length
);
...
...
@@ -392,7 +401,7 @@ c3_chart_internal_fn.redrawAxis = function (transitions, isHidden) {
transitions
.
axisY2
.
call
(
$$
.
y2Axis
);
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
// rotate tick text if needed
if
(
!
config
.
axis_rotated
&&
config
.
axis_x_tick_rotate
)
{
if
(
!
config
.
axis_rotated
)
{
$$
.
rotateTickText
(
$$
.
axes
.
x
,
transitions
.
axisX
,
config
.
axis_x_tick_rotate
);
$$
.
rotateTickText
(
$$
.
axes
.
subx
,
transitions
.
axisSubX
,
config
.
axis_x_tick_rotate
);
}
...
...
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