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
c6d017dc
Commit
c6d017dc
authored
Nov 28, 2014
by
Bob Renwick
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only updateLegend when we actually want to show the legend for the first time
parent
bfffa3c4
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
0 deletions
+20
-0
c3.js
c3.js
+10
-0
c3.min.js
c3.min.js
+0
-0
legend.js
src/legend.js
+10
-0
No files found.
c3.js
View file @
c6d017dc
...
@@ -3662,13 +3662,19 @@
...
@@ -3662,13 +3662,19 @@
c3_chart_internal_fn
.
initLegend
=
function
()
{
c3_chart_internal_fn
.
initLegend
=
function
()
{
var
$$
=
this
;
var
$$
=
this
;
$$
.
legendHasRendered
=
false
;
$$
.
legend
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
getTranslate
(
'legend'
));
$$
.
legend
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
getTranslate
(
'legend'
));
if
(
!
$$
.
config
.
legend_show
)
{
if
(
!
$$
.
config
.
legend_show
)
{
$$
.
legend
.
style
(
'visibility'
,
'hidden'
);
$$
.
legend
.
style
(
'visibility'
,
'hidden'
);
$$
.
hiddenLegendIds
=
$$
.
mapToIds
(
$$
.
data
.
targets
);
$$
.
hiddenLegendIds
=
$$
.
mapToIds
(
$$
.
data
.
targets
);
return
;
}
}
// MEMO: call here to update legend box and tranlate for all
// MEMO: call here to update legend box and tranlate for all
// MEMO: translate will be upated by this, so transform not needed in updateLegend()
// MEMO: translate will be upated by this, so transform not needed in updateLegend()
$$
.
updateLegendWithDefaults
();
};
c3_chart_internal_fn
.
updateLegendWithDefaults
=
function
()
{
var
$$
=
this
;
$$
.
updateLegend
(
$$
.
mapToIds
(
$$
.
data
.
targets
),
{
withTransform
:
false
,
withTransitionForTransform
:
false
,
withTransition
:
false
});
$$
.
updateLegend
(
$$
.
mapToIds
(
$$
.
data
.
targets
),
{
withTransform
:
false
,
withTransitionForTransform
:
false
,
withTransition
:
false
});
};
};
c3_chart_internal_fn
.
updateSizeForLegend
=
function
(
legendHeight
,
legendWidth
)
{
c3_chart_internal_fn
.
updateSizeForLegend
=
function
(
legendHeight
,
legendWidth
)
{
...
@@ -3745,6 +3751,9 @@
...
@@ -3745,6 +3751,9 @@
if
(
!
config
.
legend_show
)
{
if
(
!
config
.
legend_show
)
{
config
.
legend_show
=
true
;
config
.
legend_show
=
true
;
$$
.
legend
.
style
(
'visibility'
,
'visible'
);
$$
.
legend
.
style
(
'visibility'
,
'visible'
);
if
(
!
$$
.
legendHasRendered
)
{
$$
.
updateLegendWithDefaults
();
}
}
}
$$
.
removeHiddenLegendIds
(
targetIds
);
$$
.
removeHiddenLegendIds
(
targetIds
);
$$
.
legend
.
selectAll
(
$$
.
selectorLegends
(
targetIds
))
$$
.
legend
.
selectAll
(
$$
.
selectorLegends
(
targetIds
))
...
@@ -3981,6 +3990,7 @@
...
@@ -3981,6 +3990,7 @@
$$
.
updateSvgSize
();
$$
.
updateSvgSize
();
// Update g positions
// Update g positions
$$
.
transformAll
(
withTransitionForTransform
,
transitions
);
$$
.
transformAll
(
withTransitionForTransform
,
transitions
);
$$
.
legendHasRendered
=
true
;
};
};
c3_chart_internal_fn
.
initAxis
=
function
()
{
c3_chart_internal_fn
.
initAxis
=
function
()
{
...
...
c3.min.js
View file @
c6d017dc
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/legend.js
View file @
c6d017dc
c3_chart_internal_fn
.
initLegend
=
function
()
{
c3_chart_internal_fn
.
initLegend
=
function
()
{
var
$$
=
this
;
var
$$
=
this
;
$$
.
legendHasRendered
=
false
;
$$
.
legend
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
getTranslate
(
'legend'
));
$$
.
legend
=
$$
.
svg
.
append
(
"g"
).
attr
(
"transform"
,
$$
.
getTranslate
(
'legend'
));
if
(
!
$$
.
config
.
legend_show
)
{
if
(
!
$$
.
config
.
legend_show
)
{
$$
.
legend
.
style
(
'visibility'
,
'hidden'
);
$$
.
legend
.
style
(
'visibility'
,
'hidden'
);
$$
.
hiddenLegendIds
=
$$
.
mapToIds
(
$$
.
data
.
targets
);
$$
.
hiddenLegendIds
=
$$
.
mapToIds
(
$$
.
data
.
targets
);
return
;
}
}
// MEMO: call here to update legend box and tranlate for all
// MEMO: call here to update legend box and tranlate for all
// MEMO: translate will be upated by this, so transform not needed in updateLegend()
// MEMO: translate will be upated by this, so transform not needed in updateLegend()
$$
.
updateLegendWithDefaults
();
};
c3_chart_internal_fn
.
updateLegendWithDefaults
=
function
()
{
var
$$
=
this
;
$$
.
updateLegend
(
$$
.
mapToIds
(
$$
.
data
.
targets
),
{
withTransform
:
false
,
withTransitionForTransform
:
false
,
withTransition
:
false
});
$$
.
updateLegend
(
$$
.
mapToIds
(
$$
.
data
.
targets
),
{
withTransform
:
false
,
withTransitionForTransform
:
false
,
withTransition
:
false
});
};
};
c3_chart_internal_fn
.
updateSizeForLegend
=
function
(
legendHeight
,
legendWidth
)
{
c3_chart_internal_fn
.
updateSizeForLegend
=
function
(
legendHeight
,
legendWidth
)
{
...
@@ -83,6 +89,9 @@ c3_chart_internal_fn.showLegend = function (targetIds) {
...
@@ -83,6 +89,9 @@ c3_chart_internal_fn.showLegend = function (targetIds) {
if
(
!
config
.
legend_show
)
{
if
(
!
config
.
legend_show
)
{
config
.
legend_show
=
true
;
config
.
legend_show
=
true
;
$$
.
legend
.
style
(
'visibility'
,
'visible'
);
$$
.
legend
.
style
(
'visibility'
,
'visible'
);
if
(
!
$$
.
legendHasRendered
)
{
$$
.
updateLegendWithDefaults
();
}
}
}
$$
.
removeHiddenLegendIds
(
targetIds
);
$$
.
removeHiddenLegendIds
(
targetIds
);
$$
.
legend
.
selectAll
(
$$
.
selectorLegends
(
targetIds
))
$$
.
legend
.
selectAll
(
$$
.
selectorLegends
(
targetIds
))
...
@@ -319,4 +328,5 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
...
@@ -319,4 +328,5 @@ c3_chart_internal_fn.updateLegend = function (targetIds, options, transitions) {
$$
.
updateSvgSize
();
$$
.
updateSvgSize
();
// Update g positions
// Update g positions
$$
.
transformAll
(
withTransitionForTransform
,
transitions
);
$$
.
transformAll
(
withTransitionForTransform
,
transitions
);
$$
.
legendHasRendered
=
true
;
};
};
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