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
562411af
Commit
562411af
authored
Nov 06, 2018
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed options
parent
b9612aaa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
29 deletions
+29
-29
public/app/plugins/panel/graph2/module.tsx
+3
-3
public/app/viz/Graph.tsx
+26
-26
No files found.
public/app/plugins/panel/graph2/module.tsx
View file @
562411af
...
@@ -45,15 +45,15 @@ export class Graph2 extends PureComponent<Props> {
...
@@ -45,15 +45,15 @@ export class Graph2 extends PureComponent<Props> {
export
class
GraphOptions
extends
PureComponent
<
PanelOptionsProps
<
Options
>>
{
export
class
GraphOptions
extends
PureComponent
<
PanelOptionsProps
<
Options
>>
{
onToggleLines
=
()
=>
{
onToggleLines
=
()
=>
{
this
.
props
.
onChange
({
showLines
:
!
this
.
props
.
options
.
showLines
,
...
this
.
props
.
option
s
});
this
.
props
.
onChange
({
...
this
.
props
.
options
,
showLines
:
!
this
.
props
.
options
.
showLine
s
});
};
};
onToggleBars
=
()
=>
{
onToggleBars
=
()
=>
{
this
.
props
.
onChange
({
showBars
:
!
this
.
props
.
options
.
showBars
,
...
this
.
props
.
option
s
});
this
.
props
.
onChange
({
...
this
.
props
.
options
,
showBars
:
!
this
.
props
.
options
.
showBar
s
});
};
};
onTogglePoints
=
()
=>
{
onTogglePoints
=
()
=>
{
this
.
props
.
onChange
({
showPoints
:
!
this
.
props
.
options
.
showPoints
,
...
this
.
props
.
option
s
});
this
.
props
.
onChange
({
...
this
.
props
.
options
,
showPoints
:
!
this
.
props
.
options
.
showPoint
s
});
};
};
render
()
{
render
()
{
...
...
public/app/viz/Graph.tsx
View file @
562411af
...
@@ -8,32 +8,6 @@ import 'vendor/flot/jquery.flot.time';
...
@@ -8,32 +8,6 @@ import 'vendor/flot/jquery.flot.time';
// Types
// Types
import
{
TimeRange
,
TimeSeriesVMs
}
from
'app/types'
;
import
{
TimeRange
,
TimeSeriesVMs
}
from
'app/types'
;
// Copied from graph.ts
function
time_format
(
ticks
,
min
,
max
)
{
if
(
min
&&
max
&&
ticks
)
{
const
range
=
max
-
min
;
const
secPerTick
=
range
/
ticks
/
1000
;
const
oneDay
=
86400000
;
const
oneYear
=
31536000000
;
if
(
secPerTick
<=
45
)
{
return
'%H:%M:%S'
;
}
if
(
secPerTick
<=
7200
||
range
<=
oneDay
)
{
return
'%H:%M'
;
}
if
(
secPerTick
<=
80000
)
{
return
'%m/%d %H:%M'
;
}
if
(
secPerTick
<=
2419200
||
range
<=
oneYear
)
{
return
'%m/%d'
;
}
return
'%Y-%m'
;
}
return
'%H:%M'
;
}
interface
GraphProps
{
interface
GraphProps
{
timeSeries
:
TimeSeriesVMs
;
timeSeries
:
TimeSeriesVMs
;
timeRange
:
TimeRange
;
timeRange
:
TimeRange
;
...
@@ -139,4 +113,30 @@ export class Graph extends PureComponent<GraphProps> {
...
@@ -139,4 +113,30 @@ export class Graph extends PureComponent<GraphProps> {
}
}
}
}
// Copied from graph.ts
function
time_format
(
ticks
,
min
,
max
)
{
if
(
min
&&
max
&&
ticks
)
{
const
range
=
max
-
min
;
const
secPerTick
=
range
/
ticks
/
1000
;
const
oneDay
=
86400000
;
const
oneYear
=
31536000000
;
if
(
secPerTick
<=
45
)
{
return
'%H:%M:%S'
;
}
if
(
secPerTick
<=
7200
||
range
<=
oneDay
)
{
return
'%H:%M'
;
}
if
(
secPerTick
<=
80000
)
{
return
'%m/%d %H:%M'
;
}
if
(
secPerTick
<=
2419200
||
range
<=
oneYear
)
{
return
'%m/%d'
;
}
return
'%Y-%m'
;
}
return
'%H:%M'
;
}
export
default
withSize
()(
Graph
);
export
default
withSize
()(
Graph
);
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