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
154bc4c7
Commit
154bc4c7
authored
Jul 07, 2016
by
Evgeny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix issue with wrong binding to window
Remove unnecessary usage of window variable
parent
a87799de
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
51 deletions
+83
-51
c3.js
c3.js
+42
-26
c3.min.js
c3.min.js
+0
-0
api.chart.js
src/api.chart.js
+5
-2
arc.js
src/arc.js
+2
-2
core.js
src/core.js
+33
-20
tail.js
src/tail.js
+1
-1
No files found.
c3.js
View file @
154bc4c7
...
...
@@ -43,11 +43,22 @@
function
ChartInternal
(
api
)
{
var
$$
=
this
;
$$
.
d3
=
window
.
d3
?
window
.
d3
:
typeof
require
!==
'undefined'
?
require
(
"d3"
)
:
undefined
;
var
AsyncBuffer
=
window
.
AsyncBuffer
?
window
.
AsyncBuffer
:
typeof
require
!==
'undefined'
?
require
(
"async-buffer"
).
AsyncBuffer
:
undefined
;
if
(
typeof
d3
!==
'undefined'
){
$$
.
d3
=
d3
;
}
else
if
(
typeof
require
!==
'undefined'
){
$$
.
d3
=
require
(
"d3"
);
}
var
_AsyncBuffer
;
if
(
typeof
AsyncBuffer
!==
'undefined'
){
_AsyncBuffer
=
AsyncBuffer
;
}
else
if
(
typeof
require
!==
'undefined'
){
_AsyncBuffer
=
require
(
'async-buffer'
).
AsyncBuffer
;
}
$$
.
buffer
=
new
AsyncBuffer
();
$$
.
buffer
=
new
_
AsyncBuffer
();
$$
.
api
=
api
;
$$
.
config
=
$$
.
getDefaultConfig
();
$$
.
data
=
{};
...
...
@@ -388,20 +399,22 @@
});
}
// Bind resize event
if
(
window
.
onresize
==
null
)
{
window
.
onresize
=
$$
.
generateResize
();
}
if
(
window
.
onresize
.
add
)
{
window
.
onresize
.
add
(
function
()
{
config
.
onresize
.
call
(
$$
);
});
window
.
onresize
.
add
(
function
()
{
$$
.
api
.
flush
();
});
window
.
onresize
.
add
(
function
()
{
config
.
onresized
.
call
(
$$
);
});
if
(
window
){
// Bind resize event
if
(
window
.
onresize
==
null
)
{
window
.
onresize
=
$$
.
generateResize
();
}
if
(
window
.
onresize
.
add
)
{
window
.
onresize
.
add
(
function
()
{
config
.
onresize
.
call
(
$$
);
});
window
.
onresize
.
add
(
function
()
{
$$
.
api
.
flush
();
});
window
.
onresize
.
add
(
function
()
{
config
.
onresized
.
call
(
$$
);
});
}
}
// export element of the chart
...
...
@@ -987,10 +1000,10 @@
if
(
mutation
.
type
===
'childList'
&&
mutation
.
previousSibling
)
{
observer
.
disconnect
();
// need to wait for completion of load because size calculation requires the actual sizes determined after that completion
$$
.
intervalForObserveInserted
=
window
.
setInterval
(
function
()
{
$$
.
intervalForObserveInserted
=
setInterval
(
function
()
{
// parentNode will NOT be null when completed
if
(
selection
.
node
().
parentNode
)
{
window
.
clearInterval
(
$$
.
intervalForObserveInserted
);
clearInterval
(
$$
.
intervalForObserveInserted
);
$$
.
updateDimension
();
$$
.
config
.
oninit
.
call
(
$$
);
$$
.
redraw
({
...
...
@@ -1070,7 +1083,7 @@
parsedDate
=
$$
.
dataTimeFormat
(
$$
.
config
.
data_xFormat
).
parse
(
date
);
}
if
(
!
parsedDate
||
isNaN
(
+
parsedDate
))
{
window
.
console
.
error
(
"Failed to parse x '"
+
date
+
"' to Date object"
);
console
.
error
(
"Failed to parse x '"
+
date
+
"' to Date object"
);
}
return
parsedDate
;
};
...
...
@@ -4926,7 +4939,7 @@
// $$.getAxisData should be injected by ed3
// If it's not, it's either that c3 is running in test enviroment
// or some error
accu
red
// or some error
occur
red
if
(
$$
.
getAxisData
){
if
(
$$
.
config
.
is_xy
){
sizesX
=
$$
.
getAbscissa
(
$$
.
config
.
ed3Type
,
minmax
.
minX
,
minmax
.
maxX
);
...
...
@@ -5292,9 +5305,9 @@
// MEMO: avoid to cancel transition
if
(
$$
.
transiting
)
{
interval
=
window
.
setInterval
(
function
()
{
interval
=
setInterval
(
function
()
{
if
(
!
$$
.
transiting
)
{
window
.
clearInterval
(
interval
);
clearInterval
(
interval
);
if
(
$$
.
legend
.
selectAll
(
'.c3-legend-item-focused'
).
size
()
>
0
)
{
$$
.
expandArc
(
targetIds
);
}
...
...
@@ -7895,8 +7908,11 @@
c3_chart_fn
.
destroy
=
function
()
{
var
$$
=
this
.
internal
;
window
.
clearInterval
(
$$
.
intervalForObserveInserted
);
window
.
onresize
=
null
;
clearInterval
(
$$
.
intervalForObserveInserted
);
if
(
window
){
window
.
onresize
=
null
;
}
$$
.
selectChart
.
classed
(
'c3'
,
false
).
html
(
""
);
...
...
@@ -8328,4 +8344,4 @@
window
.
c3
=
c3
;
}
})(
this
);
})(
window
);
c3.min.js
View file @
154bc4c7
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/api.chart.js
View file @
154bc4c7
...
...
@@ -31,8 +31,11 @@ c3_chart_fn.flush = function () {
c3_chart_fn
.
destroy
=
function
()
{
var
$$
=
this
.
internal
;
window
.
clearInterval
(
$$
.
intervalForObserveInserted
);
window
.
onresize
=
null
;
clearInterval
(
$$
.
intervalForObserveInserted
);
if
(
window
){
window
.
onresize
=
null
;
}
$$
.
selectChart
.
classed
(
'c3'
,
false
).
html
(
""
);
...
...
src/arc.js
View file @
154bc4c7
...
...
@@ -138,9 +138,9 @@ c3_chart_internal_fn.expandArc = function (targetIds) {
// MEMO: avoid to cancel transition
if
(
$$
.
transiting
)
{
interval
=
window
.
setInterval
(
function
()
{
interval
=
setInterval
(
function
()
{
if
(
!
$$
.
transiting
)
{
window
.
clearInterval
(
interval
);
clearInterval
(
interval
);
if
(
$$
.
legend
.
selectAll
(
'.c3-legend-item-focused'
).
size
()
>
0
)
{
$$
.
expandArc
(
targetIds
);
}
...
...
src/core.js
View file @
154bc4c7
...
...
@@ -38,11 +38,22 @@ function Chart(config) {
function
ChartInternal
(
api
)
{
var
$$
=
this
;
$$
.
d3
=
window
.
d3
?
window
.
d3
:
typeof
require
!==
'undefined'
?
require
(
"d3"
)
:
undefined
;
var
AsyncBuffer
=
window
.
AsyncBuffer
?
window
.
AsyncBuffer
:
typeof
require
!==
'undefined'
?
require
(
"async-buffer"
).
AsyncBuffer
:
undefined
;
if
(
typeof
d3
!==
'undefined'
){
$$
.
d3
=
d3
;
}
else
if
(
typeof
require
!==
'undefined'
){
$$
.
d3
=
require
(
"d3"
);
}
var
_AsyncBuffer
;
if
(
typeof
AsyncBuffer
!==
'undefined'
){
_AsyncBuffer
=
AsyncBuffer
;
}
else
if
(
typeof
require
!==
'undefined'
){
_AsyncBuffer
=
require
(
'async-buffer'
).
AsyncBuffer
;
}
$$
.
buffer
=
new
AsyncBuffer
();
$$
.
buffer
=
new
_
AsyncBuffer
();
$$
.
api
=
api
;
$$
.
config
=
$$
.
getDefaultConfig
();
$$
.
data
=
{};
...
...
@@ -383,20 +394,22 @@ c3_chart_internal_fn.initWithData = function (data) {
});
}
// Bind resize event
if
(
window
.
onresize
==
null
)
{
window
.
onresize
=
$$
.
generateResize
();
}
if
(
window
.
onresize
.
add
)
{
window
.
onresize
.
add
(
function
()
{
config
.
onresize
.
call
(
$$
);
});
window
.
onresize
.
add
(
function
()
{
$$
.
api
.
flush
();
});
window
.
onresize
.
add
(
function
()
{
config
.
onresized
.
call
(
$$
);
});
if
(
window
){
// Bind resize event
if
(
window
.
onresize
==
null
)
{
window
.
onresize
=
$$
.
generateResize
();
}
if
(
window
.
onresize
.
add
)
{
window
.
onresize
.
add
(
function
()
{
config
.
onresize
.
call
(
$$
);
});
window
.
onresize
.
add
(
function
()
{
$$
.
api
.
flush
();
});
window
.
onresize
.
add
(
function
()
{
config
.
onresized
.
call
(
$$
);
});
}
}
// export element of the chart
...
...
@@ -982,10 +995,10 @@ c3_chart_internal_fn.observeInserted = function (selection) {
if
(
mutation
.
type
===
'childList'
&&
mutation
.
previousSibling
)
{
observer
.
disconnect
();
// need to wait for completion of load because size calculation requires the actual sizes determined after that completion
$$
.
intervalForObserveInserted
=
window
.
setInterval
(
function
()
{
$$
.
intervalForObserveInserted
=
setInterval
(
function
()
{
// parentNode will NOT be null when completed
if
(
selection
.
node
().
parentNode
)
{
window
.
clearInterval
(
$$
.
intervalForObserveInserted
);
clearInterval
(
$$
.
intervalForObserveInserted
);
$$
.
updateDimension
();
$$
.
config
.
oninit
.
call
(
$$
);
$$
.
redraw
({
...
...
@@ -1065,7 +1078,7 @@ c3_chart_internal_fn.parseDate = function (date) {
parsedDate
=
$$
.
dataTimeFormat
(
$$
.
config
.
data_xFormat
).
parse
(
date
);
}
if
(
!
parsedDate
||
isNaN
(
+
parsedDate
))
{
window
.
console
.
error
(
"Failed to parse x '"
+
date
+
"' to Date object"
);
console
.
error
(
"Failed to parse x '"
+
date
+
"' to Date object"
);
}
return
parsedDate
;
};
...
...
src/tail.js
View file @
154bc4c7
...
...
@@ -6,4 +6,4 @@
window
.
c3
=
c3
;
}
})(
this
);
})(
window
);
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