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
ea5581a7
Commit
ea5581a7
authored
Aug 16, 2013
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Modify class name for shapes
parent
f01dc2a2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
27 deletions
+27
-27
c3.css
c3.css
+4
-4
c3.js
c3.js
+23
-23
No files found.
c3.css
View file @
ea5581a7
...
...
@@ -28,12 +28,12 @@ text {
/*-- Line --*/
.
__
line
{
.
-
line
{
stroke-width
:
1px
;
}
/*-- Point --*/
.
__
circle._e_
{
.
-
circle._e_
{
stroke-width
:
1px
;
stroke
:
white
;
}
...
...
@@ -44,12 +44,12 @@ text {
/*-- Bar --*/
.
__
bar._e_
{
.
-
bar._e_
{
stroke-width
:
1px
;
fill-opacity
:
0.6
;
}
/* TODO: use this*/
.
__
bar._s_
{
.
-
bar._s_
{
stroke-width
:
1px
;
fill-opacity
:
0.3
;
}
...
...
c3.js
View file @
ea5581a7
...
...
@@ -496,13 +496,13 @@
function
category
(
i
)
{
return
i
<
__axis_x_categories
.
length
?
__axis_x_categories
[
i
]
:
i
;
}
function
classShapes
(
d
)
{
return
"
__shapes __
shapes-"
+
d
.
id
;
}
function
classLine
(
d
)
{
return
classShapes
(
d
)
+
"
__line __
line-"
+
d
.
id
;
}
function
classCircles
(
d
)
{
return
classShapes
(
d
)
+
"
__circles __
circles-"
+
d
.
id
;
}
function
classBars
(
d
)
{
return
classShapes
(
d
)
+
"
__bars __
bars-"
+
d
.
id
;
}
function
classShape
(
d
,
i
)
{
return
"
__shape __
shape-"
+
i
;
}
function
classCircle
(
d
,
i
)
{
return
classShape
(
d
,
i
)
+
"
__circle __
circle-"
+
i
;
}
function
classBar
(
d
,
i
)
{
return
classShape
(
d
,
i
)
+
"
__bar __
bar-"
+
i
;
}
function
classShapes
(
d
)
{
return
"
-shapes -
shapes-"
+
d
.
id
;
}
function
classLine
(
d
)
{
return
classShapes
(
d
)
+
"
-line -
line-"
+
d
.
id
;
}
function
classCircles
(
d
)
{
return
classShapes
(
d
)
+
"
-circles -
circles-"
+
d
.
id
;
}
function
classBars
(
d
)
{
return
classShapes
(
d
)
+
"
-bars -
bars-"
+
d
.
id
;
}
function
classShape
(
d
,
i
)
{
return
"
-shape -
shape-"
+
i
;
}
function
classCircle
(
d
,
i
)
{
return
classShape
(
d
,
i
)
+
"
-circle -
circle-"
+
i
;
}
function
classBar
(
d
,
i
)
{
return
classShape
(
d
,
i
)
+
"
-bar -
bar-"
+
i
;
}
function
classRegion
(
d
,
i
)
{
return
'region region-'
+
i
+
' '
+
(
'classes'
in
d
?
[].
concat
(
d
.
classes
).
join
(
' '
)
:
''
);
}
function
xx
(
d
)
{
...
...
@@ -866,13 +866,13 @@
// Expand circles if needed
if
(
__point_focus_expand_enabled
)
{
main
.
selectAll
(
'.
__
circle-'
+
i
)
main
.
selectAll
(
'.
-
circle-'
+
i
)
.
classed
(
"_e_"
,
true
)
.
attr
(
'r'
,
__point_focus_expand_r
);
}
// Expand bars
main
.
selectAll
(
".
__
bar-"
+
i
)
main
.
selectAll
(
".
-
bar-"
+
i
)
.
classed
(
"_e_"
,
true
);
// Show xgrid focus line
...
...
@@ -892,19 +892,19 @@
main
.
select
(
'line.xgrid-focus'
).
style
(
"visibility"
,
"hidden"
);
tooltip
.
style
(
"visibility"
,
"hidden"
);
// Undo expanded circles
main
.
selectAll
(
'.
__
circle-'
+
i
)
main
.
selectAll
(
'.
-
circle-'
+
i
)
.
filter
(
function
(){
return
d3
.
select
(
this
).
classed
(
'_e_'
);
})
.
classed
(
"_e_"
,
false
)
.
attr
(
'r'
,
__point_r
);
// Undo expanded bar
main
.
selectAll
(
".
__
bar-"
+
i
)
main
.
selectAll
(
".
-
bar-"
+
i
)
.
classed
(
"_e_"
,
false
);
})
.
on
(
'mousemove'
,
function
(
d
,
i
){
if
(
!
__data_selection_enabled
||
dragging
)
return
;
if
(
__data_selection_grouped
)
return
;
// nothing to do when grouped
main
.
selectAll
(
'.
__
shape-'
+
i
)
main
.
selectAll
(
'.
-
shape-'
+
i
)
.
filter
(
function
(
d
){
return
__data_selection_isselectable
(
d
);
})
.
each
(
function
(
d
){
var
_this
=
d3
.
select
(
this
).
classed
(
'_e_'
,
true
);
...
...
@@ -930,7 +930,7 @@
});
})
.
on
(
'click'
,
function
(
d
,
i
)
{
main
.
selectAll
(
'.
__
shape-'
+
i
).
each
(
function
(
d
){
main
.
selectAll
(
'.
-
shape-'
+
i
).
each
(
function
(
d
){
var
_this
=
d3
.
select
(
this
),
isSelected
=
_this
.
classed
(
'_s_'
);
var
isWithin
=
false
,
toggle
;
...
...
@@ -968,7 +968,7 @@
.
attr
(
'y'
,
minY
)
.
attr
(
'width'
,
maxX
-
minX
)
.
attr
(
'height'
,
maxY
-
minY
);
main
.
selectAll
(
'.
__shapes'
).
selectAll
(
'.__
shape'
)
main
.
selectAll
(
'.
-shapes'
).
selectAll
(
'.-
shape'
)
.
filter
(
function
(
d
){
return
__data_selection_isselectable
(
d
);
})
.
each
(
function
(
d
,
i
){
var
_this
=
d3
.
select
(
this
),
...
...
@@ -1011,7 +1011,7 @@
.
transition
().
duration
(
100
)
.
style
(
'opacity'
,
0
)
.
remove
();
main
.
selectAll
(
'.
__
shape'
)
main
.
selectAll
(
'.
-
shape'
)
.
classed
(
'_i_'
,
false
);
dragging
=
false
;
// TODO: add callback here
...
...
@@ -1184,7 +1184,7 @@
barH
=
getBarH
(
__axis_rotated
?
null
:
height
);
barX
=
getBarX
(
barW
,
barTargetsNum
,
barIndices
);
barY
=
getBarY
(
barH
,
barIndices
,
__axis_rotated
);
mainBar
=
main
.
selectAll
(
'.
__bars'
).
selectAll
(
'.__
bar'
)
mainBar
=
main
.
selectAll
(
'.
-bars'
).
selectAll
(
'.-
bar'
)
.
data
(
barData
);
mainBar
.
transition
().
duration
(
withTransition
?
250
:
0
)
.
attr
(
"x"
,
__axis_rotated
?
barY
:
barX
)
...
...
@@ -1205,10 +1205,10 @@
.
remove
();
// lines and cricles
main
.
selectAll
(
'.
__
line'
)
main
.
selectAll
(
'.
-
line'
)
.
transition
().
duration
(
withTransition
?
250
:
0
)
.
attr
(
"d"
,
lineOnMain
);
mainCircle
=
main
.
selectAll
(
'.
__circles'
).
selectAll
(
'.__
circle'
)
mainCircle
=
main
.
selectAll
(
'.
-circles'
).
selectAll
(
'.-
circle'
)
.
data
(
lineData
);
mainCircle
.
transition
().
duration
(
withTransition
?
250
:
0
)
.
attr
(
"cx"
,
__axis_rotated
?
circleY
:
circleX
)
...
...
@@ -1227,7 +1227,7 @@
barH
=
getBarH
(
height2
,
true
);
barX
=
getBarX
(
barW
,
barTargetsNum
,
barIndices
,
true
);
barY
=
getBarY
(
barH
,
barIndices
,
false
,
true
);
contextBar
=
context
.
selectAll
(
'.
__bars'
).
selectAll
(
'.__
bar'
)
contextBar
=
context
.
selectAll
(
'.
-bars'
).
selectAll
(
'.-
bar'
)
.
data
(
barData
);
contextBar
.
transition
().
duration
(
withTransition
?
250
:
0
)
.
attr
(
"x"
,
barX
).
attr
(
"y"
,
barY
).
attr
(
"width"
,
barW
).
attr
(
"height"
,
barH
);
...
...
@@ -1242,7 +1242,7 @@
.
remove
();
// lines
context
.
selectAll
(
'.
__
line'
)
context
.
selectAll
(
'.
-
line'
)
.
transition
().
duration
(
withTransition
?
250
:
0
)
.
attr
(
"d"
,
lineOnSub
);
}
...
...
@@ -1556,7 +1556,7 @@
c3
.
selected
=
function
(
target
)
{
var
suffix
=
isDefined
(
target
)
?
'-'
+
target
:
''
;
return
d3
.
merge
(
main
.
selectAll
(
'.
__shapes'
+
suffix
).
selectAll
(
'.__
shape'
)
main
.
selectAll
(
'.
-shapes'
+
suffix
).
selectAll
(
'.-
shape'
)
.
filter
(
function
(){
return
d3
.
select
(
this
).
classed
(
'_s_'
);
})
.
map
(
function
(
d
){
return
d
.
map
(
function
(
_d
){
return
_d
.
__data__
;
});
})
);
...
...
@@ -1564,7 +1564,7 @@
c3
.
select
=
function
(
ids
,
indices
,
resetOther
)
{
if
(
!
__data_selection_enabled
)
return
;
main
.
selectAll
(
'.
__shapes'
).
selectAll
(
'.__
shape'
).
each
(
function
(
d
,
i
){
main
.
selectAll
(
'.
-shapes'
).
selectAll
(
'.-
shape'
).
each
(
function
(
d
,
i
){
var
selectShape
=
(
this
.
nodeName
===
'circle'
)
?
selectPoint
:
selectBar
,
unselectShape
=
(
this
.
nodeName
===
'circle'
)
?
unselectPoint
:
unselectBar
;
if
(
indices
.
indexOf
(
i
)
>=
0
)
{
...
...
@@ -1579,7 +1579,7 @@
c3
.
unselect
=
function
(
ids
,
indices
)
{
if
(
!
__data_selection_enabled
)
return
;
main
.
selectAll
(
'.
__shapes'
).
selectAll
(
'.__
shape'
).
each
(
function
(
d
,
i
){
main
.
selectAll
(
'.
-shapes'
).
selectAll
(
'.-
shape'
).
each
(
function
(
d
,
i
){
var
unselectShape
=
(
this
.
nodeName
===
'circle'
)
?
unselectPoint
:
unselectBar
;
if
(
isUndefined
(
indices
)
||
indices
.
indexOf
(
i
)
>=
0
)
{
if
(
__data_selection_isselectable
(
d
)
&&
(
__data_selection_grouped
||
isUndefined
(
ids
)
||
ids
.
indexOf
(
d
.
id
)
>=
0
))
{
...
...
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