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
Evgeny
c3-closed
Commits
25b2312d
Commit
25b2312d
authored
Apr 01, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add data.label.format option - #106
parent
95c960e8
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
16 deletions
+25
-16
c3.js
c3.js
+25
-16
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
25b2312d
...
...
@@ -62,7 +62,6 @@
INCLUDED
:
'_included_'
,
};
c3
.
version
=
"0.1.24"
;
/*
...
...
@@ -1487,16 +1486,13 @@
function
opacityForCircle
(
d
)
{
return
isValue
(
d
.
value
)
?
isScatterType
(
d
)
?
0.5
:
1
:
0
;
}
function
opacityForText
(
d
)
{
return
hasDataLabel
(
d
)
?
1
:
0
;
function
opacityForText
()
{
return
hasDataLabel
()
?
1
:
0
;
}
function
hasDataLabel
(
d
)
{
var
id
=
d
?
d
.
id
:
null
;
function
hasDataLabel
()
{
if
(
typeof
__data_labels
===
'boolean'
&&
__data_labels
)
{
return
true
;
}
else
if
(
__data_labels
[
id
]
===
'boolean'
&&
__data_labels
[
id
])
{
return
true
;
}
else
if
(
__data_labels
[
id
]
&&
__data_labels
[
id
].
show
)
{
}
else
if
(
typeof
__data_labels
===
'object'
)
{
return
true
;
}
return
false
;
...
...
@@ -1512,6 +1508,26 @@
return
widths
;
}
function
defaultValueFormat
(
v
)
{
var
yFormat
=
__axis_y_tick_format
?
__axis_y_tick_format
:
function
(
v
)
{
return
isValue
(
v
)
?
+
v
:
""
;
};
return
yFormat
(
v
);
}
function
defaultArcValueFormat
(
v
,
ratio
)
{
return
(
ratio
*
100
).
toFixed
(
1
)
+
'%'
;
}
function
formatByAxisId
(
id
)
{
var
defaultFormat
=
function
(
v
)
{
return
isValue
(
v
)
?
+
v
:
""
;
},
axisId
=
getAxisId
(
id
),
format
=
defaultFormat
;
// find format according to axis id
if
(
typeof
__data_labels
.
format
===
'function'
)
{
format
=
__data_labels
.
format
;
}
else
if
(
typeof
__data_labels
.
format
===
'object'
)
{
if
(
typeof
__data_labels
.
format
[
axisId
]
===
'function'
)
{
format
=
__data_labels
.
format
[
axisId
];
}
}
return
format
;
}
function
xx
(
d
)
{
return
d
?
x
(
d
.
x
)
:
null
;
}
...
...
@@ -1524,13 +1540,6 @@
function
subxx
(
d
)
{
return
subX
(
d
.
x
);
}
function
defaultValueFormat
(
v
)
{
var
yFormat
=
__axis_y_tick_format
?
__axis_y_tick_format
:
function
(
v
)
{
return
isValue
(
v
)
?
+
v
:
""
;
};
return
yFormat
(
v
);
}
function
defaultArcValueFormat
(
v
,
ratio
)
{
return
(
ratio
*
100
).
toFixed
(
1
)
+
'%'
;
}
function
findSameXOfValues
(
values
,
index
)
{
var
i
,
targetX
=
values
[
index
].
x
,
sames
=
[];
...
...
@@ -2983,7 +2992,7 @@
.
style
(
"stroke"
,
'none'
)
.
style
(
"fill-opacity"
,
0
);
mainText
.
text
(
function
(
d
)
{
return
defaultValueFormat
(
d
.
value
);
})
.
text
(
function
(
d
)
{
return
formatByAxisId
(
d
.
id
)
(
d
.
value
);
})
.
style
(
"fill-opacity"
,
initialOpacityForText
)
.
transition
().
duration
(
duration
)
.
attr
(
'x'
,
xForText
)
...
...
c3.min.js
View file @
25b2312d
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