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
77d83dfc
Commit
77d83dfc
authored
Mar 07, 2015
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix axis.labels api
parent
46e624f4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
2 deletions
+56
-2
c3.js
c3.js
+1
-1
c3.min.js
c3.min.js
+0
-0
api.axis-spec.js
spec/api.axis-spec.js
+54
-0
axis.js
src/axis.js
+1
-1
No files found.
c3.js
View file @
77d83dfc
...
@@ -4240,7 +4240,7 @@
...
@@ -4240,7 +4240,7 @@
return
isString
(
option
)
?
option
:
option
?
option
.
text
:
null
;
return
isString
(
option
)
?
option
:
option
?
option
.
text
:
null
;
};
};
Axis
.
prototype
.
setLabelText
=
function
setLabelText
(
axisId
,
text
)
{
Axis
.
prototype
.
setLabelText
=
function
setLabelText
(
axisId
,
text
)
{
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
option
=
this
.
getLabelOptionByAxisId
(
axisId
);
option
=
this
.
getLabelOptionByAxisId
(
axisId
);
if
(
isString
(
option
))
{
if
(
isString
(
option
))
{
if
(
axisId
===
'y'
)
{
if
(
axisId
===
'y'
)
{
...
...
c3.min.js
View file @
77d83dfc
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/api.axis-spec.js
0 → 100644
View file @
77d83dfc
describe
(
'c3 api axis'
,
function
()
{
'use strict'
;
var
chart
,
args
;
beforeEach
(
function
(
done
)
{
chart
=
window
.
initChart
(
chart
,
args
,
done
);
});
describe
(
'axis.labels'
,
function
()
{
it
(
'should update args'
,
function
()
{
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
],
[
'data2'
,
50
,
20
,
10
]
],
axes
:
{
data1
:
'y'
,
data2
:
'y2'
}
},
axis
:
{
y
:
{
label
:
'Y Axis Label'
},
y2
:
{
show
:
true
,
label
:
'Y2 Axis Label'
}
}
};
expect
(
true
).
toBeTruthy
();
});
it
(
'should update y axis label'
,
function
()
{
chart
.
axis
.
labels
({
y
:
'New Y Axis Label'
});
var
label
=
d3
.
select
(
'.c3-axis-y-label'
);
expect
(
label
.
text
()).
toBe
(
'New Y Axis Label'
);
expect
(
label
.
attr
(
'dx'
)).
toBe
(
'-0.5em'
);
expect
(
label
.
attr
(
'dy'
)).
toBe
(
'1.2em'
);
});
it
(
'should update y axis label'
,
function
()
{
chart
.
axis
.
labels
({
y2
:
'New Y2 Axis Label'
});
var
label
=
d3
.
select
(
'.c3-axis-y2-label'
);
expect
(
label
.
text
()).
toBe
(
'New Y2 Axis Label'
);
expect
(
label
.
attr
(
'dx'
)).
toBe
(
'-0.5em'
);
expect
(
label
.
attr
(
'dy'
)).
toBe
(
'-0.5em'
);
});
});
});
src/axis.js
View file @
77d83dfc
...
@@ -134,7 +134,7 @@ Axis.prototype.getLabelText = function getLabelText(axisId) {
...
@@ -134,7 +134,7 @@ Axis.prototype.getLabelText = function getLabelText(axisId) {
return
isString
(
option
)
?
option
:
option
?
option
.
text
:
null
;
return
isString
(
option
)
?
option
:
option
?
option
.
text
:
null
;
};
};
Axis
.
prototype
.
setLabelText
=
function
setLabelText
(
axisId
,
text
)
{
Axis
.
prototype
.
setLabelText
=
function
setLabelText
(
axisId
,
text
)
{
var
$$
=
this
,
config
=
$$
.
config
,
var
$$
=
this
.
owner
,
config
=
$$
.
config
,
option
=
this
.
getLabelOptionByAxisId
(
axisId
);
option
=
this
.
getLabelOptionByAxisId
(
axisId
);
if
(
isString
(
option
))
{
if
(
isString
(
option
))
{
if
(
axisId
===
'y'
)
{
if
(
axisId
===
'y'
)
{
...
...
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