Commit d844b8c5 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

timelinewidget...

parent 289393db
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -37,7 +37,7 @@ TIMELINEWIDGET
    options

        :title, :tab, :ticks, :series, :series_titles, :include_current, :height
        :draw_points
        :draw_points, draw_path, draw_ygrid, draw_xgrid


    handlers
+1 −0
Original line number Diff line number Diff line
@@ -345,3 +345,4 @@ ul.ui_tabs li.active a{
  background:#f4f4f4;
}

.gauge_viewport{ margin-top:30px; }
 No newline at end of file
+30 −38
Original line number Diff line number Diff line
@@ -15,9 +15,10 @@ FnordMetric.widgets._timelineWidget = function(){
      opts = _opts;
      //if(!silent){ $(opts.elem).css('opacity', 0.5); }

      if(!opts.draw_points){
        opts.draw_points = true;
      }
      if(!opts.draw_points){ opts.draw_points = true; }
      if(!opts.draw_path){ opts.draw_path = true; }
      if(!opts.draw_ygrid){ opts.draw_ygrid = true; }
      if(!opts.draw_xgrid){ opts.draw_xgrid = true; }

      drawLayout(opts);

@@ -27,13 +28,11 @@ FnordMetric.widgets._timelineWidget = function(){

      canvas = d3.select('#container-'+widget_uid)
        .append("svg:svg")
        .attr("width", width)
        .attr("height", height);
        .attr("width", width+(2*xpadding))
        .attr("height", height+30);

      canvas.selectAll("*").remove();

      //canvas = Raphael('container-'+widget_uid, width+(2*xpadding), height+30);

      for (ind in opts.series){
        series_values[opts.series[ind]] = {};
      }
@@ -98,8 +97,8 @@ FnordMetric.widgets._timelineWidget = function(){
      var _miss = [];
      
      for(sind in opts.series){
        var _last = opts.end_timestamp;
        var _delta = (_last -  opts.start_timestamp) / xticks;
        var _last = opts.start_timestamp;
        var _delta = (opts.end_timestamp - _last) / xticks;
        var _sdata = [];

        for(var n=0; n < xticks; n++){
@@ -107,7 +106,7 @@ FnordMetric.widgets._timelineWidget = function(){
          var _v = series_values[opts.series[sind]][opts.tick+"+"+_t];
          if((_v === undefined) && (_miss.indexOf(_t) == -1)){ _miss.push(_t); }
          _sdata.push(_v || 0);
          _last -= _delta;
          _last += _delta;
        }

        drawSeries(opts.series[sind], _sdata);
@@ -206,24 +205,16 @@ FnordMetric.widgets._timelineWidget = function(){

        });


        if(opts.draw_path){
          series_paths[series].push(canvas.append("svg:path")
            .attr("fill", "none")
            .attr("stroke", "steelblue")
            .attr("stroke-width", 3)
            .attr("d", path_string)
          );
        }

         

        // series_paths[series].push(
        //   canvas.path(path_string).attr({
        //     stroke: _color, 
        //     "stroke-width": 3, 
        //     "stroke-linejoin": 'round'
        //   }).toBack()
        // );

        if(opts.draw_area){
          // path_string += "L"+(width+xpadding)+","+height+" L"+xpadding+","+height+" Z";

          // series_paths[series].push(
@@ -234,6 +225,7 @@ FnordMetric.widgets._timelineWidget = function(){
          //   }).toBack()
          // );
        }
    }

    function drawLayout(opts){
      $(opts.elem).append( $('<div></div>').attr('class', 'headbar').append(
@@ -242,13 +234,13 @@ FnordMetric.widgets._timelineWidget = function(){
        )
      ).append(
        $('<div></div>').attr('class', 'button mr').append($('<span></span>').html('&rarr;')).click(
          function(){ moveRange(-1); }
          function(){ moveRange(1); }
        )
      ).append(
        $('<div></div>').attr('class', 'datepicker')
      ).append(
        $('<div></div>').attr('class', 'button ml').append($('<span></span>').html('&larr;')).click(
          function(){ moveRange(1); }
          function(){ moveRange(-1); }
        )
      ).append(
        $('<h2></h2>').html(opts.title)