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
5cb9dc99
Commit
5cb9dc99
authored
Oct 04, 2018
by
David Kaltschmidt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: resize graph on window resize
parent
1a6b0adb
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
1 deletions
+9
-1
public/app/features/explore/Graph.tsx
+9
-1
No files found.
public/app/features/explore/Graph.tsx
View file @
5cb9dc99
import
$
from
'jquery'
;
import
$
from
'jquery'
;
import
_
from
'lodash'
;
import
React
,
{
Component
}
from
'react'
;
import
React
,
{
Component
}
from
'react'
;
import
moment
from
'moment'
;
import
moment
from
'moment'
;
...
@@ -68,7 +69,7 @@ const FLOT_OPTIONS = {
...
@@ -68,7 +69,7 @@ const FLOT_OPTIONS = {
// },
// },
};
};
class
Graph
extends
Component
<
any
,
any
>
{
class
Graph
extends
Component
<
any
,
{
showAllTimeSeries
:
boolean
}
>
{
state
=
{
state
=
{
showAllTimeSeries
:
false
,
showAllTimeSeries
:
false
,
};
};
...
@@ -81,6 +82,7 @@ class Graph extends Component<any, any> {
...
@@ -81,6 +82,7 @@ class Graph extends Component<any, any> {
componentDidMount
()
{
componentDidMount
()
{
this
.
draw
();
this
.
draw
();
window
.
addEventListener
(
'resize'
,
this
.
debouncedDraw
);
}
}
componentDidUpdate
(
prevProps
)
{
componentDidUpdate
(
prevProps
)
{
...
@@ -94,6 +96,10 @@ class Graph extends Component<any, any> {
...
@@ -94,6 +96,10 @@ class Graph extends Component<any, any> {
}
}
}
}
componentWillUnmount
()
{
window
.
removeEventListener
(
'resize'
,
this
.
debouncedDraw
);
}
onShowAllTimeSeries
=
()
=>
{
onShowAllTimeSeries
=
()
=>
{
this
.
setState
(
this
.
setState
(
{
{
...
@@ -103,6 +109,8 @@ class Graph extends Component<any, any> {
...
@@ -103,6 +109,8 @@ class Graph extends Component<any, any> {
);
);
};
};
debouncedDraw
=
_
.
debounce
(()
=>
this
.
draw
(),
100
);
draw
()
{
draw
()
{
const
{
options
:
userOptions
}
=
this
.
props
;
const
{
options
:
userOptions
}
=
this
.
props
;
const
data
=
this
.
getGraphData
();
const
data
=
this
.
getGraphData
();
...
...
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