mirror of
https://github.com/zaphar/Heracles.git
synced 2025-07-22 20:19:50 -04:00
ui: Allow you to specify the fill for a trace
This commit is contained in:
parent
b1b65bbbec
commit
835c120d4b
@ -9,6 +9,7 @@
|
||||
query: 'sum by (instance)(irate(node_cpu_seconds_total{job="nodestats"}[5m]))' # The PromQL query for this plot
|
||||
meta: # metadata for this plot
|
||||
name_format: "`${labels.instance}`" # javascript template literal to format the trace name
|
||||
fill: tozeroy
|
||||
#d3_tick_format: "~%" # d3 tick format override for this plot's yaxis
|
||||
#named_axis: "y" # yaxis name to use for this subplots traces
|
||||
span: # The span for this range query
|
||||
|
17
src/query.rs
17
src/query.rs
@ -117,10 +117,27 @@ pub struct DataPoint {
|
||||
value: f64,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub enum FillTypes {
|
||||
#[serde(rename = "tonexty")]
|
||||
ToNextY,
|
||||
#[serde(rename = "tozeroy")]
|
||||
ToZeroY,
|
||||
#[serde(rename = "tonextx")]
|
||||
ToNextX,
|
||||
#[serde(rename = "tozerox")]
|
||||
ToZeroX,
|
||||
#[serde(rename = "toself")]
|
||||
ToSelf,
|
||||
#[serde(rename = "tonext")]
|
||||
ToNext,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Debug, Clone)]
|
||||
pub struct PlotMeta {
|
||||
name_format: Option<String>,
|
||||
named_axis: Option<String>,
|
||||
fill: Option<FillTypes>,
|
||||
d3_tick_format: Option<String>,
|
||||
}
|
||||
|
||||
|
@ -287,6 +287,9 @@ class TimeseriesGraph extends HTMLElement {
|
||||
yaxis: yaxis,
|
||||
yhoverformat: meta["d3_tick_format"],
|
||||
};
|
||||
if (meta.fill) {
|
||||
trace.fill = meta.fill;
|
||||
}
|
||||
var name = this.formatName(meta, labels);
|
||||
if (name) { trace.name = name; }
|
||||
for (const point of series) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user