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
Evgeny
c3-closed
Commits
8c9ca3ce
Commit
8c9ca3ce
authored
Feb 03, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bugs
parent
0e32fc0d
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
31 deletions
+54
-31
c3.js
c3.js
+54
-31
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
8c9ca3ce
...
...
@@ -673,6 +673,9 @@
)))
.
style
(
"visibility"
,
"visible"
);
}
function
hideTooltip
()
{
tooltip
.
style
(
"display"
,
"none"
);
}
function
showXGridFocus
(
data
)
{
main
.
selectAll
(
'line.xgrid-focus'
)
...
...
@@ -681,6 +684,9 @@
.
attr
(
__axis_rotated
?
'y1'
:
'x1'
,
xx
)
.
attr
(
__axis_rotated
?
'y2'
:
'x2'
,
xx
);
}
function
hideXGridFocus
()
{
main
.
select
(
'line.xgrid-focus'
).
style
(
"visibility"
,
"hidden"
);
}
//-- Circle --//
...
...
@@ -734,14 +740,14 @@
function
getBarW
(
axis
,
barTargetsNum
,
isSub
)
{
var
barW
;
if
(
isCategorized
)
{
barW
=
(
axis
.
tickOffset
()
*
2
*
0.6
)
/
barTargetsNum
;
barW
=
barTargetsNum
?
(
axis
.
tickOffset
()
*
2
*
0.6
)
/
barTargetsNum
:
0
;
}
else
{
barW
=
(((
__axis_rotated
?
height
:
width
)
*
getXDomainRatio
(
isSub
))
/
(
maxDataCount
()
-
1
))
*
0.6
;
}
return
barW
;
}
function
getBarH
(
height
,
isSub
)
{
var
h
=
height
===
null
?
function
(
v
)
{
return
v
;
}
:
function
(
v
)
{
return
height
-
v
;
};
var
h
=
height
===
null
?
function
(
v
)
{
return
v
;
}
:
function
(
v
)
{
return
height
>
v
?
height
-
v
:
0
;
};
return
function
(
d
)
{
var
scale
=
isSub
?
getSubYScale
(
d
.
id
)
:
getYScale
(
d
.
id
);
return
h
(
scale
(
d
.
value
));
...
...
@@ -895,6 +901,30 @@
//-- Shape --//
function
getCircles
(
i
,
id
)
{
return
(
id
?
main
.
selectAll
(
'.-circles-'
+
id
)
:
main
).
selectAll
(
'.-circle'
+
(
i
||
i
===
0
?
'-'
+
i
:
''
));
}
function
expandCircles
(
i
,
id
)
{
getCircles
(
i
,
id
)
.
classed
(
EXPANDED
,
true
)
.
attr
(
'r'
,
__point_focus_expand_r
);
}
function
unexpandCircles
(
i
)
{
getCircles
(
i
)
.
filter
(
function
()
{
return
d3
.
select
(
this
).
classed
(
EXPANDED
);
})
.
classed
(
EXPANDED
,
false
)
.
attr
(
'r'
,
__point_r
);
}
function
getBars
(
i
)
{
return
main
.
selectAll
(
".-bar"
+
(
i
||
i
===
0
?
'-'
+
i
:
''
));
}
function
expandBars
(
i
)
{
getBars
(
i
).
classed
(
EXPANDED
,
false
);
}
function
unexpandBars
(
i
)
{
getBars
(
i
).
classed
(
EXPANDED
,
false
);
}
// For main region
var
lineOnMain
=
(
function
()
{
var
line
=
d3
.
svg
.
line
()
...
...
@@ -1325,31 +1355,19 @@
selectedData
=
newData
.
concat
(
selectedData
);
// Add remained
}
// Expand circles if needed
if
(
__point_focus_expand_enabled
)
{
main
.
selectAll
(
'.-circle-'
+
i
)
.
classed
(
EXPANDED
,
true
)
.
attr
(
'r'
,
__point_focus_expand_r
);
}
// Expand bars
main
.
selectAll
(
".-bar-"
+
i
)
.
classed
(
EXPANDED
,
true
);
// Expand shapes if needed
if
(
__point_focus_expand_enabled
)
{
expandCircles
(
i
);
}
expandBars
(
i
);
// Show xgrid focus line
showXGridFocus
(
selectedData
[
0
]);
})
.
on
(
'mouseout'
,
function
(
d
,
i
)
{
main
.
select
(
'line.xgrid-focus'
).
style
(
"visibility"
,
"hidden"
);
tooltip
.
style
(
"display"
,
"none"
);
// Undo expanded circles
main
.
selectAll
(
'.-circle-'
+
i
)
.
filter
(
function
()
{
return
d3
.
select
(
this
).
classed
(
EXPANDED
);
})
.
classed
(
EXPANDED
,
false
)
.
attr
(
'r'
,
__point_r
);
// Undo expanded bar
main
.
selectAll
(
".-bar-"
+
i
)
.
classed
(
EXPANDED
,
false
);
hideXGridFocus
();
hideTooltip
();
// Undo expanded shapes
unexpandCircles
(
i
);
unexpandBars
();
})
.
on
(
'mousemove'
,
function
(
d
,
i
)
{
var
selectedData
;
...
...
@@ -1413,23 +1431,27 @@
.
attr
(
'width'
,
width
)
.
attr
(
'height'
,
height
)
.
attr
(
'class'
,
"event-rect"
)
.
on
(
'mouseout'
,
function
()
{
hideXGridFocus
();
hideTooltip
();
unexpandCircles
();
})
.
on
(
'mousemove'
,
function
()
{
var
mouse
=
d3
.
mouse
(
this
),
var
mouse
,
closest
,
selectedData
;
if
(
dragging
)
{
return
;
}
// do nothing when dragging
mouse
=
d3
.
mouse
(
this
);
closest
=
findClosest
(
c3
.
data
.
targets
,
mouse
);
// show tooltip when cursor is close to some point
var
selectedData
=
[
addName
(
closest
)];
selectedData
=
[
addName
(
closest
)];
showTooltip
(
selectedData
,
mouse
);
// expand points
if
(
__point_focus_expand_enabled
)
{
main
.
selectAll
(
'.-circle'
)
.
filter
(
function
()
{
return
d3
.
select
(
this
).
classed
(
EXPANDED
);
})
.
classed
(
EXPANDED
,
false
)
.
attr
(
'r'
,
__point_r
);
main
.
select
(
'.-circles-'
+
closest
.
id
).
select
(
'.-circle-'
+
closest
.
index
)
.
classed
(
EXPANDED
,
true
)
.
attr
(
'r'
,
__point_focus_expand_r
);
unexpandCircles
();
expandCircles
(
closest
.
index
,
closest
.
id
);
}
// Show xgrid focus line
...
...
@@ -1499,6 +1521,7 @@
.
attr
(
'y'
,
minY
)
.
attr
(
'width'
,
maxX
-
minX
)
.
attr
(
'height'
,
maxY
-
minY
);
// TODO: binary search when multiple xs
main
.
selectAll
(
'.-shapes'
).
selectAll
(
'.-shape'
)
.
filter
(
function
(
d
)
{
return
__data_selection_isselectable
(
d
);
})
.
each
(
function
(
d
,
i
)
{
...
...
c3.min.js
View file @
8c9ca3ce
This diff is collapsed.
Click to expand it.
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