2014-01-30 14:01:22 -06:00
|
|
|
define([
|
|
|
|
'angular',
|
|
|
|
'jquery',
|
|
|
|
'kbn',
|
|
|
|
'moment',
|
2014-08-07 07:35:19 -05:00
|
|
|
'lodash'
|
2014-01-30 14:01:22 -06:00
|
|
|
],
|
|
|
|
function (angular, $, kbn, moment, _) {
|
|
|
|
'use strict';
|
|
|
|
|
2014-07-28 11:11:52 -05:00
|
|
|
var module = angular.module('grafana.directives');
|
2014-01-30 14:01:22 -06:00
|
|
|
|
2014-06-07 12:43:15 -05:00
|
|
|
module.directive('grafanaGraph', function($rootScope) {
|
2014-01-30 14:01:22 -06:00
|
|
|
return {
|
|
|
|
restrict: 'A',
|
|
|
|
template: '<div> </div>',
|
|
|
|
link: function(scope, elem) {
|
2014-06-03 08:28:16 -05:00
|
|
|
var data, plot, annotations;
|
2014-01-30 14:01:22 -06:00
|
|
|
var hiddenData = {};
|
2014-06-07 12:43:15 -05:00
|
|
|
var dashboard = scope.dashboard;
|
2014-07-03 05:38:20 -05:00
|
|
|
var legendSideLastValue = null;
|
2014-01-30 14:01:22 -06:00
|
|
|
|
|
|
|
scope.$on('refresh',function() {
|
|
|
|
scope.get_data();
|
|
|
|
});
|
|
|
|
|
2014-05-01 04:18:23 -05:00
|
|
|
scope.$on('toggleLegend', function(e, series) {
|
|
|
|
_.each(series, function(serie) {
|
|
|
|
if (hiddenData[serie.alias]) {
|
|
|
|
data.push(hiddenData[serie.alias]);
|
|
|
|
delete hiddenData[serie.alias];
|
|
|
|
}
|
|
|
|
});
|
2014-01-30 14:01:22 -06:00
|
|
|
|
|
|
|
render_panel();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Receive render events
|
2014-06-03 08:28:16 -05:00
|
|
|
scope.$on('render',function(event, renderData) {
|
|
|
|
data = renderData || data;
|
2014-08-13 08:02:57 -05:00
|
|
|
if (!data) {
|
|
|
|
scope.get_data();
|
|
|
|
return;
|
|
|
|
}
|
2014-08-04 00:18:26 -05:00
|
|
|
annotations = data.annotations || annotations;
|
2014-01-30 14:01:22 -06:00
|
|
|
render_panel();
|
|
|
|
});
|
|
|
|
|
|
|
|
// Re-render if the window is resized
|
|
|
|
angular.element(window).bind('resize', function() {
|
|
|
|
render_panel();
|
|
|
|
});
|
|
|
|
|
2014-02-01 15:06:10 -06:00
|
|
|
function setElementHeight() {
|
|
|
|
try {
|
2014-04-05 09:56:45 -05:00
|
|
|
var height = scope.height || scope.panel.height || scope.row.height;
|
2014-04-05 12:22:08 -05:00
|
|
|
if (_.isString(height)) {
|
|
|
|
height = parseInt(height.replace('px', ''), 10);
|
|
|
|
}
|
|
|
|
|
|
|
|
height = height - 32; // subtract panel title bar
|
2014-04-05 09:56:45 -05:00
|
|
|
|
2014-07-03 05:38:20 -05:00
|
|
|
if (scope.panel.legend.show && !scope.panel.legend.rightSide) {
|
2014-04-05 12:22:08 -05:00
|
|
|
height = height - 21; // subtract one line legend
|
2014-04-05 09:56:45 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
elem.css('height', height + 'px');
|
|
|
|
|
2014-02-01 15:06:10 -06:00
|
|
|
return true;
|
|
|
|
} catch(e) { // IE throws errors sometimes
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-05 09:31:06 -05:00
|
|
|
function shouldAbortRender() {
|
|
|
|
if (!data) {
|
|
|
|
return true;
|
|
|
|
}
|
2014-04-05 12:22:08 -05:00
|
|
|
|
2014-04-05 09:31:06 -05:00
|
|
|
if ($rootScope.fullscreen && !scope.fullscreen) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!setElementHeight()) { return true; }
|
2014-02-01 15:06:10 -06:00
|
|
|
|
|
|
|
if (_.isString(data)) {
|
2014-02-05 01:41:46 -06:00
|
|
|
render_panel_as_graphite_png(data);
|
2014-04-05 09:31:06 -05:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Function for rendering panel
|
|
|
|
function render_panel() {
|
|
|
|
if (shouldAbortRender()) {
|
2014-01-30 14:01:22 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-02-08 07:21:41 -06:00
|
|
|
var panel = scope.panel;
|
|
|
|
|
2014-01-30 14:01:22 -06:00
|
|
|
_.each(_.keys(scope.hiddenSeries), function(seriesAlias) {
|
|
|
|
var dataSeries = _.find(data, function(series) {
|
|
|
|
return series.info.alias === seriesAlias;
|
|
|
|
});
|
|
|
|
if (dataSeries) {
|
|
|
|
hiddenData[dataSeries.info.alias] = dataSeries;
|
|
|
|
data = _.without(data, dataSeries);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-02-08 07:21:41 -06:00
|
|
|
var stack = panel.stack ? true : null;
|
2014-01-30 14:01:22 -06:00
|
|
|
|
|
|
|
// Populate element
|
|
|
|
var options = {
|
|
|
|
legend: { show: false },
|
|
|
|
series: {
|
2014-02-08 07:21:41 -06:00
|
|
|
stackpercent: panel.stack ? panel.percentage : false,
|
|
|
|
stack: panel.percentage ? null : stack,
|
2014-01-30 14:01:22 -06:00
|
|
|
lines: {
|
2014-02-08 07:21:41 -06:00
|
|
|
show: panel.lines,
|
2014-02-07 02:28:54 -06:00
|
|
|
zero: false,
|
2014-08-20 03:27:30 -05:00
|
|
|
fill: translateFillOption(panel.fill),
|
2014-02-08 07:21:41 -06:00
|
|
|
lineWidth: panel.linewidth,
|
|
|
|
steps: panel.steppedLine
|
2014-01-30 14:01:22 -06:00
|
|
|
},
|
|
|
|
bars: {
|
2014-02-08 07:21:41 -06:00
|
|
|
show: panel.bars,
|
2014-01-30 14:01:22 -06:00
|
|
|
fill: 1,
|
2014-03-02 06:26:08 -06:00
|
|
|
barWidth: 1,
|
2014-01-30 14:01:22 -06:00
|
|
|
zero: false,
|
|
|
|
lineWidth: 0
|
|
|
|
},
|
|
|
|
points: {
|
2014-02-08 07:21:41 -06:00
|
|
|
show: panel.points,
|
2014-01-30 14:01:22 -06:00
|
|
|
fill: 1,
|
|
|
|
fillColor: false,
|
2014-02-08 07:21:41 -06:00
|
|
|
radius: panel.pointradius
|
2014-01-30 14:01:22 -06:00
|
|
|
},
|
|
|
|
shadowSize: 1
|
|
|
|
},
|
|
|
|
yaxes: [],
|
2014-02-25 00:33:05 -06:00
|
|
|
xaxis: {},
|
2014-01-30 14:01:22 -06:00
|
|
|
grid: {
|
2014-07-03 05:38:20 -05:00
|
|
|
minBorderMargin: 0,
|
2014-02-20 16:00:32 -06:00
|
|
|
markings: [],
|
2014-01-30 14:01:22 -06:00
|
|
|
backgroundColor: null,
|
|
|
|
borderWidth: 0,
|
|
|
|
hoverable: true,
|
|
|
|
color: '#c8c8c8'
|
2014-02-05 01:56:10 -06:00
|
|
|
},
|
|
|
|
selection: {
|
|
|
|
mode: "x",
|
|
|
|
color: '#666'
|
2014-01-30 14:01:22 -06:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
for (var i = 0; i < data.length; i++) {
|
2014-08-19 09:22:18 -05:00
|
|
|
var series = data[i];
|
2014-08-20 03:27:30 -05:00
|
|
|
series.applySeriesOverrides(panel.seriesOverrides);
|
2014-08-19 09:22:18 -05:00
|
|
|
series.data = series.getFlotPairs(panel.nullPointMode, panel.y_formats);
|
2014-01-30 14:01:22 -06:00
|
|
|
}
|
|
|
|
|
2014-08-18 14:47:56 -05:00
|
|
|
if (data.length && data[0].info.timeStep) {
|
2014-03-02 06:26:08 -06:00
|
|
|
options.series.bars.barWidth = data[0].info.timeStep / 1.5;
|
|
|
|
}
|
|
|
|
|
2014-02-25 00:33:05 -06:00
|
|
|
addTimeAxis(options);
|
2014-02-15 03:15:05 -06:00
|
|
|
addGridThresholds(options, panel);
|
|
|
|
addAnnotations(options);
|
2014-01-30 14:01:22 -06:00
|
|
|
configureAxisOptions(data, options);
|
|
|
|
|
2014-07-03 05:38:20 -05:00
|
|
|
// if legend is to the right delay plot draw a few milliseconds
|
|
|
|
// so the legend width calculation can be done
|
|
|
|
if (shouldDelayDraw(panel)) {
|
|
|
|
legendSideLastValue = panel.legend.rightSide;
|
|
|
|
setTimeout(function() {
|
|
|
|
plot = $.plot(elem, data, options);
|
|
|
|
addAxisLabels();
|
|
|
|
}, 50);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
plot = $.plot(elem, data, options);
|
|
|
|
addAxisLabels();
|
|
|
|
}
|
|
|
|
}
|
2014-01-30 14:01:22 -06:00
|
|
|
|
2014-08-19 09:57:33 -05:00
|
|
|
function translateFillOption(fill) {
|
|
|
|
return fill === 0 ? 0.001 : fill/10;
|
|
|
|
}
|
|
|
|
|
2014-07-03 05:38:20 -05:00
|
|
|
function shouldDelayDraw(panel) {
|
|
|
|
if (panel.legend.rightSide) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
if (legendSideLastValue !== null && panel.legend.rightSide !== legendSideLastValue) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
2014-02-01 15:06:10 -06:00
|
|
|
}
|
|
|
|
|
2014-02-25 00:33:05 -06:00
|
|
|
function addTimeAxis(options) {
|
|
|
|
var ticks = elem.width() / 100;
|
|
|
|
var min = _.isUndefined(scope.range.from) ? null : scope.range.from.getTime();
|
|
|
|
var max = _.isUndefined(scope.range.to) ? null : scope.range.to.getTime();
|
|
|
|
|
|
|
|
options.xaxis = {
|
2014-06-07 12:43:15 -05:00
|
|
|
timezone: dashboard.timezone,
|
2014-02-25 00:33:05 -06:00
|
|
|
show: scope.panel['x-axis'],
|
|
|
|
mode: "time",
|
|
|
|
min: min,
|
|
|
|
max: max,
|
|
|
|
label: "Datetime",
|
|
|
|
ticks: ticks,
|
|
|
|
timeformat: time_format(scope.interval, ticks, min, max),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2014-02-15 03:15:05 -06:00
|
|
|
function addGridThresholds(options, panel) {
|
|
|
|
if (panel.grid.threshold1) {
|
|
|
|
var limit1 = panel.grid.thresholdLine ? panel.grid.threshold1 : (panel.grid.threshold2 || null);
|
|
|
|
options.grid.markings.push({
|
|
|
|
yaxis: { from: panel.grid.threshold1, to: limit1 },
|
|
|
|
color: panel.grid.threshold1Color
|
|
|
|
});
|
|
|
|
|
|
|
|
if (panel.grid.threshold2) {
|
|
|
|
var limit2;
|
|
|
|
if (panel.grid.thresholdLine) {
|
|
|
|
limit2 = panel.grid.threshold2;
|
|
|
|
} else {
|
|
|
|
limit2 = panel.grid.threshold1 > panel.grid.threshold2 ? -Infinity : +Infinity;
|
|
|
|
}
|
|
|
|
options.grid.markings.push({
|
|
|
|
yaxis: { from: panel.grid.threshold2, to: limit2 },
|
|
|
|
color: panel.grid.threshold2Color
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-01 15:06:10 -06:00
|
|
|
function addAnnotations(options) {
|
2014-06-03 08:28:16 -05:00
|
|
|
if(!annotations || annotations.length === 0) {
|
2014-02-07 02:28:54 -06:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2014-02-20 16:00:32 -06:00
|
|
|
var types = {};
|
|
|
|
|
2014-06-03 08:28:16 -05:00
|
|
|
_.each(annotations, function(event) {
|
2014-02-20 16:00:32 -06:00
|
|
|
if (!types[event.annotation.name]) {
|
|
|
|
types[event.annotation.name] = {
|
|
|
|
level: _.keys(types).length + 1,
|
2014-02-07 02:28:54 -06:00
|
|
|
icon: {
|
2014-02-21 06:56:27 -06:00
|
|
|
icon: "icon-chevron-down",
|
2014-02-20 16:00:32 -06:00
|
|
|
size: event.annotation.iconSize,
|
|
|
|
color: event.annotation.iconColor,
|
2014-02-01 15:06:10 -06:00
|
|
|
}
|
2014-02-20 16:00:32 -06:00
|
|
|
};
|
2014-02-07 02:28:54 -06:00
|
|
|
}
|
2014-02-20 16:00:32 -06:00
|
|
|
|
|
|
|
if (event.annotation.showLine) {
|
|
|
|
options.grid.markings.push({
|
|
|
|
color: event.annotation.lineColor,
|
|
|
|
lineWidth: 1,
|
|
|
|
xaxis: { from: event.min, to: event.max }
|
|
|
|
});
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
options.events = {
|
|
|
|
levels: _.keys(types).length + 1,
|
2014-06-03 08:28:16 -05:00
|
|
|
data: annotations,
|
2014-02-20 16:00:32 -06:00
|
|
|
types: types
|
2014-02-07 02:28:54 -06:00
|
|
|
};
|
2014-02-01 15:06:10 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function addAxisLabels() {
|
2014-01-30 14:01:22 -06:00
|
|
|
if (scope.panel.leftYAxisLabel) {
|
|
|
|
elem.css('margin-left', '10px');
|
|
|
|
var yaxisLabel = $("<div class='axisLabel yaxisLabel'></div>")
|
|
|
|
.text(scope.panel.leftYAxisLabel)
|
|
|
|
.appendTo(elem);
|
|
|
|
|
|
|
|
yaxisLabel.css("margin-top", yaxisLabel.width() / 2 - 20);
|
|
|
|
} else if (elem.css('margin-left')) {
|
|
|
|
elem.css('margin-left', '');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-02-01 15:06:10 -06:00
|
|
|
function configureAxisOptions(data, options) {
|
2014-01-30 14:01:22 -06:00
|
|
|
var defaults = {
|
|
|
|
position: 'left',
|
|
|
|
show: scope.panel['y-axis'],
|
2014-06-19 21:59:52 -05:00
|
|
|
min: scope.panel.grid.leftMin,
|
|
|
|
max: scope.panel.percentage && scope.panel.stack ? 100 : scope.panel.grid.leftMax,
|
2014-01-30 14:01:22 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
options.yaxes.push(defaults);
|
|
|
|
|
|
|
|
if (_.findWhere(data, {yaxis: 2})) {
|
|
|
|
var secondY = _.clone(defaults);
|
|
|
|
secondY.position = 'right';
|
2014-06-19 21:59:52 -05:00
|
|
|
secondY.min = scope.panel.grid.rightMin;
|
|
|
|
secondY.max = scope.panel.percentage && scope.panel.stack ? 100 : scope.panel.grid.rightMax;
|
2014-01-30 14:01:22 -06:00
|
|
|
options.yaxes.push(secondY);
|
2014-02-06 03:19:26 -06:00
|
|
|
configureAxisMode(options.yaxes[1], scope.panel.y_formats[1]);
|
2014-01-30 14:01:22 -06:00
|
|
|
}
|
|
|
|
|
2014-02-06 03:19:26 -06:00
|
|
|
configureAxisMode(options.yaxes[0], scope.panel.y_formats[0]);
|
2014-01-30 14:01:22 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
function configureAxisMode(axis, format) {
|
2014-08-14 05:05:29 -05:00
|
|
|
axis.tickFormatter = kbn.getFormatFunction(format, 1);
|
2014-01-30 14:01:22 -06:00
|
|
|
}
|
|
|
|
|
2014-02-25 00:33:05 -06:00
|
|
|
function time_format(interval, ticks, min, max) {
|
|
|
|
if (min && max && ticks) {
|
2014-03-05 11:37:51 -06:00
|
|
|
var secPerTick = ((max - min) / ticks) / 1000;
|
|
|
|
|
|
|
|
if (secPerTick <= 45) {
|
2014-02-25 00:33:05 -06:00
|
|
|
return "%H:%M:%S";
|
|
|
|
}
|
2014-03-05 11:37:51 -06:00
|
|
|
if (secPerTick <= 3600) {
|
|
|
|
return "%H:%M";
|
|
|
|
}
|
|
|
|
if (secPerTick <= 80000) {
|
|
|
|
return "%m/%d %H:%M";
|
|
|
|
}
|
|
|
|
if (secPerTick <= 2419200) {
|
|
|
|
return "%m/%d";
|
|
|
|
}
|
|
|
|
return "%Y-%m";
|
2014-02-25 00:33:05 -06:00
|
|
|
}
|
|
|
|
|
2014-02-05 08:39:50 -06:00
|
|
|
return "%H:%M";
|
2014-01-30 14:01:22 -06:00
|
|
|
}
|
|
|
|
|
2014-08-07 02:00:52 -05:00
|
|
|
var $tooltip = $('<div id="tooltip">');
|
2014-01-30 14:01:22 -06:00
|
|
|
|
|
|
|
elem.bind("plothover", function (event, pos, item) {
|
2014-02-26 12:46:34 -06:00
|
|
|
var group, value, timestamp, seriesInfo, format;
|
|
|
|
|
2014-01-30 14:01:22 -06:00
|
|
|
if (item) {
|
2014-02-26 12:46:34 -06:00
|
|
|
seriesInfo = item.series.info;
|
|
|
|
format = scope.panel.y_formats[seriesInfo.yaxis - 1];
|
|
|
|
|
2014-02-27 14:46:06 -06:00
|
|
|
if (seriesInfo.alias) {
|
2014-01-30 14:01:22 -06:00
|
|
|
group = '<small style="font-size:0.9em;">' +
|
|
|
|
'<i class="icon-circle" style="color:'+item.series.color+';"></i>' + ' ' +
|
2014-07-03 09:28:38 -05:00
|
|
|
seriesInfo.alias +
|
2014-01-30 14:01:22 -06:00
|
|
|
'</small><br>';
|
|
|
|
} else {
|
|
|
|
group = kbn.query_color_dot(item.series.color, 15) + ' ';
|
|
|
|
}
|
2014-02-26 12:46:34 -06:00
|
|
|
|
|
|
|
if (scope.panel.stack && scope.panel.tooltip.value_type === 'individual') {
|
|
|
|
value = item.datapoint[1] - item.datapoint[2];
|
2014-01-30 14:01:22 -06:00
|
|
|
}
|
2014-02-26 12:46:34 -06:00
|
|
|
else {
|
|
|
|
value = item.datapoint[1];
|
2014-01-30 14:01:22 -06:00
|
|
|
}
|
2014-02-26 12:46:34 -06:00
|
|
|
|
|
|
|
value = kbn.getFormatFunction(format, 2)(value);
|
2014-08-18 06:17:18 -05:00
|
|
|
timestamp = dashboard.formatDate(item.datapoint[0]);
|
2014-08-07 02:00:52 -05:00
|
|
|
|
|
|
|
$tooltip.html(group + value + " @ " + timestamp).place_tt(pos.pageX, pos.pageY);
|
2014-01-30 14:01:22 -06:00
|
|
|
} else {
|
|
|
|
$tooltip.detach();
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2014-03-30 08:00:09 -05:00
|
|
|
function render_panel_as_graphite_png(url) {
|
2014-02-26 12:46:34 -06:00
|
|
|
url += '&width=' + elem.width();
|
|
|
|
url += '&height=' + elem.css('height').replace('px', '');
|
2014-07-28 11:11:52 -05:00
|
|
|
url += '&bgcolor=1f1f1f'; // @grayDarker & @grafanaPanelBackground
|
2014-02-26 12:46:34 -06:00
|
|
|
url += '&fgcolor=BBBFC2'; // @textColor & @grayLighter
|
|
|
|
url += scope.panel.stack ? '&areaMode=stacked' : '';
|
|
|
|
url += scope.panel.fill !== 0 ? ('&areaAlpha=' + (scope.panel.fill/10).toFixed(1)) : '';
|
|
|
|
url += scope.panel.linewidth !== 0 ? '&lineWidth=' + scope.panel.linewidth : '';
|
2014-04-10 16:10:29 -05:00
|
|
|
url += scope.panel.legend.show ? '&hideLegend=false' : '&hideLegend=true';
|
2014-06-30 11:13:39 -05:00
|
|
|
url += scope.panel.grid.leftMin !== null ? '&yMin=' + scope.panel.grid.leftMin : '';
|
|
|
|
url += scope.panel.grid.leftMax !== null ? '&yMax=' + scope.panel.grid.leftMax : '';
|
|
|
|
url += scope.panel.grid.rightMin !== null ? '&yMin=' + scope.panel.grid.rightMin : '';
|
|
|
|
url += scope.panel.grid.rightMax !== null ? '&yMax=' + scope.panel.grid.rightMax : '';
|
2014-02-26 12:46:34 -06:00
|
|
|
url += scope.panel['x-axis'] ? '' : '&hideAxes=true';
|
|
|
|
url += scope.panel['y-axis'] ? '' : '&hideYAxis=true';
|
|
|
|
|
|
|
|
switch(scope.panel.y_formats[0]) {
|
|
|
|
case 'bytes':
|
|
|
|
url += '&yUnitSystem=binary';
|
|
|
|
break;
|
2014-03-01 12:20:42 -06:00
|
|
|
case 'bits':
|
|
|
|
url += '&yUnitSystem=binary';
|
|
|
|
break;
|
2014-07-17 18:52:12 -05:00
|
|
|
case 'bps':
|
|
|
|
url += '&yUnitSystem=si';
|
|
|
|
break;
|
2014-02-26 12:46:34 -06:00
|
|
|
case 'short':
|
|
|
|
url += '&yUnitSystem=si';
|
|
|
|
break;
|
|
|
|
case 'none':
|
|
|
|
url += '&yUnitSystem=none';
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch(scope.panel.nullPointMode) {
|
|
|
|
case 'connected':
|
|
|
|
url += '&lineMode=connected';
|
|
|
|
break;
|
|
|
|
case 'null':
|
|
|
|
break; // graphite default lineMode
|
|
|
|
case 'null as zero':
|
|
|
|
url += "&drawNullAsZero=true";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
url += scope.panel.steppedLine ? '&lineMode=staircase' : '';
|
|
|
|
|
|
|
|
elem.html('<img src="' + url + '"></img>');
|
|
|
|
}
|
|
|
|
|
2014-01-30 14:01:22 -06:00
|
|
|
elem.bind("plotselected", function (event, ranges) {
|
2014-06-06 23:38:33 -05:00
|
|
|
scope.$apply(function() {
|
|
|
|
scope.filter.setTime({
|
|
|
|
from : moment.utc(ranges.xaxis.from).toDate(),
|
|
|
|
to : moment.utc(ranges.xaxis.to).toDate(),
|
|
|
|
});
|
2014-01-30 14:01:22 -06:00
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2014-02-09 03:13:32 -06:00
|
|
|
});
|