--- a/static/candolint.css Tue Oct 03 19:53:50 2017 +0800
+++ b/static/candolint.css Tue Oct 03 19:58:24 2017 +0800
--- a/static/candolint.js Tue Oct 03 19:53:50 2017 +0800
+++ b/static/candolint.js Tue Oct 03 19:58:24 2017 +0800
if ($('#check-chart-data, #check-chart').length !== 2) { return; }
var data = JSON.parse($('#check-chart-data').text());
var $container = $('.chart-container');
+ var $tooltip = $container.find('.chart-tooltip');
var svg = d3.select('#check-chart');
var margin = {top: 10, right: 45, bottom: 30, left: 45};
var formatDuration = function(d) {
return moment.utc(d, 'X').format('m:ss');
+ {name: 'duration', color: '#00a8e6', scale: y2, format: formatDuration},
+ {name: 'warnings', color: '#faa732', scale: y1},
+ {name: 'errors', color: '#da314b', scale: y1}
var render = function() {
svg.attr('width', $container.width());
.attr('transform', 'translate(' + (width + padding) + ',0)')
.call(d3.axisRight(y2).ticks(5).tickFormat(formatDuration));
- {name: 'duration', color: '#00a8e6', axis: y2},
- {name: 'warnings', color: '#faa732', axis: y1},
- {name: 'errors', color: '#da314b', axis: y1}
- ], function(i, series) {
+ $.each(config, function(i, series) {
.attr('fill', series.color)
.defined(function(d) { return d[series.name] !== null; })
.x(function(d) { return x(d.ordinal); })
- .y(function(d) { return series.axis(d[series.name]); });
+ .y(function(d) { return series.scale(d[series.name]); });
.attr('cx', function(d) { return x(d.ordinal); })
- .attr('cy', function(d) { return series.axis(d[series.name]); });
+ .attr('cy', function(d) { return series.scale(d[series.name]); });
.attr('height', height + margin.top + margin.bottom)
+ .on('mousemove', function(d) {
+ $tooltip.removeClass('uk-hidden').css({
+ left: x(d.ordinal) + margin.left + 10,
+ top: d3.event.layerY + 10
.on('mouseover', function(d) {
var hx = x(d.ordinal) + 0.5;
hover.attr('opacity', 1).attr('x1', hx).attr('x2', hx);
+ $.each(config, function(i, series) {
+ var value = d[series.name];
+ var text = series.format ? series.format(value) : value;
+ $tooltip.find('[data-point="' + series.name + '"]').text(text);
.on('mouseout', function(d) {
hover.attr('opacity', 0);
+ $tooltip.addClass('uk-hidden');
$(window).on('resize', function() {
--- a/templates/check.html Tue Oct 03 19:53:50 2017 +0800
+++ b/templates/check.html Tue Oct 03 19:58:24 2017 +0800
- <div class="chart-container"><svg id="check-chart"></svg></div>
+ <div class="uk-position-relative chart-container">
+ <svg id="check-chart"></svg>
+ <div class="uk-panel uk-panel-box uk-panel-box-secondary uk-display-inline-block uk-position-absolute uk-hidden chart-tooltip">
+ <dl class="uk-description-list-horizontal list-terse">
+ <dd data-point="warnings">0</dd>
+ <dd data-point="errors">0</dd>
+ <dd data-point="duration">0</dd>
<script type="application/json" id="check-chart-data">{% raw json_encode(chart) %}</script>
{% include ui/check-log.html %}