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
fbf39598
Commit
fbf39598
authored
May 05, 2017
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
heatmp: removed series stats option, lacked tests
parent
ece21b2d
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
48 deletions
+25
-48
public/app/plugins/panel/heatmap/heatmap_ctrl.ts
+0
-1
public/app/plugins/panel/heatmap/heatmap_data_converter.ts
+0
-10
public/app/plugins/panel/heatmap/heatmap_tooltip.ts
+25
-33
public/app/plugins/panel/heatmap/partials/display_editor.html
+0
-4
No files found.
public/app/plugins/panel/heatmap/heatmap_ctrl.ts
View file @
fbf39598
...
...
@@ -46,7 +46,6 @@ let panelDefaults = {
yBucketNumber
:
null
,
tooltip
:
{
show
:
true
,
seriesStat
:
false
,
showHistogram
:
false
},
highlightCards
:
true
...
...
public/app/plugins/panel/heatmap/heatmap_data_converter.ts
View file @
fbf39598
...
...
@@ -60,7 +60,6 @@ function convertToCards(buckets) {
yBounds
:
yBucket
.
bounds
,
values
:
yBucket
.
values
,
count
:
yBucket
.
count
,
seriesStat
:
getSeriesStat
(
yBucket
.
points
)
};
cards
.
push
(
card
);
});
...
...
@@ -146,15 +145,6 @@ function removeZeroBuckets(buckets) {
}
/**
* Count values number for each timeseries in given bucket
* @param {Array} points Bucket's datapoints with series name ([val, ts, series_name])
* @return {Object} seriesStat: {seriesName_1: val_1, seriesName_2: val_2}
*/
function
getSeriesStat
(
points
)
{
return
_
.
countBy
(
points
,
p
=>
p
[
2
]);
}
/**
* Convert set of time series into heatmap buckets
* @return {Object} Heatmap object:
* {
...
...
public/app/plugins/panel/heatmap/heatmap_tooltip.ts
View file @
fbf39598
...
...
@@ -87,17 +87,18 @@ export class HeatmapTooltip {
let
tooltipHtml
=
`<div class="graph-tooltip-time">
${
time
}
</div>
<div class="heatmap-histogram"></div>`
;
if
(
yData
&&
yData
.
bounds
)
{
boundBottom
=
valueFormatter
(
yData
.
bounds
.
bottom
);
boundTop
=
valueFormatter
(
yData
.
bounds
.
top
);
valuesNumber
=
yData
.
count
;
tooltipHtml
+=
`<div>
bucket: <b>
${
boundBottom
}
-
${
boundTop
}
</b> <br>
count: <b>
${
valuesNumber
}
</b> <br>
</div>`
;
if
(
this
.
panel
.
tooltip
.
seriesStat
&&
yData
.
seriesStat
)
{
tooltipHtml
=
this
.
addSeriesStat
(
tooltipHtml
,
yData
.
seriesStat
);
if
(
yData
)
{
if
(
yData
.
bounds
)
{
boundBottom
=
valueFormatter
(
yData
.
bounds
.
bottom
);
boundTop
=
valueFormatter
(
yData
.
bounds
.
top
);
valuesNumber
=
yData
.
count
;
tooltipHtml
+=
`<div>
bucket: <b>
${
boundBottom
}
-
${
boundTop
}
</b> <br>
count: <b>
${
valuesNumber
}
</b> <br>
</div>`
;
}
else
{
// currently no bounds for pre bucketed data
tooltipHtml
+=
`<div>count: <b>
${
yData
.
count
}
</b><br></div>`
;
}
}
else
{
if
(
!
this
.
panel
.
tooltip
.
showHistogram
)
{
...
...
@@ -159,15 +160,6 @@ export class HeatmapTooltip {
return
pos
;
}
addSeriesStat
(
tooltipHtml
,
seriesStat
)
{
tooltipHtml
+=
"series: <br>"
;
_
.
forEach
(
seriesStat
,
(
values
,
series
)
=>
{
tooltipHtml
+=
` -
${
series
}
: <b>
${
values
}
</b><br>`
;
});
return
tooltipHtml
;
}
addHistogram
(
data
)
{
let
xBucket
=
this
.
scope
.
ctrl
.
data
.
buckets
[
data
.
x
];
let
yBucketSize
=
this
.
scope
.
ctrl
.
data
.
yBucketSize
;
...
...
@@ -181,8 +173,8 @@ export class HeatmapTooltip {
let
scale
=
this
.
scope
.
yScale
.
copy
();
let
histXScale
=
scale
.
domain
([
min
,
max
])
.
range
([
0
,
HISTOGRAM_WIDTH
]);
.
domain
([
min
,
max
])
.
range
([
0
,
HISTOGRAM_WIDTH
]);
let
barWidth
;
if
(
this
.
panel
.
yAxis
.
logBase
===
1
)
{
...
...
@@ -193,21 +185,21 @@ export class HeatmapTooltip {
barWidth
=
Math
.
max
(
barWidth
,
1
);
let
histYScale
=
d3
.
scaleLinear
()
.
domain
([
0
,
_
.
max
(
_
.
map
(
histogramData
,
d
=>
d
[
1
]))])
.
range
([
0
,
HISTOGRAM_HEIGHT
]);
.
domain
([
0
,
_
.
max
(
_
.
map
(
histogramData
,
d
=>
d
[
1
]))])
.
range
([
0
,
HISTOGRAM_HEIGHT
]);
let
histogram
=
this
.
tooltip
.
select
(
".heatmap-histogram"
)
.
append
(
"svg"
)
.
attr
(
"width"
,
HISTOGRAM_WIDTH
)
.
attr
(
"height"
,
HISTOGRAM_HEIGHT
);
.
append
(
"svg"
)
.
attr
(
"width"
,
HISTOGRAM_WIDTH
)
.
attr
(
"height"
,
HISTOGRAM_HEIGHT
);
histogram
.
selectAll
(
".bar"
).
data
(
histogramData
)
.
enter
().
append
(
"rect"
)
.
attr
(
"x"
,
d
=>
{
return
histXScale
(
d
[
0
]);
})
.
attr
(
"width"
,
barWidth
)
.
attr
(
"y"
,
d
=>
{
.
enter
().
append
(
"rect"
)
.
attr
(
"x"
,
d
=>
{
return
histXScale
(
d
[
0
]);
})
.
attr
(
"width"
,
barWidth
)
.
attr
(
"y"
,
d
=>
{
return
HISTOGRAM_HEIGHT
-
histYScale
(
d
[
1
]);
})
.
attr
(
"height"
,
d
=>
{
...
...
public/app/plugins/panel/heatmap/partials/display_editor.html
View file @
fbf39598
...
...
@@ -63,10 +63,6 @@
</gf-form-switch>
<div
ng-if=
"ctrl.panel.tooltip.show"
>
<gf-form-switch
class=
"gf-form"
label-class=
"width-8"
label=
"Series stats"
checked=
"ctrl.panel.tooltip.seriesStat"
on-change=
"ctrl.render()"
>
</gf-form-switch>
<gf-form-switch
class=
"gf-form"
label-class=
"width-8"
label=
"Histogram"
checked=
"ctrl.panel.tooltip.showHistogram"
on-change=
"ctrl.render()"
>
</gf-form-switch>
...
...
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