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
c92c53db
Commit
c92c53db
authored
Apr 02, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix axis.label API not to stop transition - #107
parent
17478d6d
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
77 additions
and
4 deletions
+77
-4
c3.js
c3.js
+7
-4
c3.min.js
c3.min.js
+0
-0
api_axis_label.html
htdocs/samples/api_axis_label.html
+70
-0
No files found.
c3.js
View file @
c92c53db
...
...
@@ -782,6 +782,11 @@
});
return
maxWidth
<
20
?
20
:
maxWidth
;
}
function
updateAxisLabels
()
{
main
.
select
(
'.'
+
CLASS
.
axisX
+
' .'
+
CLASS
.
axisXLabel
).
attr
(
"x"
,
xForXAxisLabel
).
text
(
textForXAxisLabel
);
main
.
select
(
'.'
+
CLASS
.
axisY
+
' .'
+
CLASS
.
axisYLabel
).
attr
(
"x"
,
xForYAxisLabel
).
attr
(
"dy"
,
dyForYAxisLabel
).
text
(
textForYAxisLabel
);
main
.
select
(
'.'
+
CLASS
.
axisY2
+
' .'
+
CLASS
.
axisY2Label
).
attr
(
"x"
,
xForY2AxisLabel
).
attr
(
"dy"
,
dyForY2AxisLabel
).
text
(
textForY2AxisLabel
);
}
function
categoryAxis
()
{
var
scale
=
d3
.
scale
.
linear
(),
orient
=
"bottom"
;
...
...
@@ -2879,9 +2884,7 @@
yForText
=
generateXYForText
(
barIndices
,
false
);
// Update axis label
main
.
select
(
'.'
+
CLASS
.
axisX
+
' .'
+
CLASS
.
axisXLabel
).
attr
(
"x"
,
xForXAxisLabel
).
text
(
textForXAxisLabel
);
main
.
select
(
'.'
+
CLASS
.
axisY
+
' .'
+
CLASS
.
axisYLabel
).
attr
(
"x"
,
xForYAxisLabel
).
attr
(
"dy"
,
dyForYAxisLabel
).
text
(
textForYAxisLabel
);
main
.
select
(
'.'
+
CLASS
.
axisY2
+
' .'
+
CLASS
.
axisY2Label
).
attr
(
"x"
,
xForY2AxisLabel
).
attr
(
"dy"
,
dyForY2AxisLabel
).
text
(
textForY2AxisLabel
);
updateAxisLabels
();
// Update sub domain
subY
.
domain
(
y
.
domain
());
...
...
@@ -3967,7 +3970,7 @@
Object
.
keys
(
labels
).
forEach
(
function
(
axisId
)
{
setAxisLabelText
(
axisId
,
labels
[
axisId
]);
});
redraw
({
withY
:
false
,
withSubchart
:
false
,
withTransition
:
false
}
);
updateAxisLabels
(
);
}
// TODO: return some values?
};
...
...
c3.min.js
View file @
c92c53db
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/samples/api_axis_label.html
0 → 100644
View file @
c92c53db
<html>
<head>
<link
href=
"/css/c3.css"
rel=
"stylesheet"
type=
"text/css"
>
</head>
<body>
<div
id=
"chart"
></div>
<script
src=
"http://d3js.org/d3.v3.min.js"
charset=
"utf-8"
></script>
<script
src=
"/js/c3.js"
></script>
<script>
var
chart
=
c3
.
generate
({
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
]
],
axes
:
{
data1
:
'y'
,
data2
:
'y2'
,
}
},
axis
:
{
x
:
{
label
:
'X Label'
},
y
:
{
label
:
{
text
:
'Y Axis Label'
,
position
:
'outer-middle'
}
},
y2
:
{
show
:
true
,
label
:
{
text
:
'Y2 Axis Label'
,
position
:
'outer-middle'
}
}
},
tooltip
:
{
// enabled: false
},
zoom
:
{
// enabled: true
},
subchart
:
{
// show: true
}
});
setTimeout
(
function
()
{
chart
.
axis
.
labels
({
x
:
'New X Axis Label'
,
y
:
'New Y Axis Label'
,
y2
:
'New Y2 Axis Label'
,
});
},
1000
);
setTimeout
(
function
()
{
chart
.
load
({
columns
:
[
[
'data1'
,
100
,
300
,
600
,
200
,
400
,
500
]
]
});
chart
.
axis
.
labels
({
y
:
'New Y Axis Label Again'
});
},
2000
);
</script>
</body>
</html>
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