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
2fe0603f
Commit
2fe0603f
authored
Apr 13, 2016
by
Дмитрий Никулин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add support for negative values for stacked-100
parent
1a9b8452
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
3 deletions
+12
-3
axis.js
src/axis.js
+4
-2
stacked.js
src/stacked.js
+8
-1
No files found.
src/axis.js
View file @
2fe0603f
...
...
@@ -381,8 +381,10 @@ c3_chart_internal_fn.tuneAxis = function(sync, callback){
// if we don't need to tune
if
(
$$
.
config
.
normalized
){
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
$$
.
cachedRedraw
();
return
;
if
(
$$
.
data
.
targets
.
noNegative
){
$$
.
cachedRedraw
();
return
;
}
}
var
apply
=
function
(){
...
...
src/stacked.js
View file @
2fe0603f
...
...
@@ -6,6 +6,8 @@ c3.chart.internal.fn.normalize = function(targets){
}
var
data
=
[];
data
.
noNegative
=
true
;
targets
.
forEach
(
function
(
target
){
data
.
push
(
$$
.
cloneTarget
(
target
));
...
...
@@ -14,7 +16,12 @@ c3.chart.internal.fn.normalize = function(targets){
for
(
var
k
=
0
;
k
<
targets
[
0
].
values
.
length
;
k
++
)
{
var
tt
=
0
;
for
(
c
in
targets
)
{
tt
=
tt
+
targets
[
c
].
values
[
k
].
value
;
if
(
targets
[
c
].
values
[
k
]){
if
(
targets
[
c
].
values
[
k
].
value
<
0
){
data
.
noNegative
=
false
;
}
tt
=
tt
+
Math
.
abs
(
targets
[
c
].
values
[
k
].
value
);
}
}
tr
[
k
]
=
tt
;
}
...
...
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