Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
604fc067
Commit
604fc067
authored
Apr 09, 2013
by
Zachary Tong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial base for orthographic
parent
9edfb210
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
11 deletions
+54
-11
panels/map2/display/bullseye.js
+2
-8
panels/map2/module.js
+52
-3
No files found.
panels/map2/display/bullseye.js
View file @
604fc067
function
displayBullseye
(
scope
,
projection
,
path
)
{
var
arc
=
d3
.
svg
.
arc
()
.
innerRadius
(
5
)
.
outerRadius
(
10
)
.
startAngle
(
0
)
//converting from degs to radians
.
endAngle
(
2
*
Math
.
PI
)
//just radians
var
coords
=
projection
([
parseFloat
(
scope
.
panel
.
display
.
bullseye
.
coord
.
lon
),
parseFloat
(
scope
.
panel
.
display
.
bullseye
.
coord
.
lat
)]);
var
degrees
=
180
/
Math
.
PI
var
circle
=
d3
.
geo
.
circle
();
...
...
@@ -21,7 +15,7 @@ function displayBullseye(scope, projection, path) {
.
datum
(
function
(
d
)
{
console
.
log
(
d
);
return
circle
.
origin
([
d
.
lon
,
d
.
lat
]).
angle
(
1
)();
return
circle
.
origin
([
d
.
lon
,
d
.
lat
]).
angle
(
1
000
/
6371
*
degrees
)();
})
.
attr
(
"d"
,
path
)
.
attr
(
"class"
,
"arc"
);
...
...
panels/map2/module.js
View file @
604fc067
...
...
@@ -40,8 +40,10 @@ angular.module('kibana.map2', [])
coord
:
{
lat
:
0
,
lon
:
0
}
},
map
:
{
type
:
"mercator"
}
},
displayTabs
:
[
"Geopoints"
,
"Binning"
,
"Choropleth"
,
"Bullseye"
,
"Data"
],
...
...
@@ -257,9 +259,31 @@ angular.module('kibana.map2', [])
/**
* D3 and general config section
*/
var
projection
=
d3
.
geo
.
mercator
()
var
projection
;
if
(
typeof
scope
.
panel
.
display
.
map
===
'undefined'
)
{
scope
.
panel
.
display
.
map
=
{
type
:
'orthographic'
};
}
if
(
scope
.
panel
.
display
.
map
.
type
===
'mercator'
)
{
projection
=
d3
.
geo
.
mercator
()
.
translate
([
width
/
2
,
height
/
2
])
.
scale
(
scale
);
}
else
if
(
scope
.
panel
.
display
.
map
.
type
===
'orthographic'
)
{
projection
=
d3
.
geo
.
orthographic
()
.
scale
(
248
)
.
clipAngle
(
90
);
var
λ
=
d3
.
scale
.
linear
()
.
domain
([
0
,
width
])
.
range
([
-
180
,
180
]);
var
φ
=
d3
.
scale
.
linear
()
.
domain
([
0
,
height
])
.
range
([
90
,
-
90
]);
}
var
zoom
=
d3
.
behavior
.
zoom
()
.
scaleExtent
([
1
,
8
])
...
...
@@ -301,6 +325,16 @@ angular.module('kibana.map2', [])
* D3 SVG Setup
*/
var
ctrlKey
=
false
;
//set up listener for ctrl key
d3
.
select
(
"body"
)
.
on
(
"keydown"
,
function
()
{
ctrlKey
=
d3
.
event
.
ctrlKey
;
})
.
on
(
"keyup"
,
function
()
{
ctrlKey
=
d3
.
event
.
ctrlKey
;
});
//remove our old svg...is there a better way to update than remove/append?
d3
.
select
(
elem
[
0
]).
select
(
"svg"
).
remove
();
...
...
@@ -342,6 +376,18 @@ angular.module('kibana.map2', [])
if
(
scope
.
panel
.
display
.
map
.
type
===
'orthographic'
)
{
scope
.
svg
.
style
(
"cursor"
,
"move"
)
.
call
(
d3
.
behavior
.
drag
()
.
origin
(
function
()
{
var
rotate
=
projection
.
rotate
();
return
{
x
:
2
*
rotate
[
0
],
y
:
-
2
*
rotate
[
1
]};
})
.
on
(
"drag"
,
function
()
{
if
(
ctrlKey
)
{
projection
.
rotate
([
d3
.
event
.
x
/
2
,
-
d3
.
event
.
y
/
2
,
projection
.
rotate
()[
2
]]);
scope
.
svg
.
selectAll
(
"path"
).
attr
(
"d"
,
path
);
}
}));
}
/**
* Display Options
*/
...
...
@@ -373,6 +419,8 @@ angular.module('kibana.map2', [])
}
function
move
()
{
if
(
!
ctrlKey
)
{
var
t
=
d3
.
event
.
translate
,
s
=
d3
.
event
.
scale
;
t
[
0
]
=
Math
.
min
(
width
/
2
*
(
s
-
1
),
Math
.
max
(
width
/
2
*
(
1
-
s
),
t
[
0
]));
...
...
@@ -381,7 +429,8 @@ angular.module('kibana.map2', [])
scope
.
panel
.
display
.
translate
=
t
;
scope
.
panel
.
display
.
scale
=
s
;
scope
.
g
.
style
(
"stroke-width"
,
1
/
s
).
attr
(
"transform"
,
"translate("
+
t
+
")scale("
+
s
+
")"
);
scope
.
g
.
style
(
"stroke-width"
,
1
/
s
).
attr
(
"transform"
,
"translate("
+
t
+
") scale("
+
s
+
")"
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment