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
90387157
Commit
90387157
authored
Nov 19, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor tick char size calculation - #730
parent
2c7a5835
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
c3.js
c3.js
+2
-2
c3.min.js
c3.min.js
+0
-0
axis-spec.js
spec/axis-spec.js
+6
-6
c3.axis.js
src/c3.axis.js
+2
-2
No files found.
c3.js
View file @
90387157
...
...
@@ -6525,7 +6525,7 @@
tickOffset
=
tickX
=
0
;
}
var
text
,
tspan
,
sizeFor1Char
=
getSizeFor1Char
(
tick
),
counts
=
[];
var
text
,
tspan
,
sizeFor1Char
=
getSizeFor1Char
(
g
.
select
(
'.tick'
)
),
counts
=
[];
var
tickLength
=
Math
.
max
(
innerTickSize
,
0
)
+
tickPadding
,
isVertical
=
orient
===
'left'
||
orient
===
'right'
;
...
...
@@ -6539,7 +6539,7 @@
}
if
(
!
maxWidth
||
maxWidth
<=
0
)
{
maxWidth
=
isVertical
?
95
:
params
.
isCategory
?
(
Math
.
ceil
(
scale1
(
ticks
[
1
])
-
scale1
(
ticks
[
0
]))
-
1
0
)
:
110
;
maxWidth
=
isVertical
?
95
:
params
.
isCategory
?
(
Math
.
ceil
(
scale1
(
ticks
[
1
])
-
scale1
(
ticks
[
0
]))
-
1
2
)
:
110
;
}
function
split
(
splitted
,
text
)
{
...
...
c3.min.js
View file @
90387157
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/axis-spec.js
View file @
90387157
...
...
@@ -378,8 +378,8 @@ describe('c3 chart axis', function () {
var
tick
=
chart
.
internal
.
main
.
select
(
'.c3-axis-x'
).
select
(
'g.tick'
),
tspans
=
tick
.
selectAll
(
'tspan'
),
expectedTickTexts
=
[
'this is a very'
,
'
long
tick text on'
,
'this is a very
long
'
,
'tick text on'
,
'category axis'
],
expectedX
=
'0'
;
...
...
@@ -427,8 +427,8 @@ describe('c3 chart axis', function () {
tspans
=
tick
.
selectAll
(
'tspan'
),
expectedTickTexts
=
[
'this is a very long'
,
'tick text on'
,
'
category
axis'
'tick text on
category
'
,
'axis'
],
expectedX
=
'-9'
;
expect
(
tspans
.
size
()).
toBe
(
3
);
...
...
@@ -479,8 +479,8 @@ describe('c3 chart axis', function () {
var
tick
=
chart
.
internal
.
main
.
select
(
'.c3-axis-x'
).
select
(
'g.tick'
),
tspans
=
tick
.
selectAll
(
'tspan'
),
expectedTickTexts
=
[
'this is a very long tick text'
,
'
on
category axis'
'this is a very long tick text
on
'
,
'category axis'
],
expectedX
=
'-9'
;
expect
(
tspans
.
size
()).
toBe
(
2
);
...
...
src/c3.axis.js
View file @
90387157
...
...
@@ -97,7 +97,7 @@ function c3_axis(d3, params) {
tickOffset
=
tickX
=
0
;
}
var
text
,
tspan
,
sizeFor1Char
=
getSizeFor1Char
(
tick
),
counts
=
[];
var
text
,
tspan
,
sizeFor1Char
=
getSizeFor1Char
(
g
.
select
(
'.tick'
)
),
counts
=
[];
var
tickLength
=
Math
.
max
(
innerTickSize
,
0
)
+
tickPadding
,
isVertical
=
orient
===
'left'
||
orient
===
'right'
;
...
...
@@ -111,7 +111,7 @@ function c3_axis(d3, params) {
}
if
(
!
maxWidth
||
maxWidth
<=
0
)
{
maxWidth
=
isVertical
?
95
:
params
.
isCategory
?
(
Math
.
ceil
(
scale1
(
ticks
[
1
])
-
scale1
(
ticks
[
0
]))
-
1
0
)
:
110
;
maxWidth
=
isVertical
?
95
:
params
.
isCategory
?
(
Math
.
ceil
(
scale1
(
ticks
[
1
])
-
scale1
(
ticks
[
0
]))
-
1
2
)
:
110
;
}
function
split
(
splitted
,
text
)
{
...
...
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