Changes in ow/static/js/ow.js [688fb7d:5cf5787] in OpenWorkouts-current


Ignore:
File:
1 edited

Legend:

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

    r688fb7d r5cf5787  
    3535    var gpx;
    3636    var elevation;
     37    var ow_charts;
    3738
    3839    var create_map = function create_map(latitude, longitude, zoom) {
     
    5152           This has to be called *after* create_map and *before* load_gpx.
    5253        */
    53 
    5454        elevation = L.control.elevation({
    5555            position: "bottomright",
    56             theme: "openworkouts-theme",
     56            theme: "steelblue-theme", //default: lime-theme
     57            width: 600,
     58            height: 125,
     59            margins: {
     60                top: 10,
     61                right: 20,
     62                bottom: 30,
     63                left: 50
     64            },
    5765            useHeightIndicator: true, //if false a marker is drawn at map position
    58             interpolation: d3.curveLinear,
    59             elevationDiv: "#elevation",
    60             detachedView: true,
    61             responsiveView: true,
    62             gpxOptions: {
    63                 async: true,
    64                 marker_options: {
    65                     startIconUrl: null,
    66                     endIconUrl: null,
    67                     shadowUrl: null,
    68                 },
    69                 polyline_options: {
    70                     color: '#EE4056',
    71                     opacity: 0.75,
    72                     weight: 5,
    73                     lineCap: 'round'
    74                 },
    75             },
    76         });
    77         elevation.loadGPX(map, gpx_url);
    78         // var ele_container = elevation.addTo(map);
     66            interpolation: "linear", //see https://github.com/mbostock/d3/wiki/SVG-Shapes#wiki-area_interpolate
     67            hoverNumber: {
     68                decimalsX: 3, //decimals on distance (always in km)
     69                decimalsY: 0, //deciamls on height (always in m)
     70                formatter: undefined //custom formatter function may be injected
     71            },
     72            xTicks: undefined, //number of ticks in x axis, calculated by default according to width
     73            yTicks: undefined, //number of ticks on y axis, calculated by default according to height
     74            collapsed: false    //collapsed mode, show chart on click or mouseover
     75        });
     76
     77        var ele_container = elevation.addTo(map);
     78        /* document.getElementById('ow-analysis').appendChild(
     79            ele_container._container); */
    7980    };
    8081
     
    9192                shadowUrl: shadow,
    9293            },
    93             polyline_options: {
    94                 color: '#EE4056',
    95                 opacity: 0.75,
    96                 weight: 5,
    97                 lineCap: 'round'
    98             },
    9994        });
    10095
     
    106101            gpx.on("addline",function(e){
    107102                elevation.addData(e.line);
     103                // ow_charts.addData(e.line);
    108104            });
    109105        };
     
    113109
    114110    var render = function render() {
    115         // create the map, add elevation, load gpx (only if needed, as the
    116         // elevation plugin already loads the gpx data)
     111        // create the map, add elevation, load gpx
    117112        create_map(latitude, longitude, zoom);
    118113        if (elevation) {
    119114            add_elevation_chart();
    120115        }
    121         else {
    122             load_gpx(gpx_url);
    123         }
     116        // add_ow_charts();
     117        load_gpx(gpx_url);
    124118    };
    125119
     
    154148         */
    155149        var chart = d3.select(chart_selector),
    156             margin = {top: 17, right: 0, bottom: 20, left: 0},
    157 
     150            margin = {top: 20, right: 20, bottom: 30, left: 50},
    158151            width = +chart.attr("width") - margin.left - margin.right,
    159152            height = +chart.attr("height") - margin.top - margin.bottom,
     
    218211                })
    219212                .attr("y", function (d) {
    220                     /*
    221                       Get the value for the current bar, then get the maximum
    222                       value to be displayed in the bar, which is used to
    223                       calculate the proper position of the label for this bar,
    224                       relatively to its height (1% above the bar)
    225                      */
    226                     var max = y.domain()[1];
    227                     return y(d.distance + y.domain()[1] * 0.02);
    228             })
     213                    return y(Number(d.distance) + 5);
     214                })
    229215                .text(function(d) {
    230216                    if (Number(d.distance) > 0) {
Note: See TracChangeset for help on using the changeset viewer.