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
eb7452fc
Commit
eb7452fc
authored
May 09, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable filter when loading data
parent
aa83d63b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
20 additions
and
8 deletions
+20
-8
c3.js
c3.js
+12
-6
c3.min.js
c3.min.js
+0
-0
data_load.html
htdocs/samples/data_load.html
+8
-2
No files found.
c3.js
View file @
eb7452fc
...
...
@@ -144,6 +144,7 @@
__data_color
=
getConfig
([
'data'
,
'color'
]),
__data_colors
=
getConfig
([
'data'
,
'colors'
],
{}),
__data_hide
=
getConfig
([
'data'
,
'hide'
],
false
),
__data_filter
=
getConfig
([
'data'
,
'filter'
]),
__data_selection_enabled
=
getConfig
([
'data'
,
'selection'
,
'enabled'
],
false
),
__data_selection_grouped
=
getConfig
([
'data'
,
'selection'
,
'grouped'
],
false
),
__data_selection_isselectable
=
getConfig
([
'data'
,
'selection'
,
'isselectable'
],
function
()
{
return
true
;
}),
...
...
@@ -1486,9 +1487,6 @@
}
return
false
;
}
function
getTargets
(
filter
)
{
return
isDefined
(
filter
)
?
c3
.
data
.
targets
.
filter
(
filter
)
:
c3
.
data
.
targets
;
}
function
isTargetToShow
(
targetId
)
{
return
hiddenTargetIds
.
indexOf
(
targetId
)
<
0
;
}
...
...
@@ -1879,7 +1877,7 @@
function
getBarIndices
()
{
var
indices
=
{},
i
=
0
,
j
,
k
;
filterTargetsToShow
(
getTargets
(
isBarType
)).
forEach
(
function
(
d
)
{
filterTargetsToShow
(
c3
.
data
.
targets
.
filter
(
isBarType
)).
forEach
(
function
(
d
)
{
for
(
j
=
0
;
j
<
__data_groups
.
length
;
j
++
)
{
if
(
__data_groups
[
j
].
indexOf
(
d
.
id
)
<
0
)
{
continue
;
}
for
(
k
=
0
;
k
<
__data_groups
[
j
].
length
;
k
++
)
{
...
...
@@ -1908,7 +1906,7 @@
};
}
function
getBarOffset
(
barIndices
,
isSub
)
{
var
targets
=
orderTargets
(
filterTargetsToShow
(
getTargets
(
isBarType
))),
var
targets
=
orderTargets
(
filterTargetsToShow
(
c3
.
data
.
targets
.
filter
(
isBarType
))),
targetIds
=
targets
.
map
(
function
(
t
)
{
return
t
.
id
;
});
return
function
(
d
,
i
)
{
var
scale
=
isSub
?
getSubYScale
(
d
.
id
)
:
getYScale
(
d
.
id
),
...
...
@@ -2449,6 +2447,10 @@
c3
.
data
.
xs
=
{};
c3
.
data
.
targets
=
convertDataToTargets
(
data
);
if
(
__data_filter
)
{
c3
.
data
.
targets
=
c3
.
data
.
targets
.
filter
(
__data_filter
);
}
// Set targets to hide if needed
if
(
__data_hide
)
{
addHiddenTargetIds
(
__data_hide
===
true
?
mapToIds
(
c3
.
data
.
targets
)
:
__data_hide
);
...
...
@@ -3768,6 +3770,10 @@
}
function
load
(
targets
,
args
)
{
// filter loading targets if needed
if
(
args
.
filter
)
{
targets
=
targets
.
filter
(
args
.
filter
);
}
// set type if args.types || args.type specified
if
(
args
.
type
||
args
.
types
)
{
targets
.
forEach
(
function
(
t
)
{
...
...
@@ -4368,7 +4374,7 @@
return
isDefined
(
target
)
?
target
.
values
.
map
(
function
(
d
)
{
return
d
.
value
;
})
:
undefined
;
};
c3
.
data
.
getAsTarget
=
function
(
targetId
)
{
var
targets
=
getTargets
(
function
(
t
)
{
return
t
.
id
===
targetId
;
});
var
targets
=
c3
.
data
.
targets
.
filter
(
function
(
t
)
{
return
t
.
id
===
targetId
;
});
return
targets
.
length
>
0
?
targets
[
0
]
:
undefined
;
};
c3
.
data
.
names
=
function
(
names
)
{
...
...
c3.min.js
View file @
eb7452fc
This source diff could not be displayed because it is too large. You can
view the blob
instead.
htdocs/samples/data_load.html
View file @
eb7452fc
...
...
@@ -11,7 +11,10 @@
var
chart
=
c3
.
generate
({
data
:
{
url
:
'/data/c3_test.csv'
,
labels
:
true
labels
:
true
,
filter
:
function
(
t
)
{
return
t
.
id
!==
'data1'
;
}
},
subchart
:
{
show
:
true
...
...
@@ -26,7 +29,10 @@
setTimeout
(
function
()
{
chart
.
load
({
url
:
'/data/c3_test2.csv'
url
:
'/data/c3_test2.csv'
,
filter
:
function
(
t
)
{
return
t
.
id
!==
'data1'
;
}
});
},
1000
);
...
...
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