Skip to content

Commit 417aaa0

Browse files
author
Jim Hague
committed
Display trace legends in the order in which traces are given to Plot.ly.
For autotrace, this is the order in which traces are created from the data, which in turn is the order in the data. For manual traces, this is the order of the traces.
1 parent 11edd62 commit 417aaa0

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

src/module.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ class PlotlyPanelCtrl extends MetricsPanelCtrl {
9595
showlegend: false,
9696
legend: {
9797
orientation: 'h',
98+
traceorder: 'normal',
9899
},
99100
dragmode: 'lasso', // (enumerated: "zoom" | "pan" | "select" | "lasso" | "orbit" | "turntable" )
100101
hovermode: 'closest',

src/partials/tab_display.html

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,14 +104,24 @@ <h5 class="section-heading">Options</h5>
104104
on-change="ctrl.editor.onConfigChanged()"></gf-form-switch>
105105

106106
<div class="gf-form" ng-if="ctrl.cfg.layout.showlegend">
107-
<label class="gf-form-label width-7">- Orientation</label>
108-
<div class="gf-form-select-wrapper max-width-14">
109-
<select class="gf-form-input" ng-model="ctrl.cfg.layout.legend.orientation" ng-change="ctrl.onConfigChanged()">
110-
<option value="h">Horizontal</option>
111-
<option value="v">Vertical</option>
112-
</select>
113-
</div>
107+
<label class="gf-form-label width-7">- Orientation</label>
108+
<div class="gf-form-select-wrapper max-width-14">
109+
<select class="gf-form-input" ng-model="ctrl.cfg.layout.legend.orientation" ng-change="ctrl.onConfigChanged()">
110+
<option value="h">Horizontal</option>
111+
<option value="v">Vertical</option>
112+
</select>
113+
</div>
114+
</div>
115+
116+
<div class="gf-form" ng-if="ctrl.cfg.layout.showlegend">
117+
<label class="gf-form-label width-7">- Order</label>
118+
<div class="gf-form-select-wrapper max-width-14">
119+
<select class="gf-form-input" ng-model="ctrl.cfg.layout.legend.traceorder" ng-change="ctrl.onConfigChanged()">
120+
<option value="normal">Normal</option>
121+
<option value="reversed">Reversed</option>
122+
</select>
114123
</div>
124+
</div>
115125
</div>
116126

117127
<div ng-repeat="axis in ctrl.editor.axis" class="section gf-form-group">

0 commit comments

Comments
 (0)