Browse Source

Choosing custom color for analytic unit #31 (#40)

master
sanke1 6 years ago committed by rozetko
parent
commit
b4097dc1c9
  1. 2
      src/controllers/analytic_controller.ts
  2. 4
      src/module.ts
  3. 2
      src/partials/tab_analytics.html

2
src/controllers/analytic_controller.ts

@ -170,7 +170,7 @@ export class AnalyticController {
return this._analyticUnitsSet.items; return this._analyticUnitsSet.items;
} }
onAnomalyColorChange(id: AnalyticUnitId, value) { onAnalyticUnitColorChange(id: AnalyticUnitId, value: string) {
this._analyticUnitsSet.byId(id).color = value; this._analyticUnitsSet.byId(id).color = value;
} }

4
src/module.ts

@ -530,11 +530,11 @@ class GraphCtrl extends MetricsPanelCtrl {
this.render(this.seriesList); this.render(this.seriesList);
} }
onColorChange(id: AnalyticUnitId, value) { onColorChange(id: AnalyticUnitId, value: string) {
if(id === undefined) { if(id === undefined) {
throw new Error('id is undefined'); throw new Error('id is undefined');
} }
this.analyticsController.onAnomalyColorChange(id, value); this.analyticsController.onAnalyticUnitColorChange(id, value);
this.render(); this.render();
} }

2
src/partials/tab_analytics.html

@ -31,7 +31,7 @@
<span class="gf-form-label"> <span class="gf-form-label">
<color-picker <color-picker
color="analyticUnit.color" color="analyticUnit.color"
onChange="ctrl.onAnomalyColorChange.bind(ctrl, analyticUnit.id)" onChange="ctrl.onColorChange.bind(ctrl, analyticUnit.id)"
/> />
</span> </span>

Loading…
Cancel
Save