4 * Copyright 2016 RIFT.IO Inc
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 * Created by onvelocity on 12/3/15.
30 export default class DescriptorGraphGrid
{
32 constructor(graph
, props
) {
34 Object
.assign(props
, defaults
);
35 this.size
= props
.size
;
36 this.padding
= props
.padding
;
41 const grid
= this.graph
.grid
;
42 const width
= 2 * this.graph
.svg
.attr('width');
43 const height
= 2 * this.graph
.svg
.attr('height');
44 const yAxis
= d3
.range(0, height
, this.size
);
45 const xAxis
= d3
.range(0, width
, this.size
);
47 grid
.selectAll('line.vertical')
49 .enter().append('svg:line')
50 .classed('vertical', true)
56 grid
.selectAll('line.horizontal')
58 .enter().append('svg:line')
59 .classed('horizontal', true)
63 .attr('y2', (d
) => d
);