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
d1190d62
Commit
d1190d62
authored
Mar 29, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
create burndown chart legend
parent
22284ec3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
62 additions
and
0 deletions
+62
-0
app/assets/javascripts/burndown_chart/burndown_chart.js
app/assets/javascripts/burndown_chart/burndown_chart.js
+46
-0
app/assets/stylesheets/pages/milestone.scss
app/assets/stylesheets/pages/milestone.scss
+16
-0
No files found.
app/assets/javascripts/burndown_chart/burndown_chart.js
View file @
d1190d62
...
...
@@ -25,6 +25,20 @@ export default class BurndownChart {
this
.
yAxisLabelLineA
=
yAxisLabel
.
append
(
'
line
'
);
this
.
yAxisLabelLineB
=
yAxisLabel
.
append
(
'
line
'
);
// create chart legend
this
.
chartLegendGroup
=
this
.
chartGroup
.
append
(
'
g
'
).
attr
(
'
class
'
,
'
legend
'
);
this
.
chartLegendGroup
.
append
(
'
rect
'
);
this
.
chartLegendIdealKey
=
this
.
chartLegendGroup
.
append
(
'
g
'
);
this
.
chartLegendIdealKey
.
append
(
'
line
'
).
attr
(
'
class
'
,
'
ideal line
'
);
this
.
chartLegendIdealKey
.
append
(
'
text
'
).
text
(
'
Guideline
'
);
this
.
chartLegendIdealKeyBBox
=
this
.
chartLegendIdealKey
.
select
(
'
text
'
).
node
().
getBBox
();
this
.
chartLegendActualKey
=
this
.
chartLegendGroup
.
append
(
'
g
'
);
this
.
chartLegendActualKey
.
append
(
'
line
'
).
attr
(
'
class
'
,
'
actual line
'
);
this
.
chartLegendActualKey
.
append
(
'
text
'
).
text
(
'
Progress
'
);
this
.
chartLegendActualKeyBBox
=
this
.
chartLegendActualKey
.
select
(
'
text
'
).
node
().
getBBox
();
// parse start and due dates
this
.
startDate
=
parseDate
(
startDate
);
this
.
dueDate
=
parseDate
(
dueDate
);
...
...
@@ -157,6 +171,38 @@ export default class BurndownChart {
.
attr
(
'
y1
'
,
this
.
chartHeight
-
axisLabelPadding
)
.
attr
(
'
y2
'
,
this
.
chartHeight
);
// update our legend
const
legendPadding
=
10
;
const
legendSpacing
=
5
;
const
idealBBox
=
this
.
chartLegendIdealKeyBBox
;
const
actualBBox
=
this
.
chartLegendActualKeyBBox
;
const
keyWidth
=
Math
.
ceil
(
Math
.
max
(
idealBBox
.
width
,
actualBBox
.
width
));
const
keyHeight
=
Math
.
ceil
(
Math
.
max
(
idealBBox
.
height
,
actualBBox
.
height
));
const
idealKeyOffset
=
legendPadding
;
const
actualKeyOffset
=
legendPadding
+
keyHeight
+
legendSpacing
;
const
legendWidth
=
(
legendPadding
*
2
)
+
24
+
keyWidth
;
const
legendHeight
=
(
legendPadding
*
2
)
+
(
keyHeight
*
2
)
+
legendSpacing
;
const
legendOffset
=
(
this
.
chartWidth
+
margin
.
right
)
-
legendWidth
-
1
;
this
.
chartLegendGroup
.
select
(
'
rect
'
)
.
attr
(
'
width
'
,
legendWidth
)
.
attr
(
'
height
'
,
legendHeight
);
this
.
chartLegendGroup
.
selectAll
(
'
text
'
)
.
attr
(
'
x
'
,
24
)
.
attr
(
'
dy
'
,
'
1em
'
);
this
.
chartLegendGroup
.
selectAll
(
'
line
'
)
.
attr
(
'
y1
'
,
keyHeight
/
2
)
.
attr
(
'
y2
'
,
keyHeight
/
2
)
.
attr
(
'
x1
'
,
0
)
.
attr
(
'
x2
'
,
18
);
this
.
chartLegendGroup
.
attr
(
'
transform
'
,
`translate(
${
legendOffset
}
, 0)`
);
this
.
chartLegendIdealKey
.
attr
(
'
transform
'
,
`translate(
${
legendPadding
}
,
${
idealKeyOffset
}
)`
);
this
.
chartLegendActualKey
.
attr
(
'
transform
'
,
`translate(
${
legendPadding
}
,
${
actualKeyOffset
}
)`
);
// render lines if data available
if
(
this
.
data
!=
null
&&
this
.
data
.
length
>
1
)
{
this
.
actualLinePath
.
datum
(
this
.
data
).
attr
(
'
d
'
,
this
.
line
);
...
...
app/assets/stylesheets/pages/milestone.scss
View file @
d1190d62
...
...
@@ -248,6 +248,8 @@
$burndown-chart-axis-color
:
#aaa
;
$burndown-chart-line-color
:
#2faa60
;
$burndown-chart-legend-color
:
#8e8e8e
;
$burndown-chart-legend-stroke
:
#e5e5e5
;
$burndown-chart-axis-label-color
:
#5c5c5c
;
$burndown-chart-axis-label-stroke
:
#e5e5e5
;
...
...
@@ -285,6 +287,20 @@ $burndown-chart-axis-label-stroke: #e5e5e5;
}
}
.legend
{
shape-rendering
:
crispEdges
;
text
{
font-size
:
13px
;
fill
:
$burndown-chart-legend-color
;
}
rect
{
stroke
:
$burndown-chart-legend-stroke
;
fill
:
none
;
}
}
.line
{
stroke-width
:
2px
;
fill
:
none
;
...
...
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