Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
1292fb03
Commit
1292fb03
authored
Mar 31, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update tooltip label through setData options
parent
5c9778d1
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
app/assets/javascripts/burndown_chart/burndown_chart.js
app/assets/javascripts/burndown_chart/burndown_chart.js
+7
-6
app/assets/javascripts/burndown_chart/index.js
app/assets/javascripts/burndown_chart/index.js
+1
-1
No files found.
app/assets/javascripts/burndown_chart/burndown_chart.js
View file @
1292fb03
...
...
@@ -22,8 +22,9 @@ export default class BurndownChart {
this
.
xAxisGroup
.
append
(
'
line
'
).
attr
(
'
class
'
,
'
domain-line
'
);
// create y-axis label
this
.
label
=
'
Remaining
'
;
const
yAxisLabel
=
this
.
yAxisGroup
.
append
(
'
g
'
).
attr
(
'
class
'
,
'
axis-label
'
);
this
.
yAxisLabelText
=
yAxisLabel
.
append
(
'
text
'
).
text
(
'
Remaining
'
);
this
.
yAxisLabelText
=
yAxisLabel
.
append
(
'
text
'
).
text
(
this
.
label
);
this
.
yAxisLabelBBox
=
this
.
yAxisLabelText
.
node
().
getBBox
();
this
.
yAxisLabelLineA
=
yAxisLabel
.
append
(
'
line
'
);
this
.
yAxisLabelLineB
=
yAxisLabel
.
append
(
'
line
'
);
...
...
@@ -102,7 +103,7 @@ export default class BurndownChart {
}
// set data and force re-render
setData
(
data
,
label
)
{
setData
(
data
,
{
label
=
'
Remaining
'
,
animate
}
=
{}
)
{
this
.
data
=
data
.
map
(
datum
=>
({
date
:
parseDate
(
datum
[
0
]),
value
:
parseInt
(
datum
[
1
],
10
),
...
...
@@ -117,7 +118,8 @@ export default class BurndownChart {
// calculate the bounding box for the axis label if updated
// (this must be done here to prevent layout thrashing)
if
(
label
!==
undefined
)
{
if
(
this
.
label
!==
label
)
{
this
.
label
=
label
;
this
.
yAxisLabelBBox
=
this
.
yAxisLabelText
.
text
(
label
).
node
().
getBBox
();
}
...
...
@@ -128,7 +130,7 @@ export default class BurndownChart {
this
.
idealData
=
[
idealStart
,
idealEnd
];
}
this
.
scheduleLineAnimation
=
tru
e
;
this
.
scheduleLineAnimation
=
!!
animat
e
;
this
.
scheduleRender
();
}
...
...
@@ -272,8 +274,7 @@ export default class BurndownChart {
// generate tooltip content
const
format
=
d3
.
time
.
format
(
'
%b %-d, %Y
'
);
const
date
=
format
(
datum
.
date
);
const
tooltip
=
`
${
datum
.
value
}
Remaining /
${
date
}
`
;
const
tooltip
=
`
${
datum
.
value
}
${
this
.
label
}
/
${
format
(
datum
.
date
)}
`
;
// move the tooltip point of origin to the point on the graph
const
x
=
this
.
xScale
(
datum
.
date
);
...
...
app/assets/javascripts/burndown_chart/index.js
View file @
1292fb03
...
...
@@ -17,7 +17,7 @@ $(() => {
dueDate
:
'
2017-03-31
'
,
});
chart
.
setData
(
testData
);
chart
.
setData
(
testData
,
{
label
:
'
Open Issues
'
,
animate
:
true
}
);
window
.
addEventListener
(
'
resize
'
,
()
=>
chart
.
animateResize
(
1
));
$
(
document
).
on
(
'
click
'
,
'
.js-sidebar-toggle
'
,
()
=>
chart
.
animateResize
(
2
));
});
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