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
cb5c0170
You need to sign in or sign up before continuing.
Commit
cb5c0170
authored
Apr 01, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix load/unload transition
parent
e8b7f734
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
57 additions
and
33 deletions
+57
-33
c3.js
c3.js
+57
-33
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
cb5c0170
...
...
@@ -1896,6 +1896,15 @@
return
Math
.
pow
(
x
(
data
.
x
)
-
pos
[
0
],
2
)
+
Math
.
pow
(
y
(
data
.
value
)
-
pos
[
1
],
2
);
}
function
endall
(
transition
,
callback
)
{
var
n
=
0
;
transition
.
each
(
function
()
{
++
n
;
})
.
each
(
"end"
,
function
()
{
if
(
!--
n
)
{
callback
.
apply
(
this
,
arguments
);
}
});
}
//-- Selection --//
function
selectPoint
(
target
,
d
,
i
)
{
...
...
@@ -3386,21 +3395,53 @@
// Redraw with new targets
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
done
();
if
(
typeof
done
===
'function'
)
{
done
();
}
}
function
unload
(
targetIds
)
{
targetIds
.
forEach
(
function
(
id
)
{
c3
.
data
.
targets
=
c3
.
data
.
targets
.
filter
(
function
(
t
)
{
return
t
.
id
!==
id
;
function
loadFromArgs
(
args
)
{
// load data
if
(
'data'
in
args
)
{
load
(
convertDataToTargets
(
args
.
data
),
args
.
done
);
}
else
if
(
'url'
in
args
)
{
d3
.
csv
(
args
.
url
,
function
(
error
,
data
)
{
load
(
convertDataToTargets
(
data
),
args
.
done
);
});
svg
.
selectAll
(
selectorTarget
(
id
))
}
else
if
(
'rows'
in
args
)
{
load
(
convertDataToTargets
(
convertRowsToData
(
args
.
rows
)),
args
.
done
);
}
else
if
(
'columns'
in
args
)
{
load
(
convertDataToTargets
(
convertColumnsToData
(
args
.
columns
)),
args
.
done
);
}
else
{
throw
Error
(
'url or rows or columns is required.'
);
}
}
function
unload
(
targetIds
,
done
)
{
if
(
typeof
done
!==
'function'
)
{
done
=
function
()
{};
}
if
(
!
targetIds
||
targetIds
.
length
===
0
)
{
done
();
return
;
}
svg
.
selectAll
(
targetIds
.
map
(
function
(
id
)
{
return
selectorTarget
(
id
);
}))
.
transition
()
.
style
(
'opacity'
,
0
)
.
remove
();
.
remove
()
.
call
(
endall
,
done
);
targetIds
.
forEach
(
function
(
id
)
{
// Reset fadein for future load
withoutFadeIn
[
id
]
=
false
;
// Remove target's elements
if
(
__legend_show
)
{
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
+
getTargetSelectorSuffix
(
id
)).
remove
();
}
// Remove target
c3
.
data
.
targets
=
c3
.
data
.
targets
.
filter
(
function
(
t
)
{
return
t
.
id
!==
id
;
});
});
}
...
...
@@ -3662,10 +3703,6 @@
};
c3
.
load
=
function
(
args
)
{
// check args
if
(
typeof
args
.
done
!==
'function'
)
{
args
.
done
=
function
()
{};
}
// update xs if exists
if
(
args
.
xs
)
{
addXs
(
args
.
xs
);
...
...
@@ -3680,33 +3717,20 @@
load
(
getCaches
(
args
.
cacheIds
),
args
.
done
);
return
;
}
// load data
if
(
'data'
in
args
)
{
load
(
convertDataToTargets
(
args
.
data
),
args
.
done
);
}
else
if
(
'url'
in
args
)
{
d3
.
csv
(
args
.
url
,
function
(
error
,
data
)
{
load
(
convertDataToTargets
(
data
),
args
.
done
);
// unload if needed
if
(
'unload'
in
args
)
{
// TODO: do not unload if target will load (included in url/rows/columns)
unload
(
args
.
unload
?
typeof
args
.
unload
===
'string'
?
[
args
.
unload
]
:
args
.
unload
:
[],
function
()
{
loadFromArgs
(
args
);
});
}
else
if
(
'rows'
in
args
)
{
load
(
convertDataToTargets
(
convertRowsToData
(
args
.
rows
)),
args
.
done
);
}
else
if
(
'columns'
in
args
)
{
load
(
convertDataToTargets
(
convertColumnsToData
(
args
.
columns
)),
args
.
done
);
}
else
{
throw
Error
(
'url or rows or columns is required.'
);
}
else
{
loadFromArgs
(
args
);
}
};
c3
.
unload
=
function
(
targetIds
)
{
// remove elements for targetId
unload
(
typeof
targetIds
===
'string'
?
[
targetIds
]
:
targetIds
);
// try redraw if targets exist
if
(
c3
.
data
.
targets
.
length
>
0
)
{
unload
(
targetIds
?
typeof
targetIds
===
'string'
?
[
targetIds
]
:
targetIds
:
getTargetIds
());
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
}
};
c3
.
selected
=
function
(
targetId
)
{
...
...
c3.min.js
View file @
cb5c0170
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