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
7daf0dbb
Commit
7daf0dbb
authored
Mar 17, 2016
by
Дмитрий Никулин
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update c3.js and c3.min.js
parent
a72262cb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
7 deletions
+55
-7
c3.js
c3.js
+55
-7
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
7daf0dbb
...
@@ -219,9 +219,14 @@
...
@@ -219,9 +219,14 @@
};
};
var
__filename
;
// used in Node.js to get css file using path
var
c3_chart_fn
,
c3_chart_internal_fn
;
var
c3
=
{
version
:
"0.4.9"
};
var
c3
=
{
version
:
"0.4.9"
};
var
c3_chart_fn
,
c3_chart_internal_fn
;
var
c3init
=
function
(
module
){
__filename
=
module
.
uri
;
return
c3
;
}
function
Chart
(
config
)
{
function
Chart
(
config
)
{
var
$$
=
this
.
internal
=
new
ChartInternal
(
this
);
var
$$
=
this
.
internal
=
new
ChartInternal
(
this
);
...
@@ -264,9 +269,52 @@
...
@@ -264,9 +269,52 @@
c3_chart_internal_fn
=
c3
.
chart
.
internal
.
fn
;
c3_chart_internal_fn
=
c3
.
chart
.
internal
.
fn
;
var
nodeCss
;
var
styleCache
=
{};
// Seek a specific value in the stylesheets of a document
// Seek a specific value in the stylesheets of a document
function
getStyleValue
(
selector
,
property
)
{
function
getStyleValue
(
$$
,
selector
,
property
)
{
function
cache
(
value
){
if
(
!
styleCache
[
selector
]){
styleCache
[
selector
]
=
{};
}
styleCache
[
selector
][
property
]
=
value
.
trim
();
return
styleCache
[
selector
][
property
];
}
if
(
styleCache
[
selector
]
&&
styleCache
[
selector
][
property
]){
return
styleCache
[
selector
][
property
];
}
var
css
,
rule
,
sheet
,
value
;
var
css
,
rule
,
sheet
,
value
;
if
(
isNode
()){
if
(
!
nodeCss
){
var
style
=
require
(
'fs'
).
readFileSync
(
__filename
.
replace
(
'c3.js'
,
'c3.css'
),
'utf-8'
);
nodeCss
=
[
require
(
'css'
).
parse
(
style
),
require
(
'css'
).
parse
(
$$
.
ed3Config
.
style
)];
}
var
obj
,
rule
,
sel
,
decl
;
for
(
var
i
=
0
;
i
<
nodeCss
.
length
;
i
++
){
obj
=
nodeCss
[
i
];
for
(
var
j
=
0
;
j
<
obj
.
stylesheet
.
rules
.
length
;
j
++
){
rule
=
obj
.
stylesheet
.
rules
[
j
];
if
(
!
rule
.
selectors
)
continue
;
for
(
var
k
=
0
;
k
<
rule
.
selectors
.
length
;
k
++
){
sel
=
rule
.
selectors
[
k
];
for
(
var
l
=
0
;
l
<
rule
.
declarations
.
length
;
l
++
){
decl
=
rule
.
declarations
[
l
];
if
(
decl
.
property
===
property
){
return
cache
(
decl
.
value
);
}
}
}
}
}
console
.
log
(
'Style not found: '
,
selector
,
'->'
,
property
);
return
undefined
;
}
for
(
var
styleId
=
0
;
styleId
<
document
.
styleSheets
.
length
;
styleId
++
)
{
for
(
var
styleId
=
0
;
styleId
<
document
.
styleSheets
.
length
;
styleId
++
)
{
sheet
=
document
.
styleSheets
[
styleId
];
sheet
=
document
.
styleSheets
[
styleId
];
for
(
var
ruleId
=
0
;
ruleId
<
sheet
.
cssRules
.
length
;
ruleId
++
)
{
for
(
var
ruleId
=
0
;
ruleId
<
sheet
.
cssRules
.
length
;
ruleId
++
)
{
...
@@ -276,7 +324,7 @@
...
@@ -276,7 +324,7 @@
if
(
css
.
indexOf
(
property
)
!==
-
1
)
{
if
(
css
.
indexOf
(
property
)
!==
-
1
)
{
try
{
try
{
value
=
css
.
split
(
property
)[
1
].
split
(
':'
)[
1
].
split
(
';'
)[
0
];
value
=
css
.
split
(
property
)[
1
].
split
(
':'
)[
1
].
split
(
';'
)[
0
];
return
value
.
trim
(
);
return
cache
(
value
);
}
catch
(
e
)
{
}
catch
(
e
)
{
// Error will be caught in case of incorrect CSS
// Error will be caught in case of incorrect CSS
return
undefined
;
return
undefined
;
...
@@ -3610,7 +3658,7 @@
...
@@ -3610,7 +3658,7 @@
];
];
};
};
c3_chart_internal_fn
.
getTextRect
=
function
(
text
,
cls
)
{
c3_chart_internal_fn
.
getTextRect
=
function
(
text
,
cls
)
{
var
fontSize
=
parseFloat
(
getStyleValue
(
cls
,
'font-size'
));
var
fontSize
=
parseFloat
(
getStyleValue
(
this
,
cls
,
'font-size'
));
return
{
return
{
height
:
fontSize
,
height
:
fontSize
,
...
@@ -4236,7 +4284,7 @@
...
@@ -4236,7 +4284,7 @@
var
hasFocused
=
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItemFocused
).
size
();
var
hasFocused
=
$$
.
legend
.
selectAll
(
'.'
+
CLASS
.
legendItemFocused
).
size
();
var
texts
,
rects
,
tiles
,
background
;
var
texts
,
rects
,
tiles
,
background
;
var
nodeOffset
=
isNode
()
?
3
:
1
;
var
nodeOffset
=
1
;
options
=
options
||
{};
options
=
options
||
{};
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
withTransition
=
getOption
(
options
,
"withTransition"
,
true
);
...
@@ -8183,7 +8231,7 @@
...
@@ -8183,7 +8231,7 @@
tspan
.
enter
().
append
(
'tspan'
);
tspan
.
enter
().
append
(
'tspan'
);
tspan
.
exit
().
remove
();
tspan
.
exit
().
remove
();
var
fontSize
=
parseFloat
(
getStyleValue
(
'.c3-axis-y .tick'
,
'font-size'
));
var
fontSize
=
parseFloat
(
getStyleValue
(
$$
,
'.c3-axis-y .tick'
,
'font-size'
));
tspan
.
text
(
function
(
d
)
{
tspan
.
text
(
function
(
d
)
{
if
(
d
.
splitted
.
length
)
{
if
(
d
.
splitted
.
length
)
{
...
@@ -8316,7 +8364,7 @@
...
@@ -8316,7 +8364,7 @@
};
};
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
if
(
typeof
define
===
'function'
&&
define
.
amd
)
{
define
(
"c3"
,
[
"
d3"
],
c3
);
define
(
"c3"
,
[
"
module"
,
"d3"
],
c3init
);
}
else
if
(
'undefined'
!==
typeof
exports
&&
'undefined'
!==
typeof
module
)
{
}
else
if
(
'undefined'
!==
typeof
exports
&&
'undefined'
!==
typeof
module
)
{
module
.
exports
=
c3
;
module
.
exports
=
c3
;
}
else
{
}
else
{
...
...
c3.min.js
View file @
7daf0dbb
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