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
c4ee971a
Commit
c4ee971a
authored
May 10, 2013
by
Masayuki Tanaka
Committed by
masayuki
May 10, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix ygrid
parent
d05252ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
13 deletions
+30
-13
c3.js
c3.js
+30
-13
No files found.
c3.js
View file @
c4ee971a
...
...
@@ -562,7 +562,7 @@
function
init
(
data
)
{
var
targets
=
c3
.
data
.
targets
=
convertDataToTargets
(
data
)
var
rectWidth
var
grid
,
xgridLine
,
yGridData
var
grid
,
xgridLine
// TODO: set names if names not specified
...
...
@@ -614,11 +614,10 @@
// Y-Grid
if
(
__grid_y_show
)
{
yGridData
=
y
.
ticks
(
10
)
grid
.
append
(
'g'
)
.
attr
(
'class'
,
'ygrid'
)
.
selectAll
(
"
line
.ygrid"
)
.
data
(
y
GridData
)
.
attr
(
'class'
,
'ygrid
s
'
)
.
selectAll
(
".ygrid"
)
.
data
(
y
.
ticks
(
10
)
)
.
enter
().
append
(
"line"
)
.
attr
(
"class"
,
"ygrid"
)
.
attr
(
"x1"
,
0
)
...
...
@@ -629,10 +628,10 @@
if
(
__grid_y_lines
)
{
grid
.
append
(
'g'
)
.
attr
(
'class'
,
'ygrid-lines'
)
.
selectAll
(
'
line.y
'
)
.
selectAll
(
'
ygrid-line
'
)
.
data
(
__grid_y_lines
)
.
enter
().
append
(
'line'
)
.
attr
(
"class"
,
function
(
d
){
return
"y "
+
d
[
'class'
]
})
.
attr
(
"class"
,
function
(
d
){
return
"y
grid-line
"
+
d
[
'class'
]
})
.
attr
(
"x1"
,
0
)
.
attr
(
"x2"
,
width
)
.
attr
(
"y1"
,
function
(
d
){
return
y
(
d
.
value
)
})
...
...
@@ -912,7 +911,7 @@
draw
(
targets
)
}
function
update
(
withTransition
)
{
function
update
(
withTransition
,
withY
)
{
var
xgrid
,
xgridData
,
xgridLine
var
mainPath
,
mainCircle
,
mainBar
,
contextPath
var
barTargetsNum
=
getTargetsNum
(
isBarType
),
barIndices
=
getBarTargetIndices
()
...
...
@@ -940,13 +939,9 @@
xgrid
=
main
.
select
(
'g.xgrid'
).
selectAll
(
"line.xgrid"
)
.
data
(
xgridData
)
// Enter
xgrid
.
enter
().
append
(
'line'
).
attr
(
"class"
,
"xgrid"
)
// Exit
xgrid
.
exit
().
remove
()
// Update
main
.
selectAll
(
"line.xgrid"
)
.
attr
(
"class"
,
"xgrid"
)
.
attr
(
"x1"
,
x
)
.
attr
(
"x2"
,
x
)
.
attr
(
"y1"
,
margin
.
top
)
...
...
@@ -960,6 +955,26 @@
xgridLine
.
selectAll
(
'text'
)
.
attr
(
"x"
,
function
(
d
){
return
x
(
d
.
value
)
})
}
// Y-Grid
if
(
__grid_y_show
&&
withY
)
{
ygrid
=
main
.
select
(
'.ygrids'
).
selectAll
(
".ygrid"
)
.
data
(
y
.
ticks
(
10
))
ygrid
.
enter
().
append
(
'line'
)
.
attr
(
'class'
,
'ygrid'
)
ygrid
.
attr
(
"x1"
,
0
)
.
attr
(
"x2"
,
width
)
.
attr
(
"y1"
,
y
)
.
attr
(
"y2"
,
y
)
.
attr
(
"opacity"
,
0
)
.
transition
()
.
attr
(
"opacity"
,
1
)
ygrid
.
exit
().
remove
()
}
if
(
__grid_y_lines
&&
withY
)
{
main
.
select
(
'.ygrid-lines'
).
selectAll
(
'.ygrid-line'
)
.
attr
(
"y1"
,
function
(
d
){
return
y
(
d
.
value
)
})
.
attr
(
"y2"
,
function
(
d
){
return
y
(
d
.
value
)
})
}
// lines and cricles
mainPath
=
main
.
selectAll
(
'.target'
).
selectAll
(
'.target-line'
).
filter
(
isLineType
)
...
...
@@ -1186,6 +1201,8 @@
main
.
select
(
'.y.axis'
).
transition
().
call
(
yAxis
)
}
update
(
true
,
true
)
draw
(
c3
.
data
.
targets
)
done
()
...
...
@@ -1358,7 +1375,7 @@
main
.
select
(
'.y.axis'
).
transition
().
call
(
yAxis
)
}
if
(
c3
.
data
.
targets
.
length
>
0
)
update
(
true
)
if
(
c3
.
data
.
targets
.
length
>
0
)
update
(
true
,
true
)
}
c3
.
selected
=
function
(
target
)
{
...
...
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