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
de097a2e
Commit
de097a2e
authored
Oct 25, 2015
by
Evgeny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix problem with stacked-100
parent
065df8be
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
15 deletions
+27
-15
api.flow.js
src/api.flow.js
+2
-1
axis.js
src/axis.js
+1
-1
core.js
src/core.js
+5
-4
data.load.js
src/data.load.js
+4
-3
stacked.js
src/stacked.js
+10
-2
type.js
src/type.js
+2
-1
util.js
src/util.js
+3
-3
No files found.
src/api.flow.js
View file @
de097a2e
...
...
@@ -83,7 +83,8 @@ c3_chart_fn.flow = function (args) {
t
.
values
=
missing
.
concat
(
t
.
values
);
});
}
$$
.
data
.
targets
=
$$
.
data
.
targets
.
concat
(
targets
);
// add remained
$$
.
data
.
_targets
=
$$
.
data
.
targets
.
concat
(
targets
);
// add remained
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
// check data count because behavior needs to change when it's only one
dataCount
=
$$
.
getMaxDataCount
();
...
...
src/axis.js
View file @
de097a2e
c3_chart_internal_fn
.
initAxis
=
function
()
{
c3_chart_internal_fn
.
initAxis
=
function
()
{
var
$$
=
this
,
config
=
$$
.
config
,
main
=
$$
.
main
;
$$
.
axes
.
x
=
main
.
append
(
"g"
)
.
attr
(
"class"
,
CLASS
.
axis
+
' '
+
CLASS
.
axisX
)
...
...
src/core.js
View file @
de097a2e
...
...
@@ -164,12 +164,14 @@ c3_chart_internal_fn.initWithData = function (data) {
// Init data as targets
$$
.
data
.
xs
=
{};
$$
.
data
.
targets
=
$$
.
convertDataToTargets
(
data
);
$$
.
data
.
_
targets
=
$$
.
convertDataToTargets
(
data
);
if
(
config
.
data_filter
)
{
$$
.
data
.
targets
=
$$
.
data
.
targets
.
filter
(
config
.
data_filter
);
$$
.
data
.
_targets
=
$$
.
data
.
_
targets
.
filter
(
config
.
data_filter
);
}
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
// Set targets to hide if needed
if
(
config
.
data_hide
)
{
$$
.
addHiddenTargetIds
(
config
.
data_hide
===
true
?
$$
.
mapToIds
(
$$
.
data
.
targets
)
:
config
.
data_hide
);
...
...
@@ -394,10 +396,9 @@ c3_chart_internal_fn.updateSizes = function () {
}
};
c3_chart_internal_fn
.
updateTargets
=
function
(
t
){
c3_chart_internal_fn
.
updateTargets
=
function
(
t
argets
){
var
$$
=
this
;
var
targets
=
$$
.
normalize
(
t
);
/*-- Main --*/
//-- Text --//
...
...
src/data.load.js
View file @
de097a2e
...
...
@@ -21,13 +21,13 @@ c3_chart_internal_fn.load = function (targets, args) {
}
}
});
$$
.
data
.
targets
=
$$
.
data
.
targets
.
concat
(
targets
);
// add remained
$$
.
data
.
_targets
=
$$
.
data
.
_targets
.
concat
(
targets
);
// add remained
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
}
// Set targets
$$
.
updateTargets
(
$$
.
data
.
targets
);
$$
.
tuneAxis
();
// Redraw with new targets
$$
.
redraw
({
withUpdateOrgXDomain
:
true
,
withUpdateXDomain
:
true
,
withLegend
:
true
});
...
...
@@ -82,8 +82,9 @@ c3_chart_internal_fn.unload = function (targetIds, done) {
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItem
+
$$
.
getTargetSelectorSuffix
(
id
)).
remove
();
}
// Remove target
$$
.
data
.
targets
=
$$
.
data
.
targets
.
filter
(
function
(
t
)
{
$$
.
data
.
_
targets
=
$$
.
data
.
targets
.
filter
(
function
(
t
)
{
return
t
.
id
!==
id
;
});
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
});
};
src/stacked.js
View file @
de097a2e
...
...
@@ -5,7 +5,11 @@ c3.chart.internal.fn.normalize = function(targets){
return
targets
;
}
var
data
=
copyArray
(
targets
);
var
data
=
[];
targets
.
forEach
(
function
(
target
){
data
.
push
(
$$
.
cloneTarget
(
target
));
});
for
(
var
k
=
0
;
k
<
targets
[
0
].
values
.
length
;
k
++
)
{
var
tt
=
0
;
...
...
@@ -17,7 +21,11 @@ c3.chart.internal.fn.normalize = function(targets){
for
(
c
in
targets
)
{
for
(
k
=
0
;
k
<
tr
.
length
;
k
++
)
{
data
[
c
].
values
[
k
].
value
=
targets
[
c
].
values
[
k
].
value
/
tr
[
k
];
if
(
tr
[
k
]
==
0
){
data
[
c
].
values
[
k
].
value
=
0
;
}
else
{
data
[
c
].
values
[
k
].
value
=
targets
[
c
].
values
[
k
].
value
/
tr
[
k
];
}
}
}
...
...
src/type.js
View file @
de097a2e
...
...
@@ -32,7 +32,8 @@ c3_chart_internal_fn.hasArcType = function (targets) {
};
c3_chart_internal_fn
.
isLineType
=
function
(
d
)
{
var
config
=
this
.
config
,
id
=
isString
(
d
)
?
d
:
d
.
id
;
return
!
config
.
data_types
[
id
]
||
[
'line'
,
'spline'
,
'area'
,
'area-spline'
,
'step'
,
'area-step'
].
indexOf
(
config
.
data_types
[
id
])
>=
0
;
var
is
=
!
config
.
data_types
[
id
]
||
[
'line'
,
'spline'
,
'area'
,
'area-spline'
,
'step'
,
'area-step'
].
indexOf
(
config
.
data_types
[
id
])
>=
0
;
return
is
;
};
c3_chart_internal_fn
.
isStepType
=
function
(
d
)
{
var
id
=
isString
(
d
)
?
d
:
d
.
id
;
...
...
src/util.js
View file @
de097a2e
...
...
@@ -63,10 +63,10 @@ var isValue = c3_chart_internal_fn.isValue = function (v) {
var
newObj
=
{};
for
(
var
key
in
oldObj
){
if
(
oldObj
.
hasOwnProperty
(
key
)){
if
(
typeof
oldObj
[
key
]
===
'object'
){
newObj
[
key
]
=
copyObject
(
oldObj
[
key
]);
}
else
if
(
Array
.
isArray
(
oldObj
[
key
])){
if
(
Array
.
isArray
(
oldObj
[
key
])){
newObj
[
key
]
=
copyArray
(
oldObj
[
key
]);
}
else
if
(
typeof
oldObj
[
key
]
===
'object'
){
newObj
[
key
]
=
copyObject
(
oldObj
[
key
]);
}
else
if
(
typeof
oldObj
[
key
]
===
'function'
){
newObj
[
key
]
=
oldObj
[
key
].
bind
(
newObj
);
}
else
{
...
...
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