Last change
on this file since 16017 was
12563,
checked in by ascheibe, 10 years ago
|
#2394 merged r12428, r12429, r12430, r12435, r12442, r12443, r12445, r12514, r12517, r12519, r12520, r12521, r12523, r12532, r12542, r12546, r12552, r12553, r12556, r12557, r12559, r12561, r12146, r12457 into stable
|
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.