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
fdcb1ab8
Commit
fdcb1ab8
authored
May 09, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bindto - #218
parent
64af0b87
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
c3.js
c3.js
+7
-6
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
fdcb1ab8
...
@@ -289,7 +289,8 @@
...
@@ -289,7 +289,8 @@
/*-- Set Variables --*/
/*-- Set Variables --*/
var
clipId
=
(
typeof
__bindto
===
"string"
?
__bindto
.
replace
(
'#'
,
''
)
:
__bindto
.
id
)
+
'-clip'
,
// 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'
,
clipIdForXAxis
=
clipId
+
'-xaxis'
,
clipIdForXAxis
=
clipId
+
'-xaxis'
,
clipIdForYAxis
=
clipId
+
'-yaxis'
,
clipIdForYAxis
=
clipId
+
'-yaxis'
,
clipPath
=
getClipPath
(
clipId
),
clipPath
=
getClipPath
(
clipId
),
...
@@ -489,7 +490,7 @@
...
@@ -489,7 +490,7 @@
var
leftAxisClass
=
__axis_rotated
?
CLASS
.
axisX
:
CLASS
.
axisY
,
var
leftAxisClass
=
__axis_rotated
?
CLASS
.
axisX
:
CLASS
.
axisY
,
leftAxis
=
main
.
select
(
'.'
+
leftAxisClass
).
node
(),
leftAxis
=
main
.
select
(
'.'
+
leftAxisClass
).
node
(),
svgRect
=
leftAxis
?
leftAxis
.
getBoundingClientRect
()
:
{
right
:
0
},
svgRect
=
leftAxis
?
leftAxis
.
getBoundingClientRect
()
:
{
right
:
0
},
chartRect
=
d3
.
select
(
__bindto
)
.
node
().
getBoundingClientRect
(),
chartRect
=
selectChart
.
node
().
getBoundingClientRect
(),
hasArc
=
hasArcType
(
c3
.
data
.
targets
),
hasArc
=
hasArcType
(
c3
.
data
.
targets
),
svgLeft
=
svgRect
.
right
-
chartRect
.
left
-
(
hasArc
?
0
:
getCurrentPaddingLeft
());
svgLeft
=
svgRect
.
right
-
chartRect
.
left
-
(
hasArc
?
0
:
getCurrentPaddingLeft
());
return
svgLeft
>
0
?
svgLeft
:
0
;
return
svgLeft
>
0
?
svgLeft
:
0
;
...
@@ -538,10 +539,10 @@
...
@@ -538,10 +539,10 @@
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
+
d3
.
select
(
__bindto
)
.
style
(
"width"
).
replace
(
'px'
,
''
);
// TODO: if rotated, use height
return
+
selectChart
.
style
(
"width"
).
replace
(
'px'
,
''
);
// TODO: if rotated, use height
}
}
function
getParentHeight
()
{
function
getParentHeight
()
{
return
+
d3
.
select
(
__bindto
)
.
style
(
'height'
).
replace
(
'px'
,
''
);
// TODO: if rotated, use width
return
+
selectChart
.
style
(
'height'
).
replace
(
'px'
,
''
);
// TODO: if rotated, use width
}
}
function
getAxisClipX
(
forHorizontal
)
{
function
getAxisClipX
(
forHorizontal
)
{
// axis line width + padding for left
// axis line width + padding for left
...
@@ -2448,7 +2449,7 @@
...
@@ -2448,7 +2449,7 @@
selectChart
=
d3
.
select
(
__bindto
);
selectChart
=
d3
.
select
(
__bindto
);
if
(
selectChart
.
empty
())
{
if
(
selectChart
.
empty
())
{
throw
new
Error
(
'
Bind element not found. Check the selector specified by "bindto" and existance of that element. Default "bindto" is "#chart".
'
);
throw
new
Error
(
'
Element to bind not found
'
);
}
}
selectChart
.
html
(
""
).
classed
(
"c3"
,
true
);
selectChart
.
html
(
""
).
classed
(
"c3"
,
true
);
...
@@ -2513,7 +2514,7 @@
...
@@ -2513,7 +2514,7 @@
}
}
// Define tooltip
// Define tooltip
tooltip
=
d3
.
select
(
__bindto
)
tooltip
=
selectChart
.
style
(
"position"
,
"relative"
)
.
style
(
"position"
,
"relative"
)
.
append
(
"div"
)
.
append
(
"div"
)
.
style
(
"position"
,
"absolute"
)
.
style
(
"position"
,
"absolute"
)
...
...
c3.min.js
View file @
fdcb1ab8
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