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
937f3835
Commit
937f3835
authored
Nov 03, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'lbortoli-master'
parents
b17c3ab2
eef2dba0
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
52 additions
and
2 deletions
+52
-2
c3.js
c3.js
+9
-0
c3.min.js
c3.min.js
+0
-0
api.data-spec.js
spec/api.data-spec.js
+34
-2
api.data.js
src/api.data.js
+9
-0
No files found.
c3.js
View file @
937f3835
...
...
@@ -6136,6 +6136,15 @@
$$
.
redraw
({
withLegend
:
true
});
return
config
.
data_colors
;
};
c3_chart_fn
.
data
.
axes
=
function
(
axes
)
{
var
$$
=
this
.
internal
,
config
=
$$
.
config
;
if
(
!
arguments
.
length
)
{
return
config
.
data_axes
;
}
Object
.
keys
(
axes
).
forEach
(
function
(
id
)
{
config
.
data_axes
[
id
]
=
axes
[
id
];
});
$$
.
redraw
({
withLegend
:
true
});
return
config
.
data_axes
;
};
c3_chart_fn
.
category
=
function
(
i
,
category
)
{
var
$$
=
this
.
internal
,
config
=
$$
.
config
;
...
...
c3.min.js
View file @
937f3835
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/api.data-spec.js
View file @
937f3835
...
...
@@ -12,8 +12,17 @@ describe('c3 api data', function () {
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
],
[
'data2'
,
50
,
20
,
10
,
40
,
15
,
25
]
]
[
'data2'
,
5000
,
2000
,
1000
,
4000
,
1500
,
2500
]
],
axes
:
{
data1
:
'y'
,
data2
:
'y2'
}
},
axis
:
{
y2
:
{
show
:
true
}
}
};
...
...
@@ -69,4 +78,27 @@ describe('c3 api data', function () {
});
describe
(
'data.axes()'
,
function
()
{
it
(
'should return data.axes specified as argument'
,
function
()
{
var
results
=
chart
.
data
.
axes
();
expect
(
results
.
data1
).
toBe
(
'y'
);
expect
(
results
.
data2
).
toBe
(
'y2'
);
expect
(
d3
.
select
(
'.c3-axis-y g.tick text'
).
text
()).
toBe
(
'0'
);
expect
(
d3
.
select
(
'.c3-axis-y2 g.tick text'
).
text
()).
toBe
(
'1000'
);
});
it
(
'should return data.axes specified as api'
,
function
()
{
var
results
=
chart
.
data
.
axes
({
data1
:
'y2'
,
data2
:
'y'
});
expect
(
results
.
data1
).
toBe
(
'y2'
);
expect
(
results
.
data2
).
toBe
(
'y'
);
expect
(
d3
.
select
(
'.c3-axis-y g.tick text'
).
text
()).
toBe
(
'1000'
);
expect
(
d3
.
select
(
'.c3-axis-y2 g.tick text'
).
text
()).
toBe
(
'0'
);
});
});
});
src/api.data.js
View file @
937f3835
...
...
@@ -29,3 +29,12 @@ c3_chart_fn.data.colors = function (colors) {
$$
.
redraw
({
withLegend
:
true
});
return
config
.
data_colors
;
};
c3_chart_fn
.
data
.
axes
=
function
(
axes
)
{
var
$$
=
this
.
internal
,
config
=
$$
.
config
;
if
(
!
arguments
.
length
)
{
return
config
.
data_axes
;
}
Object
.
keys
(
axes
).
forEach
(
function
(
id
)
{
config
.
data_axes
[
id
]
=
axes
[
id
];
});
$$
.
redraw
({
withLegend
:
true
});
return
config
.
data_axes
;
};
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