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
d8190802
Commit
d8190802
authored
Nov 17, 2013
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Skip null data instead of converting to 0 when line chart
parent
192df87f
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
6 deletions
+13
-6
c3.js
c3.js
+13
-6
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
d8190802
...
...
@@ -465,7 +465,7 @@
id
:
convertedId
,
id_org
:
id
,
values
:
data
.
map
(
function
(
d
)
{
return
{
x
:
d
.
x
,
value
:
+
d
[
id
]
,
id
:
convertedId
};
return
{
x
:
d
.
x
,
value
:
d
[
id
]
!==
null
?
+
d
[
id
]
:
null
,
id
:
convertedId
};
})
};
});
...
...
@@ -712,6 +712,10 @@
(
selected
)
?
selectBar
(
target
,
d
,
i
)
:
unselectBar
(
target
,
d
,
i
);
}
function
filterRemoveNull
(
data
)
{
return
data
.
filter
(
function
(
d
)
{
return
d
.
value
!==
null
;
});
}
//-- Shape --//
// For main region
...
...
@@ -720,13 +724,13 @@
.
x
(
__axis_rotated
?
function
(
d
)
{
return
getYScale
(
d
.
id
)(
d
.
value
);
}
:
xx
)
.
y
(
__axis_rotated
?
xx
:
function
(
d
)
{
return
getYScale
(
d
.
id
)(
d
.
value
);
});
return
function
(
d
)
{
var
x0
,
y0
;
var
data
=
filterRemoveNull
(
d
.
values
),
x0
,
y0
;
if
(
isLineType
(
d
))
{
isSplineType
(
d
)
?
line
.
interpolate
(
"cardinal"
)
:
line
.
interpolate
(
"linear"
);
return
Object
.
keys
(
__data_regions
).
length
>
0
?
lineWithRegions
(
d
.
values
,
x
,
getYScale
(
d
.
id
),
__data_regions
[
d
.
id
])
:
line
(
d
.
values
);
return
Object
.
keys
(
__data_regions
).
length
>
0
?
lineWithRegions
(
d
ata
,
x
,
getYScale
(
d
.
id
),
__data_regions
[
d
.
id
])
:
line
(
data
);
}
else
{
x0
=
x
(
d
.
values
[
0
].
x
);
y0
=
getYScale
(
d
.
id
)(
d
.
values
[
0
].
value
);
x0
=
x
(
d
ata
[
0
].
x
);
y0
=
getYScale
(
d
.
id
)(
d
ata
[
0
].
value
);
return
__axis_rotated
?
"M "
+
y0
+
" "
+
x0
:
"M "
+
x0
+
" "
+
y0
;
}
};
...
...
@@ -738,7 +742,8 @@
.
x
(
function
(
d
)
{
return
subX
(
d
.
x
);
})
.
y
(
function
(
d
)
{
return
getSubYScale
(
d
.
id
)(
d
.
value
);
});
return
function
(
d
)
{
return
isLineType
(
d
)
?
line
(
d
.
values
)
:
"M "
+
subX
(
d
.
values
[
0
].
x
)
+
" "
+
getSubYScale
(
d
.
id
)(
d
.
values
[
0
].
value
);
var
data
=
filterRemoveNull
(
d
.
values
);
return
isLineType
(
d
)
?
line
(
data
)
:
"M "
+
subX
(
data
[
0
].
x
)
+
" "
+
getSubYScale
(
d
.
id
)(
data
[
0
].
value
);
};
})();
...
...
@@ -1409,9 +1414,11 @@
mainCircle
=
main
.
selectAll
(
'.-circles'
).
selectAll
(
'.-circle'
)
.
data
(
lineData
);
mainCircle
.
transition
().
duration
(
duration
)
.
style
(
'opacity'
,
function
(
d
)
{
return
d
.
value
===
null
?
0
:
1
;
})
.
attr
(
"cx"
,
__axis_rotated
?
circleY
:
circleX
)
.
attr
(
"cy"
,
__axis_rotated
?
circleX
:
circleY
);
mainCircle
.
enter
().
append
(
"circle"
)
.
style
(
'opacity'
,
function
(
d
)
{
return
d
.
value
===
null
?
0
:
1
;
})
.
attr
(
"class"
,
classCircle
)
.
attr
(
"cx"
,
__axis_rotated
?
circleY
:
circleX
)
.
attr
(
"cy"
,
__axis_rotated
?
circleX
:
circleY
)
...
...
c3.min.js
View file @
d8190802
This diff is collapsed.
Click to expand it.
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