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
efa89499
Commit
efa89499
authored
May 18, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable to get element without bindto - #208
parent
229be613
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
5 deletions
+33
-5
c3.js
c3.js
+33
-5
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
efa89499
...
@@ -292,7 +292,7 @@
...
@@ -292,7 +292,7 @@
/*-- Set Variables --*/
/*-- Set Variables --*/
// MEMO: clipId needs to be unique because it conflicts when multiple charts exist
// MEMO: clipId needs to be unique because it conflicts when multiple charts exist
var
clipId
=
(
typeof
__bindto
===
"string"
?
__bindto
.
replace
(
/
[
# .>~+
]
/g
,
''
)
:
CLASS
.
chart
+
(
+
new
Date
()))
+
'-clip'
,
var
clipId
=
"c3-"
+
(
+
new
Date
())
+
'-clip'
,
clipIdForXAxis
=
clipId
+
'-xaxis'
,
clipIdForXAxis
=
clipId
+
'-xaxis'
,
clipIdForYAxis
=
clipId
+
'-yaxis'
,
clipIdForYAxis
=
clipId
+
'-yaxis'
,
clipPath
=
getClipPath
(
clipId
),
clipPath
=
getClipPath
(
clipId
),
...
@@ -542,10 +542,12 @@
...
@@ -542,10 +542,12 @@
return
(
getAxisLabelPositionById
(
axisId
).
isInner
?
30
:
40
)
+
(
axisId
===
'y2'
?
-
10
:
0
);
return
(
getAxisLabelPositionById
(
axisId
).
isInner
?
30
:
40
)
+
(
axisId
===
'y2'
?
-
10
:
0
);
}
}
function
getParentWidth
()
{
function
getParentWidth
()
{
return
+
selectChart
.
style
(
"width"
).
replace
(
'px'
,
''
);
// TODO: if rotated, use height
var
w
=
selectChart
.
style
(
"width"
);
return
w
.
indexOf
(
'px'
)
>
0
?
+
w
.
replace
(
'px'
,
''
)
:
0
;
}
}
function
getParentHeight
()
{
function
getParentHeight
()
{
return
+
selectChart
.
style
(
'height'
).
replace
(
'px'
,
''
);
// TODO: if rotated, use width
var
h
=
selectChart
.
style
(
'height'
);
return
h
.
indexOf
(
'px'
)
>
0
?
+
h
.
replace
(
'px'
,
''
)
:
0
;
}
}
function
getAxisClipX
(
forHorizontal
)
{
function
getAxisClipX
(
forHorizontal
)
{
// axis line width + padding for left
// axis line width + padding for left
...
@@ -2451,12 +2453,34 @@
...
@@ -2451,12 +2453,34 @@
// for save value
// for save value
var
orgAreaOpacity
,
withoutFadeIn
=
{};
var
orgAreaOpacity
,
withoutFadeIn
=
{};
function
observeInserted
(
selection
)
{
var
observer
=
new
MutationObserver
(
function
(
mutations
)
{
mutations
.
forEach
(
function
(
mutation
)
{
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
var
interval
=
window
.
setInterval
(
function
()
{
// parentNode will NOT be null when completed
if
(
selection
.
node
().
parentNode
)
{
window
.
clearInterval
(
interval
);
redraw
({
withUpdateTranslate
:
true
,
withTransform
:
true
,
withUpdateXDomain
:
true
,
withUpdateOrgXDomain
:
true
,
withTransition
:
false
,
withLegend
:
true
});
selection
.
transition
().
style
(
'opacity'
,
1
);
}
},
10
);
}
});
});
observer
.
observe
(
selection
.
node
(),
{
attributes
:
true
,
childList
:
true
,
characterData
:
true
});
}
function
init
(
data
)
{
function
init
(
data
)
{
var
eventRect
,
grid
,
i
;
var
eventRect
,
grid
,
i
,
binding
=
true
;
selectChart
=
d3
.
select
(
__bindto
);
selectChart
=
d3
.
select
(
__bindto
);
if
(
selectChart
.
empty
())
{
if
(
selectChart
.
empty
())
{
throw
new
Error
(
'Element to bind not found'
);
selectChart
=
d3
.
select
(
document
.
createElement
(
'div'
)).
style
(
'opacity'
,
0
);
observeInserted
(
selectChart
);
binding
=
false
;
}
}
selectChart
.
html
(
""
).
classed
(
"c3"
,
true
);
selectChart
.
html
(
""
).
classed
(
"c3"
,
true
);
...
@@ -2680,7 +2704,9 @@
...
@@ -2680,7 +2704,9 @@
updateTargets
(
c3
.
data
.
targets
);
updateTargets
(
c3
.
data
.
targets
);
// Draw with targets
// Draw with targets
if
(
binding
)
{
redraw
({
withUpdateTranslate
:
true
,
withTransform
:
true
,
withUpdateXDomain
:
true
,
withUpdateOrgXDomain
:
true
,
withTransitionForAxis
:
false
});
redraw
({
withUpdateTranslate
:
true
,
withTransform
:
true
,
withUpdateXDomain
:
true
,
withUpdateOrgXDomain
:
true
,
withTransitionForAxis
:
false
});
}
// Show tooltip if needed
// Show tooltip if needed
if
(
__tooltip_init_show
)
{
if
(
__tooltip_init_show
)
{
...
@@ -4540,6 +4566,8 @@
...
@@ -4540,6 +4566,8 @@
throw
Error
(
'url or rows or columns is required.'
);
throw
Error
(
'url or rows or columns is required.'
);
}
}
c3
.
element
=
selectChart
.
node
();
return
c3
;
return
c3
;
};
};
...
...
c3.min.js
View file @
efa89499
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