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
225ecd68
Unverified
Commit
225ecd68
authored
Nov 07, 2019
by
Dominik Prokop
Committed by
GitHub
Nov 07, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Explore: Configure explore series colours via field config (#20239)
parent
e4afc8d5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
12 deletions
+20
-12
packages/grafana-data/src/dataframe/processDataFrame.ts
+2
-3
packages/grafana-data/src/types/data.ts
+0
-1
public/app/core/logs_model.ts
+7
-3
public/app/plugins/panel/graph2/getGraphSeriesModel.ts
+11
-5
No files found.
packages/grafana-data/src/dataframe/processDataFrame.ts
View file @
225ecd68
...
...
@@ -63,10 +63,9 @@ function convertTimeSeriesToDataFrame(timeSeries: TimeSeries): DataFrame {
type
:
FieldType
.
number
,
config
:
{
unit
:
timeSeries
.
unit
,
color
:
timeSeries
.
color
,
},
values
:
new
ArrayVector
<
TimeSeriesValue
>
(),
}
as
Field
<
TimeSeriesValue
,
ArrayVector
<
TimeSeriesValue
>>
,
},
{
name
:
'Time'
,
type
:
FieldType
.
time
,
...
...
@@ -74,7 +73,7 @@ function convertTimeSeriesToDataFrame(timeSeries: TimeSeries): DataFrame {
unit
:
'dateTimeAsIso'
,
},
values
:
new
ArrayVector
<
number
>
(),
}
as
Field
<
number
,
ArrayVector
<
number
>>
,
},
];
for
(
const
point
of
timeSeries
.
datapoints
)
{
...
...
packages/grafana-data/src/types/data.ts
View file @
225ecd68
...
...
@@ -58,7 +58,6 @@ export interface TimeSeries extends QueryResultBase {
target
:
string
;
datapoints
:
TimeSeriesPoints
;
unit
?:
string
;
color
?:
string
;
tags
?:
Labels
;
}
...
...
public/app/core/logs_model.ts
View file @
225ecd68
...
...
@@ -149,13 +149,18 @@ export function makeSeriesForLogs(rows: LogRowModel[], intervalMs: number, timeZ
});
const
timeField
=
data
.
fields
[
1
];
timeField
.
display
=
getDisplayProcessor
({
config
:
timeField
.
config
,
type
:
timeField
.
type
,
isUtc
:
timeZone
===
'utc'
,
});
const
valueField
=
data
.
fields
[
0
];
valueField
.
config
=
{
...
valueField
.
config
,
color
:
series
.
color
,
};
const
graphSeries
:
GraphSeriesXY
=
{
color
:
series
.
color
,
label
:
series
.
alias
,
...
...
@@ -168,7 +173,7 @@ export function makeSeriesForLogs(rows: LogRowModel[], intervalMs: number, timeZ
},
seriesIndex
:
i
,
timeField
,
valueField
:
data
.
fields
[
0
]
,
valueField
,
// for now setting the time step to be 0,
// and handle the bar width by setting lineWidth instead of barWidth in flot options
timeStep
:
0
,
...
...
@@ -197,7 +202,6 @@ export function dataFrameToLogsModel(dataFrame: DataFrame[], intervalMs: number,
// Create metrics from logs
logsModel
.
series
=
makeSeriesForLogs
(
logsModel
.
rows
,
intervalMs
,
timeZone
);
}
else
{
// We got metrics in the dataFrame so process those
logsModel
.
series
=
getGraphSeriesModel
(
metricSeries
,
timeZone
,
...
...
public/app/plugins/panel/graph2/getGraphSeriesModel.ts
View file @
225ecd68
...
...
@@ -74,10 +74,16 @@ export const getGraphSeriesModel = (
});
}
const
seriesColor
=
seriesOptions
[
field
.
name
]
&&
seriesOptions
[
field
.
name
].
color
?
getColorFromHexRgbOrName
(
seriesOptions
[
field
.
name
].
color
)
:
colors
[
graphs
.
length
%
colors
.
length
];
let
seriesColor
;
if
(
seriesOptions
[
field
.
name
]
&&
seriesOptions
[
field
.
name
].
color
)
{
// Case when panel has settings provided via SeriesOptions, i.e. graph panel
seriesColor
=
getColorFromHexRgbOrName
(
seriesOptions
[
field
.
name
].
color
);
}
else
if
(
field
.
config
&&
field
.
config
.
color
)
{
// Case when color settings are set on field, i.e. Explore logs histogram (see makeSeriesForLogs)
seriesColor
=
field
.
config
.
color
;
}
else
{
seriesColor
=
colors
[
graphs
.
length
%
colors
.
length
];
}
field
.
config
=
fieldOptions
?
{
...
...
@@ -86,7 +92,7 @@ export const getGraphSeriesModel = (
decimals
:
fieldOptions
.
defaults
.
decimals
,
color
:
seriesColor
,
}
:
{
...
field
.
config
};
:
{
...
field
.
config
,
color
:
seriesColor
};
field
.
display
=
getDisplayProcessor
({
config
:
{
...
field
.
config
},
type
:
field
.
type
});
...
...
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