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
971e2d62
Commit
971e2d62
authored
Jul 27, 2016
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(zoom): fixed zoom in and out issues when graph is embedded, fixes #5666, fixes #4489
parent
66a72e9e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
17 deletions
+23
-17
public/app/core/routes/routes.ts
+1
-0
public/app/features/dashboard/timeSrv.js
+20
-0
public/app/features/dashboard/timepicker/timepicker.ts
+1
-16
public/app/plugins/panel/graph/module.ts
+1
-1
No files found.
public/app/core/routes/routes.ts
View file @
971e2d62
...
...
@@ -30,6 +30,7 @@ function setupAngularRoutes($routeProvider, $locationProvider) {
.
when
(
'/dashboard-solo/:type/:slug'
,
{
templateUrl
:
'public/app/features/panel/partials/soloPanel.html'
,
controller
:
'SoloPanelCtrl'
,
reloadOnSearch
:
false
,
pageClass
:
'page-dashboard'
,
})
.
when
(
'/dashboard/new'
,
{
...
...
public/app/features/dashboard/timeSrv.js
View file @
971e2d62
...
...
@@ -13,6 +13,8 @@ define([
module
.
service
(
'timeSrv'
,
function
(
$rootScope
,
$timeout
,
$routeParams
,
timer
)
{
var
self
=
this
;
$rootScope
.
onAppEvent
(
'zoom-out'
,
function
(
e
,
factor
)
{
self
.
zoomOut
(
factor
);
},
$rootScope
);
this
.
init
=
function
(
dashboard
)
{
timer
.
cancel_all
();
...
...
@@ -137,6 +139,24 @@ define([
return
{
from
:
from
,
to
:
to
};
};
this
.
zoomOut
=
function
(
factor
)
{
var
range
=
this
.
timeRange
();
var
timespan
=
(
range
.
to
.
valueOf
()
-
range
.
from
.
valueOf
());
var
center
=
range
.
to
.
valueOf
()
-
timespan
/
2
;
var
to
=
(
center
+
(
timespan
*
factor
)
/
2
);
var
from
=
(
center
-
(
timespan
*
factor
)
/
2
);
if
(
to
>
Date
.
now
()
&&
range
.
to
<=
Date
.
now
())
{
var
offset
=
to
-
Date
.
now
();
from
=
from
-
offset
;
to
=
Date
.
now
();
}
this
.
setTime
({
from
:
moment
.
utc
(
from
),
to
:
moment
.
utc
(
to
)
});
};
});
});
public/app/features/dashboard/timepicker/timepicker.ts
View file @
971e2d62
...
...
@@ -29,7 +29,6 @@ export class TimePickerCtrl {
constructor
(
private
$scope
,
private
$rootScope
,
private
timeSrv
)
{
$scope
.
ctrl
=
this
;
$rootScope
.
onAppEvent
(
'zoom-out'
,
()
=>
this
.
zoom
(
2
),
$scope
);
$rootScope
.
onAppEvent
(
'shift-time-forward'
,
()
=>
this
.
move
(
1
),
$scope
);
$rootScope
.
onAppEvent
(
'shift-time-backward'
,
()
=>
this
.
move
(
-
1
),
$scope
);
$rootScope
.
onAppEvent
(
'refresh'
,
()
=>
this
.
init
(),
$scope
);
...
...
@@ -72,21 +71,7 @@ export class TimePickerCtrl {
}
zoom
(
factor
)
{
var
range
=
this
.
timeSrv
.
timeRange
();
var
timespan
=
(
range
.
to
.
valueOf
()
-
range
.
from
.
valueOf
());
var
center
=
range
.
to
.
valueOf
()
-
timespan
/
2
;
var
to
=
(
center
+
(
timespan
*
factor
)
/
2
);
var
from
=
(
center
-
(
timespan
*
factor
)
/
2
);
if
(
to
>
Date
.
now
()
&&
range
.
to
<=
Date
.
now
())
{
var
offset
=
to
-
Date
.
now
();
from
=
from
-
offset
;
to
=
Date
.
now
();
}
this
.
timeSrv
.
setTime
({
from
:
moment
.
utc
(
from
),
to
:
moment
.
utc
(
to
)
});
this
.
$rootScope
.
appEvent
(
'zoom-out'
,
2
);
}
move
(
direction
)
{
...
...
public/app/plugins/panel/graph/module.ts
View file @
971e2d62
...
...
@@ -157,7 +157,7 @@ class GraphCtrl extends MetricsPanelCtrl {
}
zoomOut
(
evt
)
{
this
.
publishAppEvent
(
'zoom-out'
,
evt
);
this
.
publishAppEvent
(
'zoom-out'
,
2
);
}
onDataSnapshotLoad
(
snapshotData
)
{
...
...
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