diff --git a/src/module.ts b/src/module.ts index 3c52a39..16e0522 100644 --- a/src/module.ts +++ b/src/module.ts @@ -62,6 +62,17 @@ class PlotlyPanelCtrl extends MetricsPanelCtrl { width: 0, }, showscale: false, + cauto: true, + cmin: 0, + cmax: 1, + cmid: null, + }, + hover: { + type: '', + hovertemplate: '', + hoverlabel: { + align: '', + }, }, color_option: 'ramp', }, @@ -686,6 +697,20 @@ class PlotlyPanelCtrl extends MetricsPanelCtrl { if (mode) { trace.mode = mode.substring(1); } + + if (config.settings.hover) { + if (config.settings.hover.hovertemplate) { + trace.hovertemplate = config.settings.hover.hovertemplate; + } + if (config.settings.hover.hoverlabel) { + trace.hoverlabel = config.settings.hover.hoverlabel; + } + if (config.settings.hover.type) { + trace.hovertype = config.settings.hover.type; + } else { + trace.hovertype = ''; + } + } return trace; }); } @@ -731,7 +756,15 @@ class PlotlyPanelCtrl extends MetricsPanelCtrl { if (!vals) { vals = zero; } - _.set(trace, v.path, vals); + let tempVals = vals; + if (v.path === 'text' && trace.hovertype === 'Date'){ + let tempDate: Date[] = []; + vals.forEach( x => { + tempDate.push(new Date(x)); + }); + tempVals = tempDate; + } + _.set(trace, v.path, tempVals); }); } }); diff --git a/src/partials/tab_traces.html b/src/partials/tab_traces.html index 047b6d7..b2aac6a 100644 --- a/src/partials/tab_traces.html +++ b/src/partials/tab_traces.html @@ -154,6 +154,46 @@