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
Evgeny
c3-closed
Commits
6d385be0
Commit
6d385be0
authored
Aug 06, 2015
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1231 from laurence-hudson-tessella/fix-title-layout-bug
Fix #1225 - (0.4.11-rc1) Incorrect layout when using titles on charts that are not visible at generation
parents
f78a0856
10b3efc1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
5 deletions
+7
-5
legend.js
src/legend.js
+1
-1
text.js
src/text.js
+3
-1
title.js
src/title.js
+3
-3
No files found.
src/legend.js
View file @
6d385be0
...
...
@@ -130,7 +130,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
function
getTextBox
(
textElement
,
id
)
{
if
(
!
$$
.
legendItemTextBox
[
id
])
{
$$
.
legendItemTextBox
[
id
]
=
$$
.
getTextRect
(
textElement
.
textContent
,
CLASS
.
legendItem
);
$$
.
legendItemTextBox
[
id
]
=
$$
.
getTextRect
(
textElement
.
textContent
,
CLASS
.
legendItem
,
textElement
);
}
return
$$
.
legendItemTextBox
[
id
];
}
...
...
src/text.js
View file @
6d385be0
...
...
@@ -47,14 +47,16 @@ c3_chart_internal_fn.redrawText = function (xForText, yForText, forFlow, withTra
.
style
(
"fill-opacity"
,
forFlow
?
0
:
this
.
opacityForText
.
bind
(
this
))
];
};
c3_chart_internal_fn
.
getTextRect
=
function
(
text
,
cls
)
{
c3_chart_internal_fn
.
getTextRect
=
function
(
text
,
cls
,
element
)
{
var
dummy
=
this
.
d3
.
select
(
'body'
).
append
(
'div'
).
classed
(
'c3'
,
true
),
svg
=
dummy
.
append
(
"svg"
).
style
(
'visibility'
,
'hidden'
).
style
(
'position'
,
'fixed'
).
style
(
'top'
,
0
).
style
(
'left'
,
0
),
font
=
this
.
d3
.
select
(
element
).
style
(
'font'
),
rect
;
svg
.
selectAll
(
'.dummy'
)
.
data
([
text
])
.
enter
().
append
(
'text'
)
.
classed
(
cls
?
cls
:
""
,
true
)
.
style
(
'font'
,
font
)
.
text
(
text
)
.
each
(
function
()
{
rect
=
this
.
getBoundingClientRect
();
});
dummy
.
remove
();
...
...
src/title.js
View file @
6d385be0
...
...
@@ -13,9 +13,9 @@ c3_chart_internal_fn.redrawTitle = function () {
c3_chart_internal_fn
.
xForTitle
=
function
()
{
var
$$
=
this
,
config
=
$$
.
config
,
position
=
config
.
title_position
||
'left'
,
x
;
if
(
position
.
indexOf
(
'right'
)
>=
0
)
{
x
=
$$
.
currentWidth
-
$$
.
title
.
node
().
getBBox
(
).
width
-
config
.
title_padding
.
right
;
x
=
$$
.
currentWidth
-
$$
.
getTextRect
(
$$
.
title
.
node
().
textContent
,
$$
.
CLASS
.
title
,
$$
.
title
.
node
()
).
width
-
config
.
title_padding
.
right
;
}
else
if
(
position
.
indexOf
(
'center'
)
>=
0
)
{
x
=
(
$$
.
currentWidth
-
$$
.
title
.
node
().
getBBox
(
).
width
)
/
2
;
x
=
(
$$
.
currentWidth
-
$$
.
getTextRect
(
$$
.
title
.
node
().
textContent
,
$$
.
CLASS
.
title
,
$$
.
title
.
node
()
).
width
)
/
2
;
}
else
{
// left
x
=
config
.
title_padding
.
left
;
}
...
...
@@ -23,7 +23,7 @@ c3_chart_internal_fn.xForTitle = function () {
};
c3_chart_internal_fn
.
yForTitle
=
function
()
{
var
$$
=
this
;
return
$$
.
config
.
title_padding
.
top
+
$$
.
title
.
node
().
getBBox
(
).
height
;
return
$$
.
config
.
title_padding
.
top
+
$$
.
getTextRect
(
$$
.
title
.
node
().
textContent
,
$$
.
CLASS
.
title
,
$$
.
title
.
node
()
).
height
;
};
c3_chart_internal_fn
.
getTitlePadding
=
function
()
{
var
$$
=
this
;
...
...
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