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
12cb277f
Commit
12cb277f
authored
Nov 16, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix grid filtering to add and remove - #720
parent
3dad31a9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
73 additions
and
2 deletions
+73
-2
c3.js
c3.js
+1
-1
c3.min.js
c3.min.js
+0
-0
api.grid-spec.js
spec/api.grid-spec.js
+71
-0
grid.js
src/grid.js
+1
-1
No files found.
c3.js
View file @
12cb277f
...
@@ -3507,7 +3507,7 @@
...
@@ -3507,7 +3507,7 @@
return
params
?
function
(
line
)
{
return
params
?
function
(
line
)
{
var
found
=
false
;
var
found
=
false
;
[].
concat
(
params
).
forEach
(
function
(
param
)
{
[].
concat
(
params
).
forEach
(
function
(
param
)
{
if
(((
'value'
in
param
&&
line
.
value
===
param
s
.
value
)
||
(
'class'
in
param
&&
line
[
'class'
]
===
params
[
'class'
])))
{
if
(((
'value'
in
param
&&
line
.
value
===
param
.
value
)
||
(
'class'
in
param
&&
line
[
'class'
]
===
param
[
'class'
])))
{
found
=
true
;
found
=
true
;
}
}
});
});
...
...
c3.min.js
View file @
12cb277f
This source diff could not be displayed because it is too large. You can
view the blob
instead.
spec/api.grid-spec.js
0 → 100644
View file @
12cb277f
var
describe
=
window
.
describe
,
expect
=
window
.
expect
,
it
=
window
.
it
,
beforeEach
=
window
.
beforeEach
;
describe
(
'c3 api grid'
,
function
()
{
'use strict'
;
var
chart
,
d3
;
var
args
=
{
data
:
{
columns
:
[
[
'data1'
,
30
,
200
,
100
,
400
,
150
,
250
]
]
}
};
beforeEach
(
function
(
done
)
{
chart
=
window
.
initChart
(
chart
,
args
,
done
);
d3
=
chart
.
internal
.
d3
;
});
describe
(
'ygrid.add and ygrid.remove'
,
function
()
{
it
(
'should update y grids'
,
function
(
done
)
{
var
main
=
chart
.
internal
.
main
,
expectedGrids
=
[
{
value
:
100
,
text
:
'Pressure Low'
},
{
value
:
200
,
text
:
'Pressure High'
}
],
grids
;
// Call ygrids.add
chart
.
ygrids
.
add
(
expectedGrids
);
setTimeout
(
function
()
{
grids
=
main
.
selectAll
(
'.c3-ygrid-line'
);
expect
(
grids
.
size
()).
toBe
(
expectedGrids
.
length
);
grids
.
each
(
function
(
d
,
i
)
{
var
y
=
+
d3
.
select
(
this
).
select
(
'line'
).
attr
(
'y1'
),
text
=
d3
.
select
(
this
).
select
(
'text'
).
text
(),
expectedY
=
Math
.
round
(
chart
.
internal
.
y
(
expectedGrids
[
i
].
value
)),
expectedText
=
expectedGrids
[
i
].
text
;
expect
(
y
).
toBe
(
expectedY
);
expect
(
text
).
toBe
(
expectedText
);
});
// Call ygrids.remove
chart
.
ygrids
.
remove
(
expectedGrids
);
setTimeout
(
function
()
{
grids
=
main
.
selectAll
(
'.c3-ygrid-line'
);
expect
(
grids
.
size
()).
toBe
(
0
);
},
500
);
},
500
);
setTimeout
(
function
()
{
done
();
},
1200
);
});
});
});
src/grid.js
View file @
12cb277f
...
@@ -203,7 +203,7 @@ c3_chart_internal_fn.getGridFilterToRemove = function (params) {
...
@@ -203,7 +203,7 @@ c3_chart_internal_fn.getGridFilterToRemove = function (params) {
return
params
?
function
(
line
)
{
return
params
?
function
(
line
)
{
var
found
=
false
;
var
found
=
false
;
[].
concat
(
params
).
forEach
(
function
(
param
)
{
[].
concat
(
params
).
forEach
(
function
(
param
)
{
if
(((
'value'
in
param
&&
line
.
value
===
param
s
.
value
)
||
(
'class'
in
param
&&
line
[
'class'
]
===
params
[
'class'
])))
{
if
(((
'value'
in
param
&&
line
.
value
===
param
.
value
)
||
(
'class'
in
param
&&
line
[
'class'
]
===
param
[
'class'
])))
{
found
=
true
;
found
=
true
;
}
}
});
});
...
...
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