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
8e9bd1a3
Commit
8e9bd1a3
authored
Aug 15, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Separate axis
parent
1d105c1a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
108 additions
and
92 deletions
+108
-92
c3.js
c3.js
+54
-46
c3.min.js
c3.min.js
+0
-0
axis.js
src/axis.js
+52
-0
core.js
src/core.js
+2
-46
No files found.
c3.js
View file @
8e9bd1a3
...
...
@@ -281,35 +281,7 @@
}
// Add Axis
$$
.
axes
.
x
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisX
])
.
attr
(
"clip-path"
,
$$
.
clipPathForXAxis
)
.
attr
(
"transform"
,
$$
.
getTranslate
(
'x'
))
.
style
(
"visibility"
,
config
[
__axis_x_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
x
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisXLabel
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
"rotate(-90)"
:
""
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForXAxisLabel
,
$$
));
$$
.
axes
.
y
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisY
])
.
attr
(
"clip-path"
,
$$
.
clipPathForYAxis
)
.
attr
(
"transform"
,
$$
.
getTranslate
(
'y'
))
.
style
(
"visibility"
,
config
[
__axis_y_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
y
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisYLabel
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForYAxisLabel
,
$$
));
$$
.
axes
.
y2
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisY2
])
// clip-path?
.
attr
(
"transform"
,
$$
.
getTranslate
(
'y2'
))
.
style
(
"visibility"
,
config
[
__axis_y2_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
y2
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisY2Label
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForY2AxisLabel
,
$$
));
$$
.
initAxis
();
// Set targets
$$
.
updateTargets
(
$$
.
data
.
targets
);
...
...
@@ -564,14 +536,7 @@
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
));
// axes
$$
.
axes
.
x
.
style
(
"opacity"
,
hideAxis
?
0
:
1
);
$$
.
axes
.
y
.
style
(
"opacity"
,
hideAxis
?
0
:
1
);
$$
.
axes
.
y2
.
style
(
"opacity"
,
hideAxis
?
0
:
1
);
$$
.
axes
.
subx
.
style
(
"opacity"
,
hideAxis
?
0
:
1
);
transitions
.
axisX
.
call
(
$$
.
xAxis
);
transitions
.
axisY
.
call
(
$$
.
yAxis
);
transitions
.
axisY2
.
call
(
$$
.
y2Axis
);
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
$$
.
redrawAxis
(
transitions
,
hideAxis
);
// Update axis label
$$
.
updateAxisLabels
(
withTransition
);
...
...
@@ -1498,15 +1463,6 @@
$$
.
updateAndRedraw
(
options
);
};
c3_chart_internal_fn
.
generateAxisTransitions
=
function
(
duration
)
{
var
$$
=
this
,
axes
=
$$
.
axes
;
return
{
axisX
:
duration
?
axes
.
x
.
transition
().
duration
(
duration
)
:
axes
.
x
,
axisY
:
duration
?
axes
.
y
.
transition
().
duration
(
duration
)
:
axes
.
y
,
axisY2
:
duration
?
axes
.
y2
.
transition
().
duration
(
duration
)
:
axes
.
y2
,
axisSubX
:
duration
?
axes
.
subx
.
transition
().
duration
(
duration
)
:
axes
.
subx
};
};
c3_chart_internal_fn
.
endall
=
function
(
transition
,
callback
)
{
var
n
=
0
;
transition
...
...
@@ -3855,6 +3811,38 @@
$$
.
transformAll
(
withTransitionForTransform
,
transitions
);
};
c3_chart_internal_fn
.
initAxis
=
function
()
{
var
$$
=
this
,
config
=
$$
.
config
,
main
=
$$
.
main
,
CLASS
=
$$
.
CLASS
;
$$
.
axes
.
x
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisX
])
.
attr
(
"clip-path"
,
$$
.
clipPathForXAxis
)
.
attr
(
"transform"
,
$$
.
getTranslate
(
'x'
))
.
style
(
"visibility"
,
config
[
__axis_x_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
x
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisXLabel
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
"rotate(-90)"
:
""
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForXAxisLabel
,
$$
));
$$
.
axes
.
y
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisY
])
.
attr
(
"clip-path"
,
$$
.
clipPathForYAxis
)
.
attr
(
"transform"
,
$$
.
getTranslate
(
'y'
))
.
style
(
"visibility"
,
config
[
__axis_y_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
y
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisYLabel
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForYAxisLabel
,
$$
));
$$
.
axes
.
y2
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisY2
])
// clip-path?
.
attr
(
"transform"
,
$$
.
getTranslate
(
'y2'
))
.
style
(
"visibility"
,
config
[
__axis_y2_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
y2
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisY2Label
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForY2AxisLabel
,
$$
));
};
c3_chart_internal_fn
.
getXAxis
=
function
(
scale
,
orient
,
tickFormat
,
tickValues
)
{
var
$$
=
this
,
config
=
$$
.
config
,
axis
=
c3_axis
(
$$
.
d3
,
$$
.
isCategorized
()).
scale
(
scale
).
orient
(
orient
);
...
...
@@ -4138,6 +4126,26 @@
if
(
!
$$
.
isTimeSeries
())
{
tickValues
=
tickValues
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
;
});
}
return
tickValues
;
};
c3_chart_internal_fn
.
generateAxisTransitions
=
function
(
duration
)
{
var
$$
=
this
,
axes
=
$$
.
axes
;
return
{
axisX
:
duration
?
axes
.
x
.
transition
().
duration
(
duration
)
:
axes
.
x
,
axisY
:
duration
?
axes
.
y
.
transition
().
duration
(
duration
)
:
axes
.
y
,
axisY2
:
duration
?
axes
.
y2
.
transition
().
duration
(
duration
)
:
axes
.
y2
,
axisSubX
:
duration
?
axes
.
subx
.
transition
().
duration
(
duration
)
:
axes
.
subx
};
};
c3_chart_internal_fn
.
redrawAxis
=
function
(
transitions
,
isHidden
)
{
var
$$
=
this
;
$$
.
axes
.
x
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
y
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
y2
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
subx
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
transitions
.
axisX
.
call
(
$$
.
xAxis
);
transitions
.
axisY
.
call
(
$$
.
yAxis
);
transitions
.
axisY2
.
call
(
$$
.
y2Axis
);
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
};
c3_chart_internal_fn
.
getClipPath
=
function
(
id
)
{
var
isIE9
=
window
.
navigator
.
appVersion
.
toLowerCase
().
indexOf
(
"msie 9."
)
>=
0
;
...
...
c3.min.js
View file @
8e9bd1a3
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/axis.js
View file @
8e9bd1a3
c3_chart_internal_fn
.
initAxis
=
function
()
{
var
$$
=
this
,
config
=
$$
.
config
,
main
=
$$
.
main
,
CLASS
=
$$
.
CLASS
;
$$
.
axes
.
x
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisX
])
.
attr
(
"clip-path"
,
$$
.
clipPathForXAxis
)
.
attr
(
"transform"
,
$$
.
getTranslate
(
'x'
))
.
style
(
"visibility"
,
config
[
__axis_x_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
x
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisXLabel
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
"rotate(-90)"
:
""
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForXAxisLabel
,
$$
));
$$
.
axes
.
y
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisY
])
.
attr
(
"clip-path"
,
$$
.
clipPathForYAxis
)
.
attr
(
"transform"
,
$$
.
getTranslate
(
'y'
))
.
style
(
"visibility"
,
config
[
__axis_y_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
y
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisYLabel
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForYAxisLabel
,
$$
));
$$
.
axes
.
y2
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisY2
])
// clip-path?
.
attr
(
"transform"
,
$$
.
getTranslate
(
'y2'
))
.
style
(
"visibility"
,
config
[
__axis_y2_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
y2
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisY2Label
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForY2AxisLabel
,
$$
));
};
c3_chart_internal_fn
.
getXAxis
=
function
(
scale
,
orient
,
tickFormat
,
tickValues
)
{
var
$$
=
this
,
config
=
$$
.
config
,
axis
=
c3_axis
(
$$
.
d3
,
$$
.
isCategorized
()).
scale
(
scale
).
orient
(
orient
);
...
...
@@ -281,3 +313,23 @@ c3_chart_internal_fn.generateTickValues = function (xs, tickCount) {
if
(
!
$$
.
isTimeSeries
())
{
tickValues
=
tickValues
.
sort
(
function
(
a
,
b
)
{
return
a
-
b
;
});
}
return
tickValues
;
};
c3_chart_internal_fn
.
generateAxisTransitions
=
function
(
duration
)
{
var
$$
=
this
,
axes
=
$$
.
axes
;
return
{
axisX
:
duration
?
axes
.
x
.
transition
().
duration
(
duration
)
:
axes
.
x
,
axisY
:
duration
?
axes
.
y
.
transition
().
duration
(
duration
)
:
axes
.
y
,
axisY2
:
duration
?
axes
.
y2
.
transition
().
duration
(
duration
)
:
axes
.
y2
,
axisSubX
:
duration
?
axes
.
subx
.
transition
().
duration
(
duration
)
:
axes
.
subx
};
};
c3_chart_internal_fn
.
redrawAxis
=
function
(
transitions
,
isHidden
)
{
var
$$
=
this
;
$$
.
axes
.
x
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
y
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
y2
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
$$
.
axes
.
subx
.
style
(
"opacity"
,
isHidden
?
0
:
1
);
transitions
.
axisX
.
call
(
$$
.
xAxis
);
transitions
.
axisY
.
call
(
$$
.
yAxis
);
transitions
.
axisY2
.
call
(
$$
.
y2Axis
);
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
};
src/core.js
View file @
8e9bd1a3
...
...
@@ -276,35 +276,7 @@ c3_chart_internal_fn.initWithData = function (data) {
}
// Add Axis
$$
.
axes
.
x
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisX
])
.
attr
(
"clip-path"
,
$$
.
clipPathForXAxis
)
.
attr
(
"transform"
,
$$
.
getTranslate
(
'x'
))
.
style
(
"visibility"
,
config
[
__axis_x_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
x
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisXLabel
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
"rotate(-90)"
:
""
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForXAxisLabel
,
$$
));
$$
.
axes
.
y
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisY
])
.
attr
(
"clip-path"
,
$$
.
clipPathForYAxis
)
.
attr
(
"transform"
,
$$
.
getTranslate
(
'y'
))
.
style
(
"visibility"
,
config
[
__axis_y_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
y
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisYLabel
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForYAxisLabel
,
$$
));
$$
.
axes
.
y2
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
[
_axis
]
+
' '
+
CLASS
[
_axisY2
])
// clip-path?
.
attr
(
"transform"
,
$$
.
getTranslate
(
'y2'
))
.
style
(
"visibility"
,
config
[
__axis_y2_show
]
?
'visible'
:
'hidden'
);
$$
.
axes
.
y2
.
append
(
"text"
)
.
attr
(
"class"
,
CLASS
[
_axisY2Label
])
.
attr
(
"transform"
,
config
[
__axis_rotated
]
?
""
:
"rotate(-90)"
)
.
style
(
"text-anchor"
,
generateCall
(
$$
.
textAnchorForY2AxisLabel
,
$$
));
$$
.
initAxis
();
// Set targets
$$
.
updateTargets
(
$$
.
data
.
targets
);
...
...
@@ -559,14 +531,7 @@ c3_chart_internal_fn.redraw = function (options, transitions) {
$$
.
y2
.
domain
(
$$
.
getYDomain
(
targetsToShow
,
'y2'
));
// axes
$$
.
axes
.
x
.
style
(
"opacity"
,
hideAxis
?
0
:
1
);
$$
.
axes
.
y
.
style
(
"opacity"
,
hideAxis
?
0
:
1
);
$$
.
axes
.
y2
.
style
(
"opacity"
,
hideAxis
?
0
:
1
);
$$
.
axes
.
subx
.
style
(
"opacity"
,
hideAxis
?
0
:
1
);
transitions
.
axisX
.
call
(
$$
.
xAxis
);
transitions
.
axisY
.
call
(
$$
.
yAxis
);
transitions
.
axisY2
.
call
(
$$
.
y2Axis
);
transitions
.
axisSubX
.
call
(
$$
.
subXAxis
);
$$
.
redrawAxis
(
transitions
,
hideAxis
);
// Update axis label
$$
.
updateAxisLabels
(
withTransition
);
...
...
@@ -1493,15 +1458,6 @@ c3_chart_internal_fn.transformTo = function (targetIds, type, optionsForRedraw)
$$
.
updateAndRedraw
(
options
);
};
c3_chart_internal_fn
.
generateAxisTransitions
=
function
(
duration
)
{
var
$$
=
this
,
axes
=
$$
.
axes
;
return
{
axisX
:
duration
?
axes
.
x
.
transition
().
duration
(
duration
)
:
axes
.
x
,
axisY
:
duration
?
axes
.
y
.
transition
().
duration
(
duration
)
:
axes
.
y
,
axisY2
:
duration
?
axes
.
y2
.
transition
().
duration
(
duration
)
:
axes
.
y2
,
axisSubX
:
duration
?
axes
.
subx
.
transition
().
duration
(
duration
)
:
axes
.
subx
};
};
c3_chart_internal_fn
.
endall
=
function
(
transition
,
callback
)
{
var
n
=
0
;
transition
...
...
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