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.

36 lines
724 B

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