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
0635a52b
Commit
0635a52b
authored
May 10, 2013
by
Masayuki Tanaka
Committed by
masayuki
May 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix unload for bar
parent
80d76405
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
13 deletions
+34
-13
c3.js
c3.js
+34
-13
No files found.
c3.js
View file @
0635a52b
...
@@ -394,6 +394,18 @@
...
@@ -394,6 +394,18 @@
return
x
(
d
.
x
)
-
barWidth
*
(
barTargetsNum
/
2
-
barIndices
.
indexOf
(
d
.
i
))
return
x
(
d
.
x
)
-
barWidth
*
(
barTargetsNum
/
2
-
barIndices
.
indexOf
(
d
.
i
))
}
}
}
}
function
getBarY
(
scale
)
{
return
function
(
d
)
{
return
scale
(
d
.
value
)
}
}
function
getBarW
(
axis
,
barTargetsNum
)
{
return
(
axis
.
tickOffset
()
*
2
*
0.6
)
/
barTargetsNum
}
function
getBarH
(
scale
,
height
)
{
return
function
(
d
)
{
var
h
=
height
-
scale
(
d
.
value
)
return
h
<
0
?
0
:
h
}
}
function
isLineType
(
d
)
{
function
isLineType
(
d
)
{
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
var
id
=
(
typeof
d
===
'string'
)
?
d
:
d
.
id
return
!
(
id
in
__data_types
)
||
__data_types
[
id
]
===
'line'
return
!
(
id
in
__data_types
)
||
__data_types
[
id
]
===
'line'
...
@@ -897,7 +909,8 @@
...
@@ -897,7 +909,8 @@
function
update
(
withTransition
)
{
function
update
(
withTransition
)
{
var
xgrid
,
xgridData
,
xgridLine
var
xgrid
,
xgridData
,
xgridLine
var
mainPath
,
mainCircle
,
mainBar
,
contextPath
var
mainPath
,
mainCircle
,
mainBar
,
contextPath
var
barTargetsNum
=
getTargetsNum
(
isBarType
),
barWidth
,
barIndices
,
barX
var
barTargetsNum
=
getTargetsNum
(
isBarType
),
barIndices
=
getBarTargetIndices
()
var
barX
,
barY
,
barW
,
barH
var
rectWidth
var
rectWidth
x
.
domain
(
brush
.
empty
()
?
x2
.
domain
()
:
brush
.
extent
())
x
.
domain
(
brush
.
empty
()
?
x2
.
domain
()
:
brush
.
extent
())
...
@@ -952,20 +965,28 @@
...
@@ -952,20 +965,28 @@
.
attr
(
"cy"
,
function
(
d
)
{
return
y
(
d
.
value
)
})
.
attr
(
"cy"
,
function
(
d
)
{
return
y
(
d
.
value
)
})
// bars
// bars
barW
idth
=
(
xAxis
.
tickOffset
()
*
2
*
0.6
)
/
barTargetsNum
barW
=
getBarW
(
xAxis
,
barTargetsNum
)
bar
Indices
=
getBarTargetIndices
(
)
bar
H
=
getBarH
(
y
,
height
)
barX
=
getBarX
(
barW
idth
,
barTargetsNum
,
barIndices
)
barX
=
getBarX
(
barW
,
barTargetsNum
,
barIndices
)
barY
=
getBarY
(
y
)
mainBar
=
main
.
selectAll
(
'.target'
).
selectAll
(
'.target-bar'
).
filter
(
isBarType
)
mainBar
=
main
.
selectAll
(
'.target'
).
selectAll
(
'.target-bar'
).
filter
(
isBarType
)
if
(
withTransition
)
mainBar
=
mainBar
.
transition
()
if
(
withTransition
)
mainBar
=
mainBar
.
transition
()
mainBar
.
attr
(
"width"
,
barWidth
)
mainBar
.
attr
(
"x"
,
barX
).
attr
(
"y"
,
barY
).
attr
(
"width"
,
barW
).
attr
(
"height"
,
barH
)
.
attr
(
"x"
,
barX
)
// subchart
// subchart
if
(
__subchart_show
)
{
if
(
__subchart_show
)
{
contextPath
=
context
.
selectAll
(
'.target'
).
selectAll
(
'path'
).
filter
(
isLineType
)
contextPath
=
context
.
selectAll
(
'.target'
).
selectAll
(
'path'
).
filter
(
isLineType
)
if
(
withTransition
)
contextPath
=
contextPath
.
transition
()
if
(
withTransition
)
contextPath
=
contextPath
.
transition
()
contextPath
.
attr
(
"d"
,
function
(
d
){
return
line2
(
d
.
values
)
})
contextPath
.
attr
(
"d"
,
function
(
d
){
return
line2
(
d
.
values
)
})
// bars
barW
=
getBarW
(
xAxis2
,
barTargetsNum
)
barH
=
getBarH
(
y2
,
height2
)
barX
=
getBarX
(
barW
,
barTargetsNum
,
barIndices
)
barY
=
getBarY
(
y2
)
contextBar
=
context
.
selectAll
(
'.target'
).
selectAll
(
'.target-bar'
).
filter
(
isBarType
)
if
(
withTransition
)
contextBar
=
contextBar
.
transition
()
contextBar
.
attr
(
"x"
,
barX
).
attr
(
"y"
,
barY
).
attr
(
"width"
,
barW
).
attr
(
"height"
,
barH
)
}
}
// circles for select
// circles for select
...
@@ -1022,10 +1043,10 @@
...
@@ -1022,10 +1043,10 @@
// Rects for each data
// Rects for each data
barIndices
=
getBarTargetIndices
()
barIndices
=
getBarTargetIndices
()
barW
=
(
xAxis
.
tickOffset
()
*
2
*
0.6
)
/
barTargetsNum
barW
=
getBarW
(
xAxis
,
barTargetsNum
)
barH
=
function
(
d
){
return
height
-
y
(
d
.
value
)
}
barH
=
getBarH
(
y
,
height
)
barX
=
getBarX
(
barW
,
barTargetsNum
,
barIndices
)
barX
=
getBarX
(
barW
,
barTargetsNum
,
barIndices
)
barY
=
function
(
d
){
return
y
(
d
.
value
)
}
barY
=
getBarY
(
y
)
f
.
append
(
'g'
)
f
.
append
(
'g'
)
.
attr
(
"class"
,
function
(
d
){
return
"target-bars target-bars-"
+
d
.
id
})
.
attr
(
"class"
,
function
(
d
){
return
"target-bars target-bars-"
+
d
.
id
})
...
@@ -1088,10 +1109,10 @@
...
@@ -1088,10 +1109,10 @@
.
attr
(
"d"
,
function
(
d
){
return
line2
(
d
.
values
)
})
.
attr
(
"d"
,
function
(
d
){
return
line2
(
d
.
values
)
})
// Rects for each data
// Rects for each data
barW
=
(
xAxis2
.
tickOffset
()
*
2
*
0.6
)
/
barTargetsNum
barW
=
getBarW
(
xAxis2
,
barTargetsNum
)
barH
=
function
(
d
){
return
height2
-
y2
(
d
.
value
)
}
barH
=
getBarH
(
y2
,
height2
)
barX
=
getBarX
(
barW
,
barTargetsNum
,
barIndices
)
barX
=
getBarX
(
barW
,
barTargetsNum
,
barIndices
)
barY
=
function
(
d
){
return
y2
(
d
.
value
)
}
barY
=
getBarY
(
y2
)
c
.
append
(
'g'
)
c
.
append
(
'g'
)
.
attr
(
"class"
,
function
(
d
){
return
"target-bars target-bars-"
+
d
.
id
})
.
attr
(
"class"
,
function
(
d
){
return
"target-bars target-bars-"
+
d
.
id
})
...
...
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