Commit d36d04f4 authored by Mike Greiling's avatar Mike Greiling

add toggle between issue count and issue weight

parent c2d6dd32
......@@ -17,10 +17,32 @@ $(() => {
const startDate = chartElm.data('startDate');
const dueDate = chartElm.data('endDate');
const chartData = chartElm.data('chartData');
const openIssuesCount = chartData.map(d => [d[0], d[1]]);
const openIssuesWeight = chartData.map(d => [d[0], d[2]]);
const chart = new BurndownChart({ container, startDate, dueDate });
chart.setData(chartData, { label: 'Open Issues', animate: true });
let currentView = 'count';
chart.setData(openIssuesCount, { label: 'Open Issues', animate: true });
$('.burndown-header').on('click', '.btn', function switchData() {
const $this = $(this);
const show = $this.data('show');
if (currentView !== show) {
currentView = show;
$this.addClass('active').siblings().removeClass('active');
switch (show) {
case 'count':
chart.setData(openIssuesCount, { label: 'Open Issues', animate: true });
break;
case 'weight':
chart.setData(openIssuesWeight, { label: 'Open Issue Weight', animate: true });
break;
default:
break;
}
}
});
window.addEventListener('resize', () => chart.animateResize(1));
$(document).on('click', '.js-sidebar-toggle', () => chart.animateResize(2));
......
......@@ -25,5 +25,10 @@
- if can_generate_chart
.burndown-header
%h3
Open issues
Burndown Chart
.btn-group
%button.btn.btn-xs.btn-primary.active{ data: { show: 'count' } }
Issues
%button.btn.btn-xs.btn-primary{ data: { show: 'weight' } }
Issue Weight
.burndown-chart{ data: { start_date: burndown.start_date.strftime("%Y-%m-%d"), end_date: burndown.end_date.strftime("%Y-%m-%d"), chart_data: burndown.chart_data.to_json } }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment