Last change
on this file since 13401 was
12435,
checked in by dglaser, 9 years ago
|
#2394: Improved PluginManager and updated hive status monitor.
|
File size:
2.1 KB
|
Line | |
---|
1 | (function () {
|
---|
2 | var module = appMainPlugin.getAngularModule();
|
---|
3 | module.directive('flot', function () {
|
---|
4 | return {
|
---|
5 | restrict: 'E',
|
---|
6 | link: function (scope, element, attrs) {
|
---|
7 | var chart = null, opts = scope[attrs.options];
|
---|
8 | var div = null;
|
---|
9 |
|
---|
10 | scope.$watchCollection(attrs.dataset, function (newData, oldData) {
|
---|
11 | if (!chart) {
|
---|
12 | div = element.append("<div>");
|
---|
13 | div.bind("plotselected", function (event, ranges) {
|
---|
14 | $.each(chart.getXAxes(), function (_, axis) {
|
---|
15 | var opts2 = axis.options;
|
---|
16 | opts2.min = ranges.xaxis.from;
|
---|
17 | opts2.max = ranges.xaxis.to;
|
---|
18 | });
|
---|
19 | chart.setupGrid();
|
---|
20 | chart.draw();
|
---|
21 | chart.clearSelection();
|
---|
22 | });
|
---|
23 | div.dblclick(function () {
|
---|
24 | var axes = chart.getAxes();
|
---|
25 | var xaxis = axes.xaxis.options;
|
---|
26 | xaxis.min = null;
|
---|
27 | xaxis.max = null;
|
---|
28 | chart.setupGrid();
|
---|
29 | chart.draw();
|
---|
30 | });
|
---|
31 | div.addClass('chart');
|
---|
32 | div.addClass('angular-flot-chart');
|
---|
33 | chart = $.plot(div, newData, opts);
|
---|
34 | div.resizable({});
|
---|
35 | div.show();
|
---|
36 | } else {
|
---|
37 | var axes = chart.getAxes();
|
---|
38 | var xaxis = axes.xaxis.options;
|
---|
39 | xaxis.min = null;
|
---|
40 | xaxis.max = null;
|
---|
41 | chart.setData(newData);
|
---|
42 | chart.setupGrid();
|
---|
43 | chart.draw();
|
---|
44 | }
|
---|
45 | });
|
---|
46 | }
|
---|
47 | };
|
---|
48 | });
|
---|
49 | })(); |
---|
Note: See
TracBrowser
for help on using the repository browser.