<!--

    Copyright © 2016-2020 The Thingsboard Authors

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<form name="theForm" ng-submit="vm.update()">
    <fieldset ng-disabled="$root.loading">
        <md-content style="height: 100%" flex layout="column">
            <section layout="column">
                <md-content class="md-padding" layout="column">
                    <md-input-container>
                        <label translate>legend.direction</label>
                        <md-select ng-model="vm.legendConfig.direction" style="min-width: 150px;">
                            <md-option ng-repeat="direction in vm.directions" ng-value="direction.value">
                                {{direction.name | translate}}
                            </md-option>
                        </md-select>
                    </md-input-container>
                    <md-input-container>
                        <label translate>legend.position</label>
                        <md-select ng-model="vm.legendConfig.position" style="min-width: 150px;">
                            <md-option ng-repeat="pos in vm.positions" ng-value="pos.value"
                                       ng-disabled="(vm.isRowDirection && (pos.value === vm.positions.left.value || pos.value === vm.positions.right.value))">
                                {{pos.name | translate}}
                            </md-option>
                        </md-select>
                    </md-input-container>
                    <md-checkbox flex aria-label="{{ 'legend.show-min' | translate }}""
                                 ng-model="vm.legendConfig.showMin">{{ 'legend.show-min' | translate }}
                    </md-checkbox>
                    <md-checkbox flex aria-label="{{ 'legend.show-max' | translate }}""
                                 ng-model="vm.legendConfig.showMax">{{ 'legend.show-max' | translate }}
                    </md-checkbox>
                    <md-checkbox flex aria-label="{{ 'legend.show-avg' | translate }}""
                                 ng-model="vm.legendConfig.showAvg">{{ 'legend.show-avg' | translate }}
                    </md-checkbox>
                    <md-checkbox flex aria-label="{{ 'legend.show-total' | translate }}""
                                 ng-model="vm.legendConfig.showTotal">{{ 'legend.show-total' | translate }}
                    </md-checkbox>
                </md-content>
            </section>
        </md-content>
    </fieldset>
</form>