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
d8286e49
Commit
d8286e49
authored
Mar 02, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Show formatted value in bar text - #45
parent
b6220106
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
c3.js
c3.js
+7
-4
No files found.
c3.js
View file @
d8286e49
...
@@ -139,8 +139,7 @@
...
@@ -139,8 +139,7 @@
// tooltip - show when mouseover on each data
// tooltip - show when mouseover on each data
var
__tooltip_enabled
=
getConfig
([
'tooltip'
,
'enabled'
],
true
),
var
__tooltip_enabled
=
getConfig
([
'tooltip'
,
'enabled'
],
true
),
__tooltip_contents
=
getConfig
([
'tooltip'
,
'contents'
],
function
(
d
)
{
__tooltip_contents
=
getConfig
([
'tooltip'
,
'contents'
],
function
(
d
)
{
var
yFormat
=
__axis_y_tick_format
?
__axis_y_tick_format
:
function
(
v
)
{
return
+
v
;
},
var
xFormat
=
getXAxisTickFormat
(),
xFormat
=
getXAxisTickFormat
(),
text
,
i
,
title
,
value
,
name
;
text
,
i
,
title
,
value
,
name
;
for
(
i
=
0
;
i
<
d
.
length
;
i
++
)
{
for
(
i
=
0
;
i
<
d
.
length
;
i
++
)
{
if
(
!
d
[
i
]
||
!
isValue
(
d
[
i
].
value
))
{
continue
;
}
if
(
!
d
[
i
]
||
!
isValue
(
d
[
i
].
value
))
{
continue
;
}
...
@@ -151,7 +150,7 @@
...
@@ -151,7 +150,7 @@
}
}
name
=
d
[
i
].
name
;
name
=
d
[
i
].
name
;
value
=
yFormat
(
d
[
i
].
value
);
value
=
formattedValue
(
d
[
i
].
value
);
text
+=
"<tr class='-tooltip-name-"
+
d
[
i
].
id
+
"'><td class='name'><span style='background-color:"
+
color
(
d
[
i
].
id
)
+
"'></span>"
+
name
+
"</td><td class='value'>"
+
value
+
"</td></tr>"
;
text
+=
"<tr class='-tooltip-name-"
+
d
[
i
].
id
+
"'><td class='name'><span style='background-color:"
+
color
(
d
[
i
].
id
)
+
"'></span>"
+
name
+
"</td><td class='value'>"
+
value
+
"</td></tr>"
;
}
}
...
@@ -894,6 +893,10 @@
...
@@ -894,6 +893,10 @@
function
subxx
(
d
)
{
function
subxx
(
d
)
{
return
subX
(
d
.
x
);
return
subX
(
d
.
x
);
}
}
function
formattedValue
(
v
)
{
var
yFormat
=
__axis_y_tick_format
?
__axis_y_tick_format
:
function
(
v
)
{
return
+
v
;
};
return
yFormat
(
v
);
}
function
findSameXOfValues
(
values
,
index
)
{
function
findSameXOfValues
(
values
,
index
)
{
var
i
,
targetX
=
values
[
index
].
x
,
sames
=
[];
var
i
,
targetX
=
values
[
index
].
x
,
sames
=
[];
...
@@ -2238,7 +2241,7 @@
...
@@ -2238,7 +2241,7 @@
.
attr
(
'dy'
,
'.32em'
)
.
attr
(
'dy'
,
'.32em'
)
.
style
(
"stroke"
,
'none'
)
.
style
(
"stroke"
,
'none'
)
.
style
(
"opacity"
,
0
)
.
style
(
"opacity"
,
0
)
.
text
(
function
(
d
)
{
return
d3
.
format
(
',.2f'
)
(
d
.
value
);
})
.
text
(
function
(
d
)
{
return
formattedValue
(
d
.
value
);
})
.
attr
(
"class"
,
classTextBar
);
.
attr
(
"class"
,
classTextBar
);
mainBarTxt
mainBarTxt
.
style
(
"opacity"
,
initialOpacity
)
.
style
(
"opacity"
,
initialOpacity
)
...
...
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