You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
931 B

  1. function speedSeries(response) {
  2. var data = response.linestring;
  3. var system = {
  4. label: 'mph',
  5. multiplier: 2.23694
  6. };
  7. if(document.getElementById('is-metric').value == true) {
  8. system.label = 'km/h';
  9. system.multiplier = 3.6;
  10. }
  11. var series = {
  12. name: "Speed",
  13. yAxis: 1,
  14. tooltip: {
  15. animation: true,
  16. pointFormatter: function(){
  17. moveMarkerToPosition(this);
  18. return '<b>'+this.y+system.label+'</b>';
  19. }
  20. },
  21. lineWidth: 1,
  22. color: '#a8a8a8',
  23. marker: {
  24. enabled: true,
  25. radius: 1,
  26. symbol: 'circle',
  27. fillColor: '#a8a8a8'
  28. },
  29. turboThreshold: 0,
  30. data: []
  31. };
  32. series.data = data.properties.map(function(d,i){
  33. return {
  34. x: new Date(d.unixtime*1000),
  35. y: ('speed' in d && d.speed >= 0 ? Math.round(d.speed * system.multiplier) : null),
  36. location: data.coordinates[i]
  37. }
  38. });
  39. return [series];
  40. }