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
0558b17b
Commit
0558b17b
authored
Mar 20, 2019
by
ryan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
show all colums in graph
parent
e7a6041d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
14 deletions
+44
-14
packages/grafana-ui/src/utils/processTableData.ts
+10
-0
public/app/plugins/panel/graph2/GraphPanel.tsx
+34
-14
No files found.
packages/grafana-ui/src/utils/processTableData.ts
View file @
0558b17b
...
...
@@ -149,6 +149,16 @@ function convertTimeSeriesToTableData(timeSeries: TimeSeries): TableData {
};
}
export
const
getFirstTimeColumn
=
(
table
:
TableData
):
number
=>
{
const
{
columns
}
=
table
;
for
(
let
i
=
0
;
i
<
columns
.
length
;
i
++
)
{
if
(
columns
[
i
].
type
===
ColumnType
.
time
)
{
return
i
;
}
}
return
-
1
;
};
/**
* @returns a table Returns a copy of the table with the best guess for each column type
*/
...
...
public/app/plugins/panel/graph2/GraphPanel.tsx
View file @
0558b17b
...
...
@@ -2,14 +2,17 @@
import
_
from
'lodash'
;
import
React
,
{
PureComponent
}
from
'react'
;
// Utils
import
{
processTimeSeries
}
from
'@grafana/ui/src/utils'
;
// Components
import
{
Graph
}
from
'@grafana/ui'
;
// Types
import
{
PanelProps
,
NullValueMode
,
TimeSeriesVMs
}
from
'@grafana/ui/src/types'
;
import
{
Graph
,
PanelProps
,
NullValueMode
,
colors
,
TimeSeriesVMs
,
ColumnType
,
guessColumnTypes
,
getFirstTimeColumn
,
processTimeSeries
,
}
from
'@grafana/ui'
;
import
{
Options
}
from
'./types'
;
interface
Props
extends
PanelProps
<
Options
>
{}
...
...
@@ -19,12 +22,29 @@ export class GraphPanel extends PureComponent<Props> {
const
{
data
,
timeRange
,
width
,
height
}
=
this
.
props
;
const
{
showLines
,
showBars
,
showPoints
}
=
this
.
props
.
options
;
let
vmSeries
:
TimeSeriesVMs
;
if
(
data
)
{
vmSeries
=
processTimeSeries
({
data
,
nullValueMode
:
NullValueMode
.
Ignore
,
});
const
vmSeries
:
TimeSeriesVMs
=
[];
for
(
let
t
=
0
;
t
<
data
.
length
;
t
++
)
{
const
table
=
guessColumnTypes
(
data
[
t
]);
const
timeColumn
=
getFirstTimeColumn
(
table
);
if
(
timeColumn
>=
0
)
{
for
(
let
i
=
0
;
i
<
table
.
columns
.
length
;
i
++
)
{
const
column
=
table
.
columns
[
i
];
// Show all numeric columns
if
(
column
.
type
===
ColumnType
.
number
)
{
const
tsvm
=
processTimeSeries
({
data
:
[
table
],
xColumn
:
timeColumn
,
yColumn
:
i
,
nullValueMode
:
NullValueMode
.
Null
,
})[
0
];
const
colorIndex
=
vmSeries
.
length
%
colors
.
length
;
tsvm
.
color
=
colors
[
colorIndex
];
vmSeries
.
push
(
tsvm
);
}
}
}
}
return
(
...
...
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