nexus site path corrected
[portal.git] / ecomp-portal-FE / client / kpi-dashboard / views / DCAE_DASH / static / visjs / legend_v2.js
1 /*-
2  * ================================================================================
3  * eCOMP Portal
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ================================================================================
19  */
20 d3.select('#legend').style.visibility="visible";
21  var svg1  = d3.select('#legend').append('svg');
22  var g1 = svg1.append("g");
23  svg1.attr('width', "100%")
24     .attr('height', "100%");
25  
26   var circle1 = svg1.append("circle")
27                 .attr("cx", "10")
28                 .attr("cy", "10")
29                 .attr("r", "5")
30                 .attr('fill', greaterthan75_color)
31                 .attr('stroke', 'black')
32                 .attr('fill-opacity', 1.0);             
33  
34   
35   var text4 = g1.append("text")
36              .attr("x", "30")
37                          .attr("y", "13")
38             .attr("font-family", "sans-serif")
39                   .attr("font-size", "10px");
40                   text4.text(greaterthan75_text);
41                   text4.attr("fill", "black");  
42
43   var circle2 = svg1.append("circle")
44                 .attr("cx", "10")
45                 .attr("cy", "25")
46                 .attr("r", "5")
47                 .attr('fill', lessthan50_75_color)
48                 .attr('stroke', 'black')
49                 .attr('fill-opacity', 1.0);   
50
51   var text5 = g1.append("text")
52              .attr("x", "30")
53                          .attr("y", "28")
54             .attr("font-family", "sans-serif")
55                   .attr("font-size", "10px");
56                   text5.text(lessthan50_75_text);
57                   text5.attr("fill", "black");
58                   
59
60     var circle3 = svg1.append("circle")
61                 .attr("cx", "10")
62                 .attr("cy", "40")
63                 .attr("r", "5")
64                 .attr('fill', lessthan50_color)
65                 .attr('stroke', 'black')
66                 .attr('fill-opacity', 1.0);  
67
68   var text6 = g1.append("text")
69              .attr("x", "30")
70                          .attr("y", "43")
71             .attr("font-family", "sans-serif")
72                   .attr("font-size", "10px");
73                   text6.text(lessthan50_text);
74                   text6.attr("fill", "black");          
75                 
76  //var zoom = d3.behavior.zoom().on ("zoom", move);
77  var zoom = d3.behavior.zoom()
78   .on("zoom",function() {
79     //alert(d3.event.scale); 
80     g.attr("transform","translate("+d3.event.translate.join(",")+")scale("+d3.event.scale+")")
81         if(d3.event.scale >= 4) { 
82                 d3.behavior.zoom()
83                 .scale(d3.event.scale);
84         }
85   });