Changeset 4554843 in OpenWorkouts-current for ow


Ignore:
Timestamp:
Dec 18, 2018, 10:22:36 AM (5 years ago)
Author:
borja <borja@…>
Branches:
current, feature/docs, master
Children:
74b9c4d
Parents:
e8e633f
Message:

Put back leaflet-elevation into the workout details template.

The work on our custom leaflet openworkouts charts module is still WIP,
so better have only the leaflet-elevation chart there (that works) for
now.

Location:
ow
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ow/static/js/ow.js

    re8e633f r4554843  
    7777    };
    7878
    79 
    80     var add_ow_charts = function add_ow_charts() {
    81         /*
    82            Add the analysis charts to the map (elevation, heartrate, cadence, etc)
    83            This has to be called *after* create_map and *before* load_gpx.
    84         */
    85         ow_charts = L.control.ow({
    86             position: "topright",
    87             theme: "ow-analysis", //default: lime-theme
    88             width: 600,
    89             height: 125,
    90             margins: {
    91                 top: 10,
    92                 right: 20,
    93                 bottom: 30,
    94                 left: 50
    95             },
    96             useHeightIndicator: true, //if false a marker is drawn at map position
    97             interpolation: "linear", //see https://github.com/mbostock/d3/wiki/SVG-Shapes#wiki-area_interpolate
    98             hoverNumber: {
    99                 decimalsX: 3, //decimals on distance (always in km)
    100                 decimalsY: 0, //deciamls on height (always in m)
    101                 formatter: undefined //custom formatter function may be injected
    102             },
    103             xTicks: undefined, //number of ticks in x axis, calculated by default according to width
    104             yTicks: undefined, //number of ticks on y axis, calculated by default according to height
    105             collapsed: false    //collapsed mode, show chart on click or mouseover
    106         });
    107 
    108         var ow_charts_container = ow_charts.addTo(map);
    109         document.getElementById('ow-analysis').appendChild(
    110             ow_charts_container._container);
    111     };
    112 
    113 
    11479    var load_gpx = function load_gpx(gpx_url) {
    11580        /*
     
    12691        });
    12792        gpx.on("addline",function(e){
    128             // elevation.addData(e.line);
    129             ow_charts.addData(e.line);
     93            elevation.addData(e.line);
     94            // ow_charts.addData(e.line);
    13095        });
    13196        gpx.addTo(map);
     
    135100        // create the map, add elevation, load gpx
    136101        create_map(latitude, longitude, zoom);
    137         // add_elevation_chart();
    138         add_ow_charts();
     102        add_elevation_chart();
     103        // add_ow_charts();
    139104        load_gpx(gpx_url);
    140105    };
  • ow/templates/workout.pt

    re8e633f r4554843  
    122122  <metal:body-js metal:fill-slot="body-js">
    123123
     124
     125    <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
    124126    <!--
    125     <script src="//d3js.org/d3.v3.min.js" charset="utf-8"></script>
    126127    <script src="${request.static_url('ow:static/d3/d3.min.js')}"
    127128            tal:condition="context.has_gpx"></script>
     
    142143    <script src="${request.static_url('ow:static/leaflet-openworkouts/leaflet.openworkouts.src.js')}"
    143144            tal:condition="context.has_gpx"></script>
     145    -->
    144146    <script src="${request.static_url('ow:static/js/ow.js')}"
    145147            tal:condition="context.has_gpx"></script>
    146     -->
    147148
    148149    <script type="text/javascript" tal:condition="context.has_gpx">
    149       var workout_map = owjs.map({
    150           latitude: ${start_point['latitude']},
    151           longitude: ${start_point['longitude']},
    152           zoom: 11,
    153           gpx_url: '${request.resource_url(context, 'gpx')}',
    154           start_icon: '${request.static_url('ow:static/leaflet-gpx/pin-icon-start.png')}',
    155           end_icon: '${request.static_url('ow:static/leaflet-gpx/pin-icon-end.png')}',
    156           shadow: '${request.static_url('ow:static/leaflet-gpx/pin-shadow.png')}',
    157       });
    158       workout_map.render()
     150     var workout_map = owjs.map({
     151         latitude: ${start_point['latitude']},
     152         longitude: ${start_point['longitude']},
     153         zoom: 11,
     154         gpx_url: '${request.resource_url(context, 'gpx')}',
     155         start_icon: '${request.static_url('ow:static/leaflet-gpx/pin-icon-start.png')}',
     156         end_icon: '${request.static_url('ow:static/leaflet-gpx/pin-icon-end.png')}',
     157         shadow: '${request.static_url('ow:static/leaflet-gpx/pin-shadow.png')}',
     158     });
     159     workout_map.render();
    159160    </script>
    160161  </metal:body-js>
Note: See TracChangeset for help on using the changeset viewer.