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
a977ffdc
Commit
a977ffdc
authored
May 10, 2013
by
Masayuki Tanaka
Committed by
masayuki
May 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bar x position when unloaded
parent
ce7969ed
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
c3.js
c3.js
+7
-5
No files found.
c3.js
View file @
a977ffdc
...
...
@@ -350,7 +350,7 @@
}
function
convertDataToTargets
(
data
)
{
var
ids
=
d3
.
keys
(
data
[
0
]).
filter
(
function
(
key
){
return
key
!==
__data_x
})
var
targets
,
currentTargetsNum
=
getTargetsNum
(),
i
=
0
var
targets
,
i
=
0
data
.
forEach
(
function
(
d
)
{
d
.
x
=
(
isTimeSeries
)
?
parseDate
(
d
[
__data_x
])
:
i
++
...
...
@@ -364,7 +364,7 @@
id
:
convertedId
,
id_org
:
id
,
values
:
data
.
map
(
function
(
d
)
{
return
{
x
:
d
.
x
,
value
:
+
d
[
id
],
id
:
convertedId
,
i
:
currentTargetsNum
+
i
}
return
{
x
:
d
.
x
,
value
:
+
d
[
id
],
id
:
convertedId
}
})
}
})
...
...
@@ -401,17 +401,18 @@
//-- Bar --//
function
getBarTargetIndices
()
{
var
indices
=
[]
var
indices
=
{},
i
=
0
c3
.
data
.
targets
.
forEach
(
function
(
d
,
i
)
{
if
(
isBarType
(
d
))
{
indices
.
push
(
i
)
indices
[
d
.
id
]
=
i
++
}
})
return
indices
}
function
getBarX
(
scale
,
barWidth
,
barTargetsNum
,
barIndices
)
{
return
function
(
d
)
{
return
scale
(
d
.
x
)
-
barWidth
*
(
barTargetsNum
/
2
-
barIndices
.
indexOf
(
d
.
i
))
var
barIndex
=
d
.
id
in
barIndices
?
barIndices
[
d
.
id
]
:
0
return
scale
(
d
.
x
)
-
barWidth
*
(
barTargetsNum
/
2
-
barIndex
)
}
}
function
getBarY
(
scale
)
{
...
...
@@ -1107,6 +1108,7 @@
.
attr
(
"class"
,
function
(
d
){
return
"target-bars target-bars-"
+
d
.
id
})
.
style
(
"fill"
,
function
(
d
){
return
color
(
d
.
id
)
})
.
style
(
"stroke"
,
function
(
d
){
return
color
(
d
.
id
)
})
.
style
(
"stroke-width"
,
0
)
.
style
(
"cursor"
,
function
(
d
){
return
__data_selection_isselectable
(
d
)
?
"pointer"
:
null
})
/*-- Context --*/
...
...
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