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
d8a15b9e
You need to sign in or sign up before continuing.
Commit
d8a15b9e
authored
Nov 16, 2015
by
Evgeny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with 1 header
parent
3a69bf7c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
4 deletions
+12
-4
c3.js
c3.js
+6
-2
legend.js
src/legend.js
+6
-2
No files found.
c3.js
View file @
d8a15b9e
...
@@ -4165,6 +4165,10 @@
...
@@ -4165,6 +4165,10 @@
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
withTransitionForTransform
=
getOption
(
options
,
"withTransitionForTransform"
,
true
);
withTransitionForTransform
=
getOption
(
options
,
"withTransitionForTransform"
,
true
);
function
legendText
(
id
){
return
isDefined
(
config
.
data_names
[
id
])
?
config
.
data_names
[
id
]
:
isDefined
(
config
.
data_names
.
id
)
?
config
.
data_names
.
id
:
id
;
}
function
getTextBox
(
textElement
,
id
)
{
function
getTextBox
(
textElement
,
id
)
{
if
(
!
legendItemTextBox
[
id
])
{
if
(
!
legendItemTextBox
[
id
])
{
legendItemTextBox
[
id
]
=
$$
.
getTextRect
(
textElement
.
textContent
,
CLASS
.
legendItem
);
legendItemTextBox
[
id
]
=
$$
.
getTextRect
(
textElement
.
textContent
,
CLASS
.
legendItem
);
...
@@ -4290,7 +4294,7 @@
...
@@ -4290,7 +4294,7 @@
}
}
});
});
l
.
append
(
'text'
)
l
.
append
(
'text'
)
.
text
(
function
(
id
)
{
return
isDefined
(
config
.
data_names
[
id
])
?
config
.
data_names
[
id
]
:
id
;
}
)
.
text
(
legendText
)
.
each
(
function
(
id
,
i
)
{
updatePositions
(
this
,
id
,
i
);
})
.
each
(
function
(
id
,
i
)
{
updatePositions
(
this
,
id
,
i
);
})
.
style
(
"pointer-events"
,
"none"
)
.
style
(
"pointer-events"
,
"none"
)
.
attr
(
'x'
,
$$
.
isLegendRight
||
$$
.
isLegendInset
?
xForLegendText
:
-
200
)
.
attr
(
'x'
,
$$
.
isLegendRight
||
$$
.
isLegendInset
?
xForLegendText
:
-
200
)
...
@@ -4319,7 +4323,7 @@
...
@@ -4319,7 +4323,7 @@
texts
=
$$
.
legend
.
selectAll
(
'text'
)
texts
=
$$
.
legend
.
selectAll
(
'text'
)
.
data
(
targetIds
)
.
data
(
targetIds
)
.
text
(
function
(
id
)
{
return
isDefined
(
config
.
data_names
[
id
])
?
config
.
data_names
[
id
]
:
id
;
}
)
// MEMO: needed for update
.
text
(
legendText
)
// MEMO: needed for update
.
each
(
function
(
id
,
i
)
{
updatePositions
(
this
,
id
,
i
);
});
.
each
(
function
(
id
,
i
)
{
updatePositions
(
this
,
id
,
i
);
});
(
withTransition
?
texts
.
transition
()
:
texts
)
(
withTransition
?
texts
.
transition
()
:
texts
)
.
attr
(
'x'
,
xForLegendText
)
.
attr
(
'x'
,
xForLegendText
)
...
...
src/legend.js
View file @
d8a15b9e
...
@@ -124,6 +124,10 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
...
@@ -124,6 +124,10 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
withTransitionForTransform
=
getOption
(
options
,
"withTransitionForTransform"
,
true
);
withTransitionForTransform
=
getOption
(
options
,
"withTransitionForTransform"
,
true
);
function
legendText
(
id
){
return
isDefined
(
config
.
data_names
[
id
])
?
config
.
data_names
[
id
]
:
isDefined
(
config
.
data_names
.
id
)
?
config
.
data_names
.
id
:
id
;
}
function
getTextBox
(
textElement
,
id
)
{
function
getTextBox
(
textElement
,
id
)
{
if
(
!
legendItemTextBox
[
id
])
{
if
(
!
legendItemTextBox
[
id
])
{
legendItemTextBox
[
id
]
=
$$
.
getTextRect
(
textElement
.
textContent
,
CLASS
.
legendItem
);
legendItemTextBox
[
id
]
=
$$
.
getTextRect
(
textElement
.
textContent
,
CLASS
.
legendItem
);
...
@@ -249,7 +253,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
...
@@ -249,7 +253,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
}
}
});
});
l
.
append
(
'text'
)
l
.
append
(
'text'
)
.
text
(
function
(
id
)
{
return
isDefined
(
config
.
data_names
[
id
])
?
config
.
data_names
[
id
]
:
id
;
}
)
.
text
(
legendText
)
.
each
(
function
(
id
,
i
)
{
updatePositions
(
this
,
id
,
i
);
})
.
each
(
function
(
id
,
i
)
{
updatePositions
(
this
,
id
,
i
);
})
.
style
(
"pointer-events"
,
"none"
)
.
style
(
"pointer-events"
,
"none"
)
.
attr
(
'x'
,
$$
.
isLegendRight
||
$$
.
isLegendInset
?
xForLegendText
:
-
200
)
.
attr
(
'x'
,
$$
.
isLegendRight
||
$$
.
isLegendInset
?
xForLegendText
:
-
200
)
...
@@ -278,7 +282,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
...
@@ -278,7 +282,7 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
texts
=
$$
.
legend
.
selectAll
(
'text'
)
texts
=
$$
.
legend
.
selectAll
(
'text'
)
.
data
(
targetIds
)
.
data
(
targetIds
)
.
text
(
function
(
id
)
{
return
isDefined
(
config
.
data_names
[
id
])
?
config
.
data_names
[
id
]
:
id
;
}
)
// MEMO: needed for update
.
text
(
legendText
)
// MEMO: needed for update
.
each
(
function
(
id
,
i
)
{
updatePositions
(
this
,
id
,
i
);
});
.
each
(
function
(
id
,
i
)
{
updatePositions
(
this
,
id
,
i
);
});
(
withTransition
?
texts
.
transition
()
:
texts
)
(
withTransition
?
texts
.
transition
()
:
texts
)
.
attr
(
'x'
,
xForLegendText
)
.
attr
(
'x'
,
xForLegendText
)
...
...
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