Improve metric tooltips, now show name, value and suffix

This commit is contained in:
James Brooks
2015-05-23 15:46:57 +01:00
parent 6044f7d87c
commit bf5941f66e

View File

@@ -32,6 +32,8 @@
</div>
<script>
(function () {
Chart.defaults.global.pointHitDetectionRadius = 1;
var hourList = [], date = new Date();
for (var i = 10; i >= 1; i--) {
@@ -50,15 +52,15 @@
pointStrokeColor: "#fff",
pointHighlightFill: "#fff",
pointHighlightStroke: "rgba(220,220,220,1)",
data: [{{ implode(',', $points) }}]
}]
data: [{{ implode(',', $points) }}],
}],
};
var ctx = document.getElementById("metric-{{ $metric->id }}").getContext("2d");
new Chart(ctx).Line(data, {
tooltipTemplate: "{{ $metric->name }}: <%= value %>{{ $metric->suffix }}",
scaleShowVerticalLines: true,
scaleShowLabels: false,
pointDot: false,
responsive: true
});
}());