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
2a08f4bd
Unverified
Commit
2a08f4bd
authored
Oct 16, 2020
by
Dominik Prokop
Committed by
GitHub
Oct 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GraphNG: Use AxisSide enum (#28320)
parent
93051179
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
17 additions
and
21 deletions
+17
-21
packages/grafana-ui/src/components/GraphNG/GraphNG.tsx
+3
-3
packages/grafana-ui/src/components/index.ts
+1
-1
packages/grafana-ui/src/components/uPlot/geometries/types.ts
+3
-1
packages/grafana-ui/src/components/uPlot/types.ts
+6
-6
public/app/plugins/panel/graph3/module.tsx
+4
-10
No files found.
packages/grafana-ui/src/components/GraphNG/GraphNG.tsx
View file @
2a08f4bd
...
...
@@ -12,7 +12,7 @@ import { timeFormatToTemplate } from '../uPlot/utils';
import
{
alignAndSortDataFramesByFieldName
}
from
'./utils'
;
import
{
Area
,
Axis
,
Line
,
Point
,
Scale
,
SeriesGeometry
}
from
'../uPlot/geometries'
;
import
{
UPlotChart
}
from
'../uPlot/Plot'
;
import
{
GraphCustomFieldConfig
,
PlotProps
}
from
'../uPlot/types'
;
import
{
AxisSide
,
GraphCustomFieldConfig
,
PlotProps
}
from
'../uPlot/types'
;
import
{
useTheme
}
from
'../../themes'
;
const
timeStampsConfig
=
[
...
...
@@ -103,7 +103,7 @@ export const GraphNG: React.FC<GraphNGProps> = ({ data, children, ...plotProps }
scales
.
push
(<
Scale
key=
"scale-x"
scaleKey=
"x"
time
/>);
}
axes
.
push
(<
Axis
key=
"axis-scale--x"
scaleKey=
"x"
values=
{
timeStampsConfig
}
side=
{
2
}
/>);
axes
.
push
(<
Axis
key=
"axis-scale--x"
scaleKey=
"x"
values=
{
timeStampsConfig
}
side=
{
AxisSide
.
Bottom
}
/>);
let
seriesIdx
=
0
;
const
uniqueScales
:
Record
<
string
,
boolean
>
=
{};
...
...
@@ -130,7 +130,7 @@ export const GraphNG: React.FC<GraphNGProps> = ({ data, children, ...plotProps }
scaleKey=
{
scale
}
label=
{
config
.
custom
?.
axis
?.
label
}
size=
{
config
.
custom
?.
axis
?.
width
}
side=
{
config
.
custom
?.
axis
?.
side
||
3
}
side=
{
config
.
custom
?.
axis
?.
side
||
AxisSide
.
Left
}
grid=
{
config
.
custom
?.
axis
?.
grid
}
formatValue=
{
v
=>
formattedValueToString
(
fmt
(
v
))
}
/>
...
...
packages/grafana-ui/src/components/index.ts
View file @
2a08f4bd
...
...
@@ -201,7 +201,7 @@ const LegacyForms = {
export
{
LegacyForms
,
LegacyInputStatus
};
// WIP, need renames and exports cleanup
export
{
GraphCustomFieldConfig
}
from
'./uPlot/types'
;
export
{
GraphCustomFieldConfig
,
AxisSide
}
from
'./uPlot/types'
;
export
{
UPlotChart
}
from
'./uPlot/Plot'
;
export
*
from
'./uPlot/geometries'
;
export
{
usePlotConfigContext
}
from
'./uPlot/context'
;
...
...
packages/grafana-ui/src/components/uPlot/geometries/types.ts
View file @
2a08f4bd
import
{
AxisSide
}
from
'../types'
;
export
interface
LineProps
{
scaleKey
:
string
;
stroke
:
string
;
...
...
@@ -22,7 +24,7 @@ export interface AxisProps {
show
?:
boolean
;
size
?:
number
;
stroke
?:
string
;
side
?:
number
;
side
?:
AxisSide
;
grid
?:
boolean
;
formatValue
?:
(
v
:
any
)
=>
string
;
values
?:
any
;
...
...
packages/grafana-ui/src/components/uPlot/types.ts
View file @
2a08f4bd
...
...
@@ -4,16 +4,16 @@ import { DataFrame, FieldColor, TimeRange, TimeZone } from '@grafana/data';
export
type
NullValuesMode
=
'null'
|
'connected'
|
'asZero'
;
export
enum
MicroPlot
AxisSide
{
top
=
0
,
right
=
1
,
bottom
=
2
,
left
=
3
,
export
enum
AxisSide
{
Top
,
Right
,
Bottom
,
Left
,
}
interface
AxisConfig
{
label
:
string
;
side
:
number
;
side
:
AxisSide
;
grid
:
boolean
;
width
:
number
;
}
...
...
public/app/plugins/panel/graph3/module.tsx
View file @
2a08f4bd
import
{
FieldConfigProperty
,
PanelPlugin
}
from
'@grafana/data'
;
import
{
GraphCustomFieldConfig
}
from
'@grafana/ui'
;
import
{
AxisSide
,
GraphCustomFieldConfig
}
from
'@grafana/ui'
;
import
{
GraphPanel
}
from
'./GraphPanel'
;
import
{
Options
}
from
'./types'
;
...
...
@@ -113,11 +113,11 @@ export const plugin = new PanelPlugin<Options, GraphCustomFieldConfig>(GraphPane
path
:
'axis.side'
,
name
:
'Y axis side'
,
category
:
[
'Axis'
],
defaultValue
:
3
,
defaultValue
:
AxisSide
.
Left
,
settings
:
{
options
:
[
{
value
:
3
,
label
:
'Left'
},
{
value
:
1
,
label
:
'Right'
},
{
value
:
AxisSide
.
Left
,
label
:
'Left'
},
{
value
:
AxisSide
.
Right
,
label
:
'Right'
},
],
},
})
...
...
@@ -167,12 +167,6 @@ export const plugin = new PanelPlugin<Options, GraphCustomFieldConfig>(GraphPane
],
},
})
// .addBooleanSwitch({
// path: 'graph.realTimeUpdates',
// name: 'Real time updates',
// description: 'continue to update the graph so the time axis matches the clock.',
// defaultValue: false,
// })
.
addBooleanSwitch
({
category
:
[
'Legend'
],
path
:
'legend.isVisible'
,
...
...
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