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
61705c2b
Commit
61705c2b
authored
Nov 03, 2014
by
Masayuki Tanaka
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do not recompute padding left on showing tooltip - #637
parent
4faf31a3
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
20 deletions
+26
-20
c3.js
c3.js
+13
-10
c3.min.js
c3.min.js
+0
-0
size.js
src/size.js
+11
-7
tooltip.js
src/tooltip.js
+2
-3
No files found.
c3.js
View file @
61705c2b
...
...
@@ -2414,14 +2414,14 @@
var
config
=
this
.
config
;
return
isValue
(
config
.
padding_bottom
)
?
config
.
padding_bottom
:
0
;
};
c3_chart_internal_fn
.
getCurrentPaddingLeft
=
function
()
{
c3_chart_internal_fn
.
getCurrentPaddingLeft
=
function
(
withoutRecompute
)
{
var
$$
=
this
,
config
=
$$
.
config
;
if
(
isValue
(
config
.
padding_left
))
{
return
config
.
padding_left
;
}
else
if
(
config
.
axis_rotated
)
{
return
!
config
.
axis_x_show
?
1
:
Math
.
max
(
ceil10
(
$$
.
getAxisWidthByAxisId
(
'x'
)),
40
);
return
!
config
.
axis_x_show
?
1
:
Math
.
max
(
ceil10
(
$$
.
getAxisWidthByAxisId
(
'x'
,
withoutRecompute
)),
40
);
}
else
{
return
!
config
.
axis_y_show
?
1
:
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y'
));
return
!
config
.
axis_y_show
?
1
:
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y'
,
withoutRecompute
));
}
};
c3_chart_internal_fn
.
getCurrentPaddingRight
=
function
()
{
...
...
@@ -2456,21 +2456,25 @@
};
c3_chart_internal_fn
.
getSvgLeft
=
function
()
{
c3_chart_internal_fn
.
getSvgLeft
=
function
(
withoutRecompute
)
{
var
$$
=
this
,
config
=
$$
.
config
,
leftAxisClass
=
config
.
axis_rotated
?
CLASS
.
axisX
:
CLASS
.
axisY
,
leftAxis
=
$$
.
main
.
select
(
'.'
+
leftAxisClass
).
node
(),
svgRect
=
leftAxis
?
leftAxis
.
getBoundingClientRect
()
:
{
right
:
0
},
chartRect
=
$$
.
selectChart
.
node
().
getBoundingClientRect
(),
hasArc
=
$$
.
hasArcType
(),
svgLeft
=
svgRect
.
right
-
chartRect
.
left
-
(
hasArc
?
0
:
$$
.
getCurrentPaddingLeft
());
svgLeft
=
svgRect
.
right
-
chartRect
.
left
-
(
hasArc
?
0
:
$$
.
getCurrentPaddingLeft
(
withoutRecompute
));
return
svgLeft
>
0
?
svgLeft
:
0
;
};
c3_chart_internal_fn
.
getAxisWidthByAxisId
=
function
(
id
)
{
c3_chart_internal_fn
.
getAxisWidthByAxisId
=
function
(
id
,
withoutRecompute
)
{
var
$$
=
this
,
position
=
$$
.
getAxisLabelPositionById
(
id
);
return
position
.
isInner
?
20
+
$$
.
getMaxTickWidth
(
id
)
:
40
+
$$
.
getMaxTickWidth
(
id
);
if
(
withoutRecompute
)
{
var
box
=
$$
.
d3
.
select
(
'.c3-axis-y'
).
node
().
getBoundingClientRect
();
return
Math
.
floor
(
box
.
left
+
box
.
width
);
}
return
$$
.
getMaxTickWidth
(
id
)
+
(
position
.
isInner
?
20
:
40
);
};
c3_chart_internal_fn
.
getHorizontalAxisHeight
=
function
(
axisId
)
{
var
$$
=
this
,
config
=
$$
.
config
,
h
=
30
;
...
...
@@ -3534,15 +3538,14 @@
tooltipLeft
=
(
$$
.
width
/
2
)
+
mouse
[
0
];
tooltipTop
=
(
$$
.
height
/
2
)
+
mouse
[
1
]
+
20
;
}
else
{
svgLeft
=
$$
.
getSvgLeft
(
false
);
if
(
config
.
axis_rotated
)
{
svgLeft
=
$$
.
getSvgLeft
();
tooltipLeft
=
svgLeft
+
mouse
[
0
]
+
100
;
tooltipRight
=
tooltipLeft
+
tWidth
;
chartRight
=
$$
.
getCurrentWidth
()
-
$$
.
getCurrentPaddingRight
();
tooltipTop
=
$$
.
x
(
dataToShow
[
0
].
x
)
+
20
;
}
else
{
svgLeft
=
$$
.
getSvgLeft
();
tooltipLeft
=
svgLeft
+
$$
.
getCurrentPaddingLeft
()
+
$$
.
x
(
dataToShow
[
0
].
x
)
+
20
;
tooltipLeft
=
svgLeft
+
$$
.
getCurrentPaddingLeft
(
false
)
+
$$
.
x
(
dataToShow
[
0
].
x
)
+
20
;
tooltipRight
=
tooltipLeft
+
tWidth
;
chartRight
=
svgLeft
+
$$
.
getCurrentWidth
()
-
$$
.
getCurrentPaddingRight
();
tooltipTop
=
mouse
[
1
]
+
15
;
...
...
c3.min.js
View file @
61705c2b
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/size.js
View file @
61705c2b
...
...
@@ -15,14 +15,14 @@ c3_chart_internal_fn.getCurrentPaddingBottom = function () {
var
config
=
this
.
config
;
return
isValue
(
config
.
padding_bottom
)
?
config
.
padding_bottom
:
0
;
};
c3_chart_internal_fn
.
getCurrentPaddingLeft
=
function
()
{
c3_chart_internal_fn
.
getCurrentPaddingLeft
=
function
(
withoutRecompute
)
{
var
$$
=
this
,
config
=
$$
.
config
;
if
(
isValue
(
config
.
padding_left
))
{
return
config
.
padding_left
;
}
else
if
(
config
.
axis_rotated
)
{
return
!
config
.
axis_x_show
?
1
:
Math
.
max
(
ceil10
(
$$
.
getAxisWidthByAxisId
(
'x'
)),
40
);
return
!
config
.
axis_x_show
?
1
:
Math
.
max
(
ceil10
(
$$
.
getAxisWidthByAxisId
(
'x'
,
withoutRecompute
)),
40
);
}
else
{
return
!
config
.
axis_y_show
?
1
:
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y'
));
return
!
config
.
axis_y_show
?
1
:
ceil10
(
$$
.
getAxisWidthByAxisId
(
'y'
,
withoutRecompute
));
}
};
c3_chart_internal_fn
.
getCurrentPaddingRight
=
function
()
{
...
...
@@ -57,21 +57,25 @@ c3_chart_internal_fn.getParentHeight = function () {
};
c3_chart_internal_fn
.
getSvgLeft
=
function
()
{
c3_chart_internal_fn
.
getSvgLeft
=
function
(
withoutRecompute
)
{
var
$$
=
this
,
config
=
$$
.
config
,
leftAxisClass
=
config
.
axis_rotated
?
CLASS
.
axisX
:
CLASS
.
axisY
,
leftAxis
=
$$
.
main
.
select
(
'.'
+
leftAxisClass
).
node
(),
svgRect
=
leftAxis
?
leftAxis
.
getBoundingClientRect
()
:
{
right
:
0
},
chartRect
=
$$
.
selectChart
.
node
().
getBoundingClientRect
(),
hasArc
=
$$
.
hasArcType
(),
svgLeft
=
svgRect
.
right
-
chartRect
.
left
-
(
hasArc
?
0
:
$$
.
getCurrentPaddingLeft
());
svgLeft
=
svgRect
.
right
-
chartRect
.
left
-
(
hasArc
?
0
:
$$
.
getCurrentPaddingLeft
(
withoutRecompute
));
return
svgLeft
>
0
?
svgLeft
:
0
;
};
c3_chart_internal_fn
.
getAxisWidthByAxisId
=
function
(
id
)
{
c3_chart_internal_fn
.
getAxisWidthByAxisId
=
function
(
id
,
withoutRecompute
)
{
var
$$
=
this
,
position
=
$$
.
getAxisLabelPositionById
(
id
);
return
position
.
isInner
?
20
+
$$
.
getMaxTickWidth
(
id
)
:
40
+
$$
.
getMaxTickWidth
(
id
);
if
(
withoutRecompute
)
{
var
box
=
$$
.
d3
.
select
(
'.c3-axis-y'
).
node
().
getBoundingClientRect
();
return
Math
.
floor
(
box
.
left
+
box
.
width
);
}
return
$$
.
getMaxTickWidth
(
id
)
+
(
position
.
isInner
?
20
:
40
);
};
c3_chart_internal_fn
.
getHorizontalAxisHeight
=
function
(
axisId
)
{
var
$$
=
this
,
config
=
$$
.
config
,
h
=
30
;
...
...
src/tooltip.js
View file @
61705c2b
...
...
@@ -67,15 +67,14 @@ c3_chart_internal_fn.showTooltip = function (selectedData, mouse) {
tooltipLeft
=
(
$$
.
width
/
2
)
+
mouse
[
0
];
tooltipTop
=
(
$$
.
height
/
2
)
+
mouse
[
1
]
+
20
;
}
else
{
svgLeft
=
$$
.
getSvgLeft
(
false
);
if
(
config
.
axis_rotated
)
{
svgLeft
=
$$
.
getSvgLeft
();
tooltipLeft
=
svgLeft
+
mouse
[
0
]
+
100
;
tooltipRight
=
tooltipLeft
+
tWidth
;
chartRight
=
$$
.
getCurrentWidth
()
-
$$
.
getCurrentPaddingRight
();
tooltipTop
=
$$
.
x
(
dataToShow
[
0
].
x
)
+
20
;
}
else
{
svgLeft
=
$$
.
getSvgLeft
();
tooltipLeft
=
svgLeft
+
$$
.
getCurrentPaddingLeft
()
+
$$
.
x
(
dataToShow
[
0
].
x
)
+
20
;
tooltipLeft
=
svgLeft
+
$$
.
getCurrentPaddingLeft
(
false
)
+
$$
.
x
(
dataToShow
[
0
].
x
)
+
20
;
tooltipRight
=
tooltipLeft
+
tWidth
;
chartRight
=
svgLeft
+
$$
.
getCurrentWidth
()
-
$$
.
getCurrentPaddingRight
();
tooltipTop
=
mouse
[
1
]
+
15
;
...
...
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