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
691e17eb
Commit
691e17eb
authored
Apr 28, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tooltip value format for y2 - #159
parent
9eb92e63
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
c3.js
c3.js
+26
-15
c3.min.js
c3.min.js
+0
-0
No files found.
c3.js
View file @
691e17eb
...
...
@@ -264,7 +264,7 @@
}
name
=
d
[
i
].
name
;
value
=
valueFormat
(
d
[
i
].
value
,
d
[
i
].
ratio
);
value
=
valueFormat
(
d
[
i
].
value
,
d
[
i
].
ratio
,
d
[
i
].
id
);
text
+=
"<tr class='"
+
CLASS
.
tooltipName
+
"-"
+
d
[
i
].
id
+
"'>"
;
text
+=
"<td class='name'><span style='background-color:"
+
color
(
d
[
i
].
id
)
+
"'></span>"
+
name
+
"</td>"
;
...
...
@@ -1765,10 +1765,24 @@
.
remove
();
return
widths
;
}
function
getYFormat
(
forArc
)
{
var
formatForY
=
forArc
?
defaultArcValueFormat
:
yFormat
,
formatForY2
=
forArc
?
defaultArcValueFormat
:
y2Format
;
return
function
(
v
,
ratio
,
id
)
{
var
format
=
getAxisId
(
id
)
===
'y2'
?
formatForY2
:
formatForY
;
return
format
(
v
,
ratio
);
};
}
function
yFormat
(
v
)
{
var
format
=
__axis_y_tick_format
?
__axis_y_tick_format
:
defaultValueFormat
;
return
format
(
v
);
}
function
y2Format
(
v
)
{
var
format
=
__axis_y2_tick_format
?
__axis_y2_tick_format
:
defaultValueFormat
;
return
format
(
v
);
}
function
defaultValueFormat
(
v
)
{
var
yFormat
=
__axis_y_tick_format
?
__axis_y_tick_format
:
function
(
v
)
{
return
isValue
(
v
)
?
+
v
:
""
;
};
return
yFormat
(
v
);
return
isValue
(
v
)
?
+
v
:
""
;
}
function
defaultArcValueFormat
(
v
,
ratio
)
{
return
(
ratio
*
100
).
toFixed
(
1
)
+
'%'
;
...
...
@@ -1899,16 +1913,13 @@
//-- Tooltip --//
function
showTooltip
(
selectedData
,
mouse
)
{
var
tWidth
,
tHeight
;
var
svgLeft
,
tooltipLeft
,
tooltipRight
,
tooltipTop
,
chartRight
;
var
forArc
=
hasArcType
(
c3
.
data
.
targets
);
var
valueFormat
=
forArc
?
defaultArcValueFormat
:
defaultValueFormat
;
var
dataToShow
=
selectedData
.
filter
(
function
(
d
)
{
return
d
&&
isValue
(
d
.
value
);
});
if
(
!
__tooltip_show
)
{
return
;
}
// don't show tooltip when no data
if
(
dataToShow
.
length
===
0
)
{
return
;
}
// Construct tooltip
tooltip
.
html
(
__tooltip_contents
(
selectedData
,
getXAxisTickFormat
(),
valueFormat
,
color
)).
style
(
"display"
,
"block"
);
var
tWidth
,
tHeight
,
svgLeft
,
tooltipLeft
,
tooltipRight
,
tooltipTop
,
chartRight
;
var
forArc
=
hasArcType
(
c3
.
data
.
targets
),
dataToShow
=
selectedData
.
filter
(
function
(
d
)
{
return
d
&&
isValue
(
d
.
value
);
});
if
(
dataToShow
.
length
===
0
||
!
__tooltip_show
)
{
return
;
}
tooltip
.
html
(
__tooltip_contents
(
selectedData
,
getXAxisTickFormat
(),
getYFormat
(
forArc
),
color
)).
style
(
"display"
,
"block"
);
// Get tooltip dimensions
tWidth
=
tooltip
.
property
(
'offsetWidth'
);
tHeight
=
tooltip
.
property
(
'offsetHeight'
);
...
...
@@ -2778,7 +2789,7 @@
}
tooltip
.
html
(
__tooltip_contents
(
c3
.
data
.
targets
.
map
(
function
(
d
)
{
return
addName
(
d
.
values
[
__tooltip_init_x
]);
}),
getXAxisTickFormat
(),
defaultValueFormat
,
color
));
}),
getXAxisTickFormat
(),
getYFormat
(
hasArcType
(
c3
.
data
.
targets
))
,
color
));
tooltip
.
style
(
"top"
,
__tooltip_init_position
.
top
)
.
style
(
"left"
,
__tooltip_init_position
.
left
)
.
style
(
"display"
,
"block"
);
...
...
c3.min.js
View file @
691e17eb
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