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
b0fd1b78
Commit
b0fd1b78
authored
Nov 08, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix legend background for inset - #326
parent
76fbe57a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
14 deletions
+26
-14
c3.js
c3.js
+13
-7
c3.min.js
c3.min.js
+0
-0
clip.js
src/clip.js
+1
-1
legend.js
src/legend.js
+12
-6
No files found.
c3.js
View file @
b0fd1b78
...
...
@@ -3712,7 +3712,7 @@
var
l
,
totalLength
=
0
,
offsets
=
{},
widths
=
{},
heights
=
{},
margins
=
[
0
],
steps
=
{},
step
=
0
;
var
withTransition
,
withTransitionForTransform
;
var
hasFocused
=
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItemFocused
).
size
();
var
texts
,
rects
,
tiles
;
var
texts
,
rects
,
tiles
,
background
;
options
=
options
||
{};
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
...
...
@@ -3854,13 +3854,13 @@
.
attr
(
'y'
,
$$
.
isLegendRight
||
$$
.
isLegendInset
?
-
200
:
yForLegend
)
.
attr
(
'width'
,
10
)
.
attr
(
'height'
,
10
);
// Set background for inset legend
if
(
$$
.
isLegendInset
&&
maxWidth
!==
0
)
{
$$
.
legend
.
insert
(
'g'
,
'.'
+
CLASS
.
legendItem
)
background
=
$$
.
legend
.
select
(
'.'
+
CLASS
.
legendBackground
+
' rect'
);
if
(
$$
.
isLegendInset
&&
maxWidth
>
0
&&
background
.
size
()
===
0
)
{
background
=
$$
.
legend
.
insert
(
'g'
,
'.'
+
CLASS
.
legendItem
)
.
attr
(
"class"
,
CLASS
.
legendBackground
)
.
append
(
'rect'
)
.
attr
(
'height'
,
$$
.
getLegendHeight
()
-
12
)
.
attr
(
'width'
,
maxWidth
*
(
step
+
1
)
+
10
);
.
append
(
'rect'
);
}
texts
=
$$
.
legend
.
selectAll
(
'text'
)
...
...
@@ -3886,6 +3886,12 @@
.
attr
(
'x'
,
xForLegend
)
.
attr
(
'y'
,
yForLegend
);
if
(
background
)
{
(
withTransition
?
background
.
transition
()
:
background
)
.
attr
(
'height'
,
$$
.
getLegendHeight
()
-
12
)
.
attr
(
'width'
,
maxWidth
*
(
step
+
1
)
+
10
);
}
// toggle legend state
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
)
.
classed
(
CLASS
.
legendItemHidden
,
function
(
id
)
{
return
!
$$
.
isTargetToShow
(
id
);
})
...
...
@@ -4288,7 +4294,7 @@
return
forHorizontal
?
-
(
1
+
left
)
:
-
(
left
-
1
);
};
c3_chart_internal_fn
.
getAxisClipY
=
function
(
forHorizontal
)
{
return
forHorizontal
?
-
2
0
:
-
4
;
return
forHorizontal
?
-
1
0
:
-
4
;
};
c3_chart_internal_fn
.
getXAxisClipX
=
function
()
{
var
$$
=
this
;
...
...
c3.min.js
View file @
b0fd1b78
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/clip.js
View file @
b0fd1b78
...
...
@@ -11,7 +11,7 @@ c3_chart_internal_fn.getAxisClipX = function (forHorizontal) {
return
forHorizontal
?
-
(
1
+
left
)
:
-
(
left
-
1
);
};
c3_chart_internal_fn
.
getAxisClipY
=
function
(
forHorizontal
)
{
return
forHorizontal
?
-
2
0
:
-
4
;
return
forHorizontal
?
-
1
0
:
-
4
;
};
c3_chart_internal_fn
.
getXAxisClipX
=
function
()
{
var
$$
=
this
;
...
...
src/legend.js
View file @
b0fd1b78
...
...
@@ -107,7 +107,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
var
l
,
totalLength
=
0
,
offsets
=
{},
widths
=
{},
heights
=
{},
margins
=
[
0
],
steps
=
{},
step
=
0
;
var
withTransition
,
withTransitionForTransform
;
var
hasFocused
=
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItemFocused
).
size
();
var
texts
,
rects
,
tiles
;
var
texts
,
rects
,
tiles
,
background
;
options
=
options
||
{};
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
...
...
@@ -249,13 +249,13 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
.
attr
(
'y'
,
$$
.
isLegendRight
||
$$
.
isLegendInset
?
-
200
:
yForLegend
)
.
attr
(
'width'
,
10
)
.
attr
(
'height'
,
10
);
// Set background for inset legend
if
(
$$
.
isLegendInset
&&
maxWidth
!==
0
)
{
$$
.
legend
.
insert
(
'g'
,
'.'
+
CLASS
.
legendItem
)
background
=
$$
.
legend
.
select
(
'.'
+
CLASS
.
legendBackground
+
' rect'
);
if
(
$$
.
isLegendInset
&&
maxWidth
>
0
&&
background
.
size
()
===
0
)
{
background
=
$$
.
legend
.
insert
(
'g'
,
'.'
+
CLASS
.
legendItem
)
.
attr
(
"class"
,
CLASS
.
legendBackground
)
.
append
(
'rect'
)
.
attr
(
'height'
,
$$
.
getLegendHeight
()
-
12
)
.
attr
(
'width'
,
maxWidth
*
(
step
+
1
)
+
10
);
.
append
(
'rect'
);
}
texts
=
$$
.
legend
.
selectAll
(
'text'
)
...
...
@@ -281,6 +281,12 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
.
attr
(
'x'
,
xForLegend
)
.
attr
(
'y'
,
yForLegend
);
if
(
background
)
{
(
withTransition
?
background
.
transition
()
:
background
)
.
attr
(
'height'
,
$$
.
getLegendHeight
()
-
12
)
.
attr
(
'width'
,
maxWidth
*
(
step
+
1
)
+
10
);
}
// toggle legend state
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
)
.
classed
(
CLASS
.
legendItemHidden
,
function
(
id
)
{
return
!
$$
.
isTargetToShow
(
id
);
})
...
...
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