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
0468c30b
Commit
0468c30b
authored
Apr 27, 2016
by
Дмитрий Никулин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update c3.js and c3.min.js
parent
0d1593db
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
165 deletions
+14
-165
c3.js
c3.js
+14
-165
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
0468c30b
...
...
@@ -228,9 +228,23 @@
return
c3
;
}
var
injectedMethods
=
[
'getAxisData'
,
'getAbscissa'
];
function
Chart
(
config
)
{
var
$$
=
this
.
internal
=
new
ChartInternal
(
this
);
$$
.
ed3Config
=
config
.
ed3Config
;
// We have to pass some methods from ed3
if
(
!
config
.
inject
)
{
throw
new
Error
(
'You have to set config.inject'
);
}
injectedMethods
.
forEach
(
function
(
fn
){
if
(
typeof
config
.
inject
[
fn
]
!==
'function'
){
throw
new
Error
(
'You have to set '
+
fn
+
' function in config'
);
}
$$
[
fn
]
=
config
.
inject
[
fn
];
});
$$
.
loadConfig
(
config
);
$$
.
init
();
...
...
@@ -5091,171 +5105,6 @@
};
function
log10
(
n
)
{
return
Math
.
log
(
n
)
/
Math
.
log
(
10
);
}
function
log
(
n
,
m
)
{
return
Math
.
log
(
n
)
/
Math
.
log
(
m
);
}
c3_chart_internal_fn
.
getAbscissa
=
function
(
type
,
min
,
max
)
{
var
$$
=
this
;
var
axis
=
{};
switch
(
type
)
{
case
'area'
:
case
'area-stacked'
:
case
'area-stacked-100'
:
axis
.
min
=
1
;
axis
.
max
=
max
;
axis
.
step
=
1
;
break
;
case
'bar'
:
case
'bar-stacked'
:
case
'bar-stacked-100'
:
axis
=
$$
.
getAxisData
(
min
,
max
,
true
);
break
;
case
'column'
:
case
'column-stacked'
:
case
'column-stacked-100'
:
axis
.
min
=
1
;
axis
.
max
=
max
;
axis
.
step
=
1
;
break
;
case
'line-m'
:
case
'line'
:
case
'line-stacked-m'
:
case
'line-stacked'
:
case
'line-stacked-100-m'
:
case
'line-stacked-100'
:
axis
.
min
=
1
;
axis
.
max
=
max
;
axis
.
step
=
1
;
break
;
case
'xy-m'
:
case
'xy-smooth-m'
:
case
'xy-smooth'
:
case
'xy-straight-m'
:
case
'xy-straight'
:
axis
=
$$
.
getAxisData
(
min
,
max
,
true
);
break
;
default
:
throw
new
Error
(
"Unsupported type for axis "
+
type
);
}
return
axis
;
};
c3_chart_internal_fn
.
getAxisData
=
function
(
min
,
max
,
isAbscissa
)
{
var
$$
=
this
;
isAbscissa
=
isAbscissa
||
false
;
var
axis
=
{};
if
(
min
===
0
&&
max
===
0
)
{
axis
.
step
=
0.1
;
axis
.
min
=
0
;
axis
.
max
=
1
;
return
axis
;
}
var
min4calc
=
0
;
var
max4calc
=
0
;
if
(
min
!=
max
)
{
min4calc
=
Math
.
min
(
min
);
max4calc
=
Math
.
max
(
max
);
}
else
{
min4calc
=
signMin
>
0
?
0
:
min
;
max4calc
=
signMin
>
0
?
max
:
0
;
}
var
signMin
=
min4calc
===
0
?
0
:
min4calc
/
Math
.
abs
(
min4calc
);
var
signMax
=
max4calc
===
0
?
0
:
max4calc
/
Math
.
abs
(
max4calc
);
var
absMax4calc
=
Math
.
max
(
Math
.
abs
(
min
),
Math
.
abs
(
max
));
var
absMin4calc
=
Math
.
min
(
Math
.
abs
(
min
),
Math
.
abs
(
max
));
var
signAbsMax4calc
=
Math
.
abs
(
max
)
>
Math
.
abs
(
min
)
?
signMax
:
signMin
;
var
signAbsMin4calc
=
Math
.
abs
(
max
)
<
Math
.
abs
(
min
)
?
signMax
:
signMin
;
var
isBrokenAxis
=
Math
.
abs
(
Math
.
abs
(
max
)
-
Math
.
abs
(
min
))
<
(
Math
.
abs
(
max
)
>
Math
.
abs
(
min
)?
Math
.
abs
(
max
):
Math
.
abs
(
min
))
*
0.2
&&
signMin
==
signMax
;
var
delta
=
0
;
if
(
isBrokenAxis
)
{
delta
=
Math
.
abs
(
max4calc
-
min4calc
);
}
else
{
if
(
signMin
==
signMax
)
{
delta
=
Math
.
abs
(
max4calc
)
>
Math
.
abs
(
min4calc
)
?
Math
.
abs
(
max4calc
)
:
Math
.
abs
(
min4calc
);
}
else
{
delta
=
Math
.
abs
(
max4calc
-
min4calc
);
}
}
var
basePow
=
log10
(
delta
);
var
normalize
=
delta
/
Math
.
pow
(
10
,
Math
.
floor
(
basePow
));
var
peak
=
normalize
*
1.05
;
if
(
isBrokenAxis
)
{
peak
=
peak
*
1.5
;
}
var
normalizestep
=
0
;
if
(
!
isAbscissa
)
{
if
(
peak
<
2
)
{
normalizestep
=
0.2
;
}
else
if
(
peak
<
5
)
{
normalizestep
=
0.5
;
}
else
if
(
peak
>
10
)
{
normalizestep
=
2
;
}
else
{
normalizestep
=
1
;
}
}
else
{
if
(
peak
<
1.8
)
{
normalizestep
=
0.2
;
}
else
if
(
peak
<
4.5
)
{
normalizestep
=
0.5
;
}
else
if
(
peak
>
9
)
{
normalizestep
=
2
;
}
else
{
normalizestep
=
1
;
}
}
axis
.
step
=
normalizestep
*
Math
.
pow
(
10
,
Math
.
floor
(
basePow
));
var
axisMax
=
0
;
var
axisMin
=
0
;
if
(
!
isBrokenAxis
)
{
if
(
signMin
==
signMax
||
signMin
===
0
||
signMax
===
0
)
{
axisMin
=
0
;
axisMax
=
Math
.
ceil
(
absMax4calc
*
1.05
/
axis
.
step
)
*
axis
.
step
*
(
signAbsMax4calc
);
}
else
{
axisMax
=
Math
.
ceil
(
max4calc
*
1.05
/
axis
.
step
)
*
(
axis
.
step
);
axisMin
=
Math
.
floor
(((
max4calc
-
(
max4calc
-
min4calc
)
*
1.05
))
/
axis
.
step
)
*
(
axis
.
step
);
}
}
else
{
axisMin
=
Math
.
floor
((
absMin4calc
-
(
absMax4calc
-
absMin4calc
)
/
2
)
/
axis
.
step
)
*
axis
.
step
*
signAbsMin4calc
;
axisMax
=
Math
.
ceil
(((
absMax4calc
-
absMin4calc
)
*
1.075
+
absMin4calc
)
/
axis
.
step
)
*
axis
.
step
*
signAbsMax4calc
;
}
axis
.
min
=
Math
.
min
(
axisMin
,
axisMax
);
axis
.
max
=
Math
.
max
(
axisMin
,
axisMax
);
return
axis
;
};
c3_chart_internal_fn
.
findMinMax
=
function
()
{
var
$$
=
this
;
var
minY
,
maxY
,
minX
,
maxX
;
...
...
c3.min.js
View file @
0468c30b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
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