{{!
  Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.

  WSO2 Inc. licenses this file to you 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.
}}
{{unit "cdmf.unit.lib.rickshaw-graph"}}

<div id="chartWrapper">
</div>
<div id="div-chart" data-websocketurl="{{websocketEndpoint}}">
    <div id="chartWrapper-battery" class="chartWrapper">
        <div id="y_axis-battery" class="custom_y_axis" style="margin-top: -20px;">Battery</div>
        <div class="legend_container-battery">
            <div id="smoother-battery" title="Smoothing"></div>
            <div id="legend-battery"></div>
        </div>
        <div id="chart-battery" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

    <div id="chartWrapper-light" class="chartWrapper">
        <div id="y_axis-light" class="custom_y_axis" style="margin-top: -20px;">Light</div>
        <div class="legend_container-light">
            <div id="smoother-light" title="Smoothing"></div>
            <div id="legend-light"></div>
        </div>
        <div id="chart-light" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

    <div id="chartWrapper-pressure" class="chartWrapper">
        <div id="y_axis-pressure" class="custom_y_axis" style="margin-top: -20px;">Pressure</div>
        <div class="legend_container-pressure">
            <div id="smoother-pressure" title="Smoothing"></div>
            <div id="legend-pressure"></div>
        </div>
        <div id="chart-pressure" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

    <div id="chartWrapper-proximity" class="chartWrapper">
        <div id="y_axis-proximity" class="custom_y_axis" style="margin-top: -20px;">Proximity</div>
        <div class="legend_container-proximity">
            <div id="smoother-proximity" title="Smoothing"></div>
            <div id="legend-proximity"></div>
        </div>
        <div id="chart-proximity" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

    <div id="chartWrapper-accelerometer" class="chartWrapper">
        <div id="y_axis-accelerometer" class="custom_y_axis" style="margin-top: -20px;">Accelerometer</div>
        <div class="legend_container-accelerometer">
            <div id="smoother-accelerometer" title="Smoothing"></div>
            <div id="legend-accelerometer"></div>
        </div>
        <div id="chart-accelerometer" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

    <div id="chartWrapper-magnetic" class="chartWrapper">
        <div id="y_axis-magnetic" class="custom_y_axis" style="margin-top: -20px;">Magnetic</div>
        <div class="legend_container-magnetic">
            <div id="smoother-magnetic" title="Smoothing"></div>
            <div id="legend-magnetic"></div>
        </div>
        <div id="chart-magnetic" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

    <div id="chartWrapper-rotation" class="chartWrapper">
        <div id="y_axis-rotation" class="custom_y_axis" style="margin-top: -20px;">Rotation</div>
        <div class="legend_container-rotation">
            <div id="smoother-rotation" title="Smoothing"></div>
            <div id="legend-rotation"></div>
        </div>
        <div id="chart-rotation" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

    <div id="chartWrapper-gyroscope" class="chartWrapper">
        <div id="y_axis-gyroscope" class="custom_y_axis" style="margin-top: -20px;">Gyroscope</div>
        <div class="legend_container-gyroscope">
            <div id="smoother-gyroscope" title="Smoothing"></div>
            <div id="legend-gyroscope"></div>
        </div>
        <div id="chart-gyroscope" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

    <div id="chartWrapper-gravity" class="chartWrapper">
        <div id="y_axis-gravity" class="custom_y_axis" style="margin-top: -20px;">Gravity</div>
        <div class="legend_container-gravity">
            <div id="smoother-gravity" title="Smoothing"></div>
            <div id="legend-gravity"></div>
        </div>
        <div id="chart-gravity" class="custom_rickshaw_graph"></div>
        <div class="custom_x_axis">Time</div>
    </div>

</div>
<a class="padding-left"
   href="{{@app.context}}/device/{{device.type}}/analytics?deviceId={{device.deviceIdentifier}}&deviceName={{device.name}}">
    <span class="fw-stack">
        <i class="fw fw-ring fw-stack-2x"></i>
        <i class="fw fw-statistics fw-stack-1x"></i>
    </span> View Device Analytics
</a>
<!-- /statistics -->
{{#zone "bottomJs"}}
    {{js "js/moment.min.js"}}
    {{js "js/socket.io.min.js"}}
    {{js "js/device-stats.js"}}
{{/zone}}