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
a7e485a0
Commit
a7e485a0
authored
Jan 27, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add destory() as destructor and fix duplicated chart generation - #6
parent
bb469770
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
9 deletions
+22
-9
c3.js
c3.js
+22
-9
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
a7e485a0
...
...
@@ -903,7 +903,6 @@
var
firstDate
=
null
,
lastDate
=
null
,
orgXDomain
;
function
init
(
data
)
{
var
targets
=
c3
.
data
.
targets
=
convertDataToTargets
(
data
);
var
grid
,
xgridLine
;
var
i
;
...
...
@@ -911,8 +910,13 @@
if
(
selectChart
.
empty
())
{
window
.
alert
(
'No bind element found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".'
);
return
;
}
else
{
selectChart
.
html
(
""
);
}
c3
.
data
.
x
=
undefined
;
c3
.
data
.
targets
=
convertDataToTargets
(
data
);
// TODO: set names if names not specified
// Init sizes and scales
...
...
@@ -1326,10 +1330,10 @@
/*-- Legend Region --*/
if
(
__legend_show
)
{
updateLegend
(
targets
);
}
if
(
__legend_show
)
{
updateLegend
(
c3
.
data
.
targets
);
}
// Set targets
updateTargets
(
targets
);
updateTargets
(
c3
.
data
.
targets
);
// Draw with targets
redraw
({
withTransition
:
false
,
withUpdateXDomain
:
true
});
...
...
@@ -1338,18 +1342,23 @@
if
(
__tooltip_init_show
)
{
if
(
isTimeSeries
&&
typeof
__tooltip_init_x
===
'string'
)
{
__tooltip_init_x
=
parseDate
(
__tooltip_init_x
);
for
(
i
=
0
;
i
<
targets
[
0
].
values
.
length
;
i
++
)
{
if
((
targets
[
0
].
values
[
i
].
x
-
__tooltip_init_x
)
===
0
)
{
break
;
}
for
(
i
=
0
;
i
<
c3
.
data
.
targets
[
0
].
values
.
length
;
i
++
)
{
if
((
c3
.
data
.
targets
[
0
].
values
[
i
].
x
-
__tooltip_init_x
)
===
0
)
{
break
;
}
}
__tooltip_init_x
=
i
;
}
tooltip
.
html
(
__tooltip_contents
(
targets
.
map
(
function
(
d
)
{
tooltip
.
html
(
__tooltip_contents
(
c3
.
data
.
targets
.
map
(
function
(
d
)
{
return
addName
(
d
.
values
[
__tooltip_init_x
]);
})));
tooltip
.
style
(
"top"
,
__tooltip_init_position
.
top
)
.
style
(
"left"
,
__tooltip_init_position
.
left
)
.
style
(
"visibility"
,
"visible"
);
}
// Bind resize event
if
(
window
.
onresize
==
null
)
{
window
.
onresize
=
resize
;
}
}
function
redraw
(
options
)
{
...
...
@@ -2009,6 +2018,13 @@
return
targets
.
length
>
0
?
targets
[
0
]
:
undefined
;
};
c3
.
destroy
=
function
()
{
c3
.
data
.
targets
=
undefined
;
c3
.
data
.
x
=
undefined
;
selectChart
.
html
(
""
);
window
.
onresize
=
null
;
};
/*-- Load data and init chart with defined functions --*/
if
(
'url'
in
config
.
data
)
{
...
...
@@ -2024,9 +2040,6 @@
throw
Error
(
'url or rows or columns is required.'
);
}
// Bind resize event
window
.
onresize
=
resize
;
return
c3
;
};
...
...
c3.min.js
View file @
a7e485a0
This diff is collapsed.
Click to expand it.
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