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
cb918fd1
Commit
cb918fd1
authored
Oct 27, 2016
by
Дмитрий Никулин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit built files
parent
abbeb175
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
34 deletions
+45
-34
c3.js
c3.js
+45
-34
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
cb918fd1
...
...
@@ -8452,6 +8452,38 @@
tickTextCharSize
=
size
;
return
size
;
}
function
hasIntersection
(
rect1
,
rect2
)
{
var
r1x2
=
rect1
.
x
+
rect1
.
width
;
var
r2x2
=
rect2
.
x
+
rect2
.
width
;
var
r1y2
=
rect1
.
y
+
rect1
.
height
;
var
r2y2
=
rect2
.
y
+
rect2
.
height
;
return
(
rect1
.
x
<
r2x2
&&
r1x2
>
rect2
.
x
&&
rect1
.
y
<
r2y2
&&
r1y2
>
rect2
.
y
);
}
function
cullRects
(
rects
){
if
(
rects
.
length
<
2
)
return
;
var
cullGap
=
0
;
var
i
,
j
,
l
=
rects
.
length
;
for
(
i
=
1
,
j
=
0
;
i
<
l
;
i
++
){
if
(
hasIntersection
(
rects
[
i
],
rects
[
j
])){
cullGap
=
Math
.
max
(
cullGap
,
i
-
j
);
}
else
{
j
=
i
;
}
}
if
(
!
cullGap
)
return
;
var
cullStep
=
cullGap
+
1
;
for
(
i
=
0
;
i
<
l
;
i
++
){
if
(
i
%
cullStep
){
rects
[
i
]
=
null
;
}
}
}
function
axis
(
g
)
{
g
.
each
(
function
()
{
var
g
=
d3
.
select
(
this
);
...
...
@@ -8539,16 +8571,6 @@
return
dy
;
}
function
hasIntersection
(
rect1
,
rect2
)
{
var
r1x2
=
rect1
.
x
+
rect1
.
width
;
var
r2x2
=
rect2
.
x
+
rect2
.
width
;
var
r1y2
=
rect1
.
y
+
rect1
.
height
;
var
r2y2
=
rect2
.
y
+
rect2
.
height
;
return
(
rect1
.
x
<
r2x2
&&
r1x2
>
rect2
.
x
&&
rect1
.
y
<
r2y2
&&
r1y2
>
rect2
.
y
);
}
function
tickSize
(
d
)
{
return
innerTickSize
;
}
...
...
@@ -8570,13 +8592,6 @@
tspan
.
exit
().
remove
();
var
axisId
=
$$
.
isXAxis
(
orient
)
?
'x'
:
'y'
;
var
textClass
=
'.c3-axis-'
+
axisId
+
' .tick'
var
textRects
=
text
.
data
().
map
(
function
(
data
)
{
var
rect
=
$$
.
getTextRect
(
textFormatted
(
data
),
textClass
);
// Smaal additional padding between texts
rect
.
width
+=
10
;
return
rect
;
});
var
fontSize
=
parseFloat
(
getStyleValue
(
$$
,
'.c3-axis-y .tick'
,
'font-size'
));
...
...
@@ -8709,26 +8724,22 @@
break
;
}
var
last
=
textRects
.
length
-
1
;
rectPositionFn
(
textRects
[
0
],
text
.
data
()[
0
]);
rectPositionFn
(
textRects
[
last
],
text
.
data
().
pop
());
var
addedTextRects
=
[
textRects
[
0
],
textRects
[
last
]];
text
.
style
(
'display'
,
function
(
d
,
i
){
if
(
i
===
0
||
i
===
last
)
return
'block'
;
var
textClass
=
'.c3-axis-'
+
axisId
+
' .tick'
;
var
textRects
=
text
.
data
().
map
(
function
(
data
)
{
var
rect
=
$$
.
getTextRect
(
textFormatted
(
data
),
textClass
);
// Smaal additional padding between texts
rect
.
width
+=
10
;
return
rect
;
});
var
rect
=
textRects
[
i
];
rectPositionFn
(
rect
,
d
);
var
visible
=
!
addedTextRects
.
some
(
function
(
added
){
return
hasIntersection
(
rect
,
added
);
});
text
.
each
(
function
(
d
,
i
){
rectPositionFn
(
textRects
[
i
],
d
);
});
if
(
visible
){
addedTextRects
.
push
(
rect
);
}
cullRects
(
textRects
);
return
visible
?
'block'
:
'none'
;
text
.
style
(
'display'
,
function
(
d
,
i
){
return
textRects
[
i
]
===
null
?
'none'
:
'block'
;
});
});
}
...
...
c3.min.js
View file @
cb918fd1
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