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
a36bd895
Unverified
Commit
a36bd895
authored
Dec 04, 2020
by
Ryan McKinley
Committed by
GitHub
Dec 04, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GraphNG: add spanNulls config option (#29512)
parent
d59086b2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
1 deletions
+29
-1
packages/grafana-ui/src/components/GraphNG/utils.ts
+16
-1
packages/grafana-ui/src/components/uPlot/config.ts
+2
-0
public/app/plugins/panel/graph3/module.tsx
+11
-0
No files found.
packages/grafana-ui/src/components/GraphNG/utils.ts
View file @
a36bd895
...
...
@@ -43,6 +43,7 @@ export function mapDimesions(match: XYFieldMatchers, frame: DataFrame, frames?:
export
function
alignDataFrames
(
frames
:
DataFrame
[],
fields
?:
XYFieldMatchers
):
AlignedFrameWithGapTest
|
null
{
const
valuesFromFrames
:
AlignedData
[]
=
[];
const
sourceFields
:
Field
[]
=
[];
let
spanNulls
=
false
;
// Default to timeseries config
if
(
!
fields
)
{
...
...
@@ -79,6 +80,10 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers):
}
alignedData
.
push
(
values
);
if
(
field
.
config
.
custom
.
spanNulls
)
{
spanNulls
=
true
;
}
// This will cache an appropriate field name in the field state
getFieldDisplayName
(
field
,
frame
,
frames
);
sourceFields
.
push
(
field
);
...
...
@@ -92,12 +97,22 @@ export function alignDataFrames(frames: DataFrame[], fields?: XYFieldMatchers):
}
// do the actual alignment (outerJoin on the first arrays)
cons
t
{
data
:
alignedData
,
isGap
}
=
outerJoinValues
(
valuesFromFrames
);
le
t
{
data
:
alignedData
,
isGap
}
=
outerJoinValues
(
valuesFromFrames
);
if
(
alignedData
!
.
length
!==
sourceFields
.
length
)
{
throw
new
Error
(
'outerJoinValues lost a field?'
);
}
// Wrap the gap function when span nulls exists
if
(
spanNulls
)
{
isGap
=
(
u
:
uPlot
,
seriesIdx
:
number
,
dataIdx
:
number
)
=>
{
if
(
sourceFields
[
seriesIdx
].
config
?.
custom
?.
spanNulls
)
{
return
false
;
}
return
isGap
(
u
,
seriesIdx
,
dataIdx
);
};
}
// Replace the values from the outer-join field
return
{
frame
:
{
...
...
packages/grafana-ui/src/components/uPlot/config.ts
View file @
a36bd895
...
...
@@ -55,6 +55,8 @@ export interface AxisConfig {
export
interface
GraphFieldConfig
extends
LineConfig
,
AreaConfig
,
PointsConfig
,
AxisConfig
{
mode
?:
GraphMode
;
spanNulls
?:
boolean
;
}
export
const
graphFieldOptions
=
{
...
...
public/app/plugins/panel/graph3/module.tsx
View file @
a36bd895
...
...
@@ -83,6 +83,17 @@ export const plugin = new PanelPlugin<Options, GraphFieldConfig>(GraphPanel)
showIf
:
c
=>
c
.
points
!==
PointMode
.
Never
,
})
.
addRadio
({
path
:
'spanNulls'
,
name
:
'Null values'
,
defaultValue
:
false
,
settings
:
{
options
:
[
{
label
:
'Gaps'
,
value
:
false
},
{
label
:
'Connected'
,
value
:
true
},
],
},
})
.
addRadio
({
path
:
'axisPlacement'
,
name
:
'Placement'
,
category
:
[
'Axis'
],
...
...
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