<!--
 Open MCT, Copyright (c) 2014-2018, United States Government
 as represented by the Administrator of the National Aeronautics and Space
 Administration. All rights reserved.

 Open MCT is 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.

 Open MCT includes source code licensed under additional open source
 licenses. See the Open Source Licenses file (LICENSES.md) included with
 this source code distribution or the Licensing information page available
 at runtime from the About dialog for additional information.
-->
<div ng-controller="PlotOptionsController">
    <ul class="c-tree">
        <h2 title="Plot series display properties in this object">Plot Series</h2>
        <li ng-repeat="series in config.series.models">
            <div class="c-tree__item menus-to-left">
                <span class='c-disclosure-triangle is-enabled flex-elem'
                      ng-class="{ 'c-disclosure-triangle--expanded': series.expanded }"
                      ng-click="series.expanded = !series.expanded">
                </span>
                <mct-representation
                        class="rep-object-label c-tree__item__label"
                        key="'label'"
                        mct-object="series.oldObject">
                </mct-representation>
            </div>
            <ul class="grid-properties" ng-show="series.expanded">
                <li class="grid-row">
                    <div class="grid-cell label"
                         title="The field to be plotted as a value for this series.">Value</div>
                    <div class="grid-cell value">
                        {{series.get('yKey')}}
                    </div>
                </li>
                <li class="grid-row">
                    <div class="grid-cell label"
                         title="The line rendering style for this series.">Line Style</div>
                    <div class="grid-cell value">{{ {
                        'none': 'None',
                        'linear': 'Linear interpolation',
                        'stepAfter': 'Step After'
                        }[series.get('interpolate')] }}
                    </div>
                </li>
                <li class="grid-row">
                    <div class="grid-cell label"
                         title="Whether markers are displayed, and their size.">Markers</div>
                    <div class="grid-cell value">
                        {{series.get('markers') ? "Enabled: " + series.get('markerSize') + "px" : "Disabled"}}
                    </div>
                </li>
                <li class="grid-row">
                    <div class="grid-cell label"
                         title="Display markers visually denoting points in alarm.">Alarm Markers</div>
                    <div class="grid-cell value">
                        {{series.get('alarmMarkers') ? "Enabled" : "Disabled"}}
                    </div>
                </li>
                <li class="grid-row">
                    <div class="grid-cell label"
                         title="The plot line and marker color for this series.">Color</div>
                    <div class="grid-cell value">
                         <span class="c-color-swatch"
                                  ng-style="{
                                  'background': series.get('color').asHexString()
                               }">
                         </span>
                    </div>
                </li>
            </ul>
        </li><!-- end repeat -->
    </ul>
    <div class="grid-properties">
        <ul class="l-inspector-part">
            <h2 title="Y axis settings for this object">Y Axis</h2>
            <li class="grid-row">
                <div class="grid-cell label"
                     title="Manually override how the Y axis is labeled.">Label</div>
                <div class="grid-cell value">{{ config.yAxis.get('label') ? config.yAxis.get('label') : "Not defined" }}</div>
            </li>
            <li class="grid-row">
                <div class="grid-cell label"
                     title="Automatically scale the Y axis to keep all values in view.">Autoscale</div>
                <div class="grid-cell value">
                    {{ config.yAxis.get('autoscale') ? "Enabled: " : "Disabled" }}
                    {{ config.yAxis.get('autoscale') ? (config.yAxis.get('autoscalePadding')) : ""}}
                </div>
            </li>
            <li class="grid-row" ng-if="!form.yAxis.autoscale">
                <div class="grid-cell label"
                     title="Minimum Y axis value.">Minimum value</div>
                <div class="grid-cell value">{{ config.yAxis.get('range').min }}</div>
            </li>
            <li class="grid-row" ng-if="!form.yAxis.autoscale">
                <div class="grid-cell label"
                     title="Maximum Y axis value.">Maximum value</div>
                <div class="grid-cell value">{{ config.yAxis.get('range').max }}</div>
            </li>
        </ul>
        <ul class="l-inspector-part">
            <h2 title="Legend settings for this object">Legend</h2>
            <li class="grid-row">
                <div class="grid-cell label"
                     title="The position of the legend relative to the plot display area.">Position</div>
                <div class="grid-cell value capitalize">{{ config.legend.get('position') }}</div>
            </li>
            <li class="grid-row">
                <div class="grid-cell label"
                     title="Show the legend expanded by default">Expand by Default</div>
                <div class="grid-cell value">{{ config.legend.get('expandByDefault') ? "Yes" : "No" }}</div>
            </li>
            <li class="grid-row">
                <div class="grid-cell label"
                     title="What to display in the legend when it's collapsed.">Show when collapsed:</div>
                <div class="grid-cell value">{{
                    config.legend.get('valueToShowWhenCollapsed').replace('nearest', '')
                    }}
                </div>
            </li>
            <li class="grid-row">
                <div class="grid-cell label"
                     title="What to display in the legend when it's expanded.">Show when expanded:</div>
                <div class="grid-cell value comma-list">
                    <span ng-if="config.legend.get('showTimestampWhenExpanded')">Timestamp</span>
                    <span ng-if="config.legend.get('showValueWhenExpanded')">Value</span>
                    <span ng-if="config.legend.get('showMinimumWhenExpanded')">Min</span>
                    <span ng-if="config.legend.get('showMaximumWhenExpanded')">Max</span>
                </div>
            </li>
        </ul>
    </div>
</div>
