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
6071db2b
Commit
6071db2b
authored
Jul 02, 2016
by
Evgeny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Normalized chart -- cut min and max y values with original minmax. Fixes CHRT-206
parent
185906de
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
6 deletions
+14
-6
c3.js
c3.js
+7
-3
c3.min.js
c3.min.js
+0
-0
axis.js
src/axis.js
+5
-1
stacked.js
src/stacked.js
+2
-2
No files found.
c3.js
View file @
6071db2b
...
@@ -3543,7 +3543,7 @@
...
@@ -3543,7 +3543,7 @@
var
data
=
[];
var
data
=
[];
data
.
noNega
tive
=
true
;
data
.
onlyPosi
tive
=
true
;
targets
.
forEach
(
function
(
target
){
targets
.
forEach
(
function
(
target
){
data
.
push
(
$$
.
cloneTarget
(
target
));
data
.
push
(
$$
.
cloneTarget
(
target
));
...
@@ -3554,7 +3554,7 @@
...
@@ -3554,7 +3554,7 @@
for
(
c
in
targets
)
{
for
(
c
in
targets
)
{
if
(
targets
[
c
].
values
[
k
]){
if
(
targets
[
c
].
values
[
k
]){
if
(
targets
[
c
].
values
[
k
].
value
<
0
){
if
(
targets
[
c
].
values
[
k
].
value
<
0
){
data
.
noNega
tive
=
false
;
data
.
onlyPosi
tive
=
false
;
}
}
tt
=
tt
+
Math
.
abs
(
targets
[
c
].
values
[
k
].
value
);
tt
=
tt
+
Math
.
abs
(
targets
[
c
].
values
[
k
].
value
);
}
}
...
@@ -4871,7 +4871,7 @@
...
@@ -4871,7 +4871,7 @@
// if we don't need to tune
// if we don't need to tune
if
(
$$
.
config
.
normalized
){
if
(
$$
.
config
.
normalized
){
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
if
(
$$
.
data
.
targets
.
noNega
tive
){
if
(
$$
.
data
.
targets
.
onlyPosi
tive
){
$$
.
cachedRedraw
();
$$
.
cachedRedraw
();
return
;
return
;
}
}
...
@@ -4886,10 +4886,14 @@
...
@@ -4886,10 +4886,14 @@
sizesX
=
$$
.
getAbscissa
(
$$
.
config
.
ed3Type
,
minmax
.
minX
,
minmax
.
maxX
);
sizesX
=
$$
.
getAbscissa
(
$$
.
config
.
ed3Type
,
minmax
.
minX
,
minmax
.
maxX
);
}
}
var
sizesY
=
$$
.
getAxisData
(
minmax
.
minY
,
minmax
.
maxY
);
var
sizesY
=
$$
.
getAxisData
(
minmax
.
minY
,
minmax
.
maxY
);
if
(
$$
.
config
.
normalized
){
if
(
$$
.
config
.
normalized
){
sizesY
.
max
=
Math
.
min
(
sizesY
.
max
,
1
);
sizesY
.
max
=
Math
.
min
(
sizesY
.
max
,
1
);
sizesY
.
min
=
Math
.
max
(
sizesY
.
min
,
-
1
);
sizesY
.
min
=
Math
.
max
(
sizesY
.
min
,
-
1
);
sizesY
.
max
=
Math
.
min
(
sizesY
.
max
,
minmax
.
maxY
);
sizesY
.
min
=
Math
.
max
(
sizesY
.
min
,
minmax
.
minY
);
}
}
$$
.
api
.
axis
.
range
({
$$
.
api
.
axis
.
range
({
...
...
c3.min.js
View file @
6071db2b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/axis.js
View file @
6071db2b
...
@@ -381,7 +381,7 @@ c3_chart_internal_fn.tuneAxis = function(sync, callback){
...
@@ -381,7 +381,7 @@ c3_chart_internal_fn.tuneAxis = function(sync, callback){
// if we don't need to tune
// if we don't need to tune
if
(
$$
.
config
.
normalized
){
if
(
$$
.
config
.
normalized
){
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
$$
.
data
.
targets
=
$$
.
normalize
(
$$
.
data
.
_targets
);
if
(
$$
.
data
.
targets
.
noNega
tive
){
if
(
$$
.
data
.
targets
.
onlyPosi
tive
){
$$
.
cachedRedraw
();
$$
.
cachedRedraw
();
return
;
return
;
}
}
...
@@ -396,10 +396,14 @@ c3_chart_internal_fn.tuneAxis = function(sync, callback){
...
@@ -396,10 +396,14 @@ c3_chart_internal_fn.tuneAxis = function(sync, callback){
sizesX
=
$$
.
getAbscissa
(
$$
.
config
.
ed3Type
,
minmax
.
minX
,
minmax
.
maxX
);
sizesX
=
$$
.
getAbscissa
(
$$
.
config
.
ed3Type
,
minmax
.
minX
,
minmax
.
maxX
);
}
}
var
sizesY
=
$$
.
getAxisData
(
minmax
.
minY
,
minmax
.
maxY
);
var
sizesY
=
$$
.
getAxisData
(
minmax
.
minY
,
minmax
.
maxY
);
if
(
$$
.
config
.
normalized
){
if
(
$$
.
config
.
normalized
){
sizesY
.
max
=
Math
.
min
(
sizesY
.
max
,
1
);
sizesY
.
max
=
Math
.
min
(
sizesY
.
max
,
1
);
sizesY
.
min
=
Math
.
max
(
sizesY
.
min
,
-
1
);
sizesY
.
min
=
Math
.
max
(
sizesY
.
min
,
-
1
);
sizesY
.
max
=
Math
.
min
(
sizesY
.
max
,
minmax
.
maxY
);
sizesY
.
min
=
Math
.
max
(
sizesY
.
min
,
minmax
.
minY
);
}
}
$$
.
api
.
axis
.
range
({
$$
.
api
.
axis
.
range
({
...
...
src/stacked.js
View file @
6071db2b
...
@@ -7,7 +7,7 @@ c3.chart.internal.fn.normalize = function(targets){
...
@@ -7,7 +7,7 @@ c3.chart.internal.fn.normalize = function(targets){
var
data
=
[];
var
data
=
[];
data
.
noNega
tive
=
true
;
data
.
onlyPosi
tive
=
true
;
targets
.
forEach
(
function
(
target
){
targets
.
forEach
(
function
(
target
){
data
.
push
(
$$
.
cloneTarget
(
target
));
data
.
push
(
$$
.
cloneTarget
(
target
));
...
@@ -18,7 +18,7 @@ c3.chart.internal.fn.normalize = function(targets){
...
@@ -18,7 +18,7 @@ c3.chart.internal.fn.normalize = function(targets){
for
(
c
in
targets
)
{
for
(
c
in
targets
)
{
if
(
targets
[
c
].
values
[
k
]){
if
(
targets
[
c
].
values
[
k
]){
if
(
targets
[
c
].
values
[
k
].
value
<
0
){
if
(
targets
[
c
].
values
[
k
].
value
<
0
){
data
.
noNega
tive
=
false
;
data
.
onlyPosi
tive
=
false
;
}
}
tt
=
tt
+
Math
.
abs
(
targets
[
c
].
values
[
k
].
value
);
tt
=
tt
+
Math
.
abs
(
targets
[
c
].
values
[
k
].
value
);
}
}
...
...
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