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
04deae3c
Commit
04deae3c
authored
Mar 17, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix update legend logic
parent
a880a2f8
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
15 deletions
+23
-15
c3.js
c3.js
+23
-15
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
04deae3c
...
...
@@ -388,7 +388,7 @@
//-- Scales --//
function
updateScales
()
{
var
xAxisTickFormat
,
xAxisTicks
;
var
xAxisTickFormat
,
xAxisTicks
,
forInit
=
!
x
;
// update edges
xMin
=
__axis_rotated
?
1
:
0
;
xMax
=
__axis_rotated
?
height
:
width
;
...
...
@@ -399,7 +399,7 @@
subYMin
=
__axis_rotated
?
0
:
height2
;
subYMax
=
__axis_rotated
?
width2
:
1
;
// update scales
x
=
getX
(
xMin
,
xMax
,
x
?
x
.
domain
()
:
undefined
,
function
()
{
return
xAxis
.
tickOffset
();
});
x
=
getX
(
xMin
,
xMax
,
forInit
?
undefined
:
x
.
domain
()
,
function
()
{
return
xAxis
.
tickOffset
();
});
y
=
getY
(
yMin
,
yMax
);
y2
=
getY
(
yMin
,
yMax
);
subX
=
getX
(
xMin
,
xMax
,
orgXDomain
,
function
(
d
)
{
return
d
%
1
?
0
:
subXAxis
.
tickOffset
();
});
...
...
@@ -412,6 +412,11 @@
subXAxis
=
getXAxis
(
subX
,
subXOrient
,
xAxisTickFormat
,
xAxisTicks
);
yAxis
=
getYAxis
(
y
,
yOrient
,
__axis_y_tick_format
,
__axis_y_ticks
);
yAxis2
=
getYAxis
(
y2
,
y2Orient
,
__axis_y2_tick_format
,
__axis_y2_ticks
);
// Set initialized scales to brush and zoom
if
(
!
forInit
)
{
brush
.
scale
(
subX
);
if
(
__zoom_enabled
)
{
zoom
.
scale
(
x
);
}
}
// update for arc
updateArc
();
}
...
...
@@ -2292,10 +2297,9 @@
duration
=
withTransition
?
__transition_duration
:
0
;
durationForExit
=
isDefined
(
options
.
durationForExit
)
?
options
.
durationForExit
:
duration
;
// update legend
// update legend
and transform each g
if
(
withLegend
&&
__legend_show
)
{
updateLegend
(
c3
.
data
.
targets
,
options
);
return
;
// updateAndRedraw() will be called again in updateLegend()
}
if
(
withUpdateOrgXDomain
)
{
...
...
@@ -2695,6 +2699,14 @@
};
return
callResizeFunctions
;
}
function
updateSvgSize
()
{
svg
.
attr
(
'width'
,
currentWidth
).
attr
(
'height'
,
currentHeight
);
svg
.
select
(
'#'
+
clipId
).
select
(
'rect'
).
attr
(
'width'
,
width
).
attr
(
'height'
,
height
);
svg
.
select
(
'#xaxis-clip'
).
select
(
'rect'
).
attr
(
'width'
,
getXAxisClipWidth
);
svg
.
select
(
'.zoom-rect'
).
attr
(
'width'
,
width
).
attr
(
'height'
,
height
);
}
function
updateAndRedraw
(
options
)
{
var
withTransition
,
withTransform
,
withLegend
;
options
=
isDefined
(
options
)
?
options
:
{};
...
...
@@ -2704,15 +2716,7 @@
// Update sizes and scales
updateSizes
();
updateScales
();
// Set x for brush again because of scale update
brush
.
scale
(
subX
);
// Set x for zoom again because of scale update
if
(
__zoom_enabled
)
{
zoom
.
scale
(
x
);
}
// Update sizes
svg
.
attr
(
'width'
,
currentWidth
).
attr
(
'height'
,
currentHeight
);
svg
.
select
(
'#'
+
clipId
).
select
(
'rect'
).
attr
(
'width'
,
width
).
attr
(
'height'
,
height
);
svg
.
select
(
'#xaxis-clip'
).
select
(
'rect'
).
attr
(
'width'
,
getXAxisClipWidth
);
svg
.
select
(
'.zoom-rect'
).
attr
(
'width'
,
width
).
attr
(
'height'
,
height
);
updateSvgSize
();
// Update g positions
transformAll
(
withTransition
);
// Draw with new sizes & scales
...
...
@@ -3045,8 +3049,12 @@
updateLegendItemWidth
(
maxWidth
);
updateLegendItemHeight
(
maxHeight
);
updateLegndStep
(
step
);
options
.
withLegend
=
false
;
updateAndRedraw
(
options
);
// Update size and scale
updateSizes
();
updateScales
();
updateSvgSize
();
// Update g positions
transformAll
(
false
);
}
/*-- Event Handling --*/
...
...
c3.min.js
View file @
04deae3c
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