anchor.diff:      GraphY25 = GraphY0 + (GraphY1 - GraphY0) / 4,
       GraphY50 = GraphY0 + (GraphY1 - GraphY0) / 2,
       GraphY75 = GraphY0 + 3*(GraphY1 - GraphY0) / 4,
  -    ScaleW = GraphW / 60,
  +    ScaleW = GraphW / Secs,
       ScaleH = GraphH / Max,
   
       setFont(DC, Small, {0,0,0}),
  
positive.code: calc_delta([], []) -> [].
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  draw(Offset, Id, DC, Panel, Paint=#paint{pens=Pens, small=Small}, Data, Active) ->
      %% This can be optimized a lot by collecting data once
      %% and draw to memory and then blit memory and only draw new entries in new memory
      %% area.  Hmm now rewritten to use ?wxGC I don't now if it is feasable.
      {Len, Max0, Hs, Info} = collect_data(Id, Data),
      {Max,_,_} = MaxDisp = calc_max(Id, Max0),
      Size = wxWindow:getClientSize(Panel),
      {X0,Y0,WS,HS, DrawBs} = draw_borders(Id, Info, DC, Size, MaxDisp, Paint),
      Last = 60*WS+X0-1,
      Start = max(61-Len, 0)*WS+X0 - Offset*WS,
      Samples = length(Hs),
      NoGraphs = try tuple_size(hd(Hs)) catch _:_ -> 0 end,
      case Active andalso Samples > 1 andalso NoGraphs > 0 of
  
negative.code: %%%%%%%%%%
  terminate(_Event, #state{appmon=Pid}) ->
      catch Pid ! exit,
      cprof:pause(),
      ok.
  code_change(_, _, State) ->
      State.
  
  restart_fetcher(Node, #state{appmon=Old, panel=Panel, time=#ti{fetch=Freq}=Ti}=State) ->
      catch Old ! exit,
      Me = self(),
      Pid = spawn_link(Node, observer_backend, fetch_stats, [Me, 10000 div Freq]),
      wxWindow:refresh(Panel),
      cprof:start(?MODULE, '_'),
      State#state{active=true, appmon=Pid, data=reset_data(), time=Ti#ti{tick=0}}.
  
  reset_data() ->
      {0, queue:new()}.
  
  add_data(Stats, {N, Q}, #ti{fetch=Fetch, secs=Secs}) when N > Secs*Fetch div 10 ->
      {N, queue:drop(queue:in(Stats, Q))};
  add_data(Stats, {N, Q}, _) ->
      {N+1, queue:in(Stats, Q)}.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  create_menus(Parent, _) ->
      View = {"View", [#create_menu{id = ?ID_REFRESH_INTERVAL, text = "Graph Settings"}]},
      observer_wx:create_menus(Parent, [{"File", []}, View]).
  
  interval_dialog(Parent0, #ti{fetch=Fetch0, secs=Secs0}=Ti) ->
      Parent = observer_lib:get_wx_parent(Parent0),
      Dialog = wxDialog:new(Parent, ?wxID_ANY, "Load Chart Settings",
  			  [{style, ?wxDEFAULT_DIALOG_STYLE bor
  				?wxRESIZE_BORDER}]),
      {Sl1,FetchSl} = slider(Dialog, "Fetch (ms)", 10000 div Fetch0, 100, 10000),
      {Sl2, SecsSl} = slider(Dialog, "Length (min)", Secs0 div 60, 1, 10),
      TopSizer = wxBoxSizer:new(?wxVERTICAL),
      Flags = [{flag, ?wxEXPAND bor ?wxTOP bor ?wxLEFT bor ?wxRIGHT},
  	     {border, 5}, {proportion, 1}],
      wxSizer:add(TopSizer, Sl1, Flags),
      wxSizer:add(TopSizer, Sl2, Flags),
      wxSizer:add(TopSizer, wxDialog:createButtonSizer(Dialog, ?wxOK bor ?wxCANCEL), Flags),
      wxWindow:setSizerAndFit(Dialog, TopSizer),
      wxSizer:setSizeHints(TopSizer, Dialog),
      Res = case wxDialog:showModal(Dialog) of
  	      ?wxID_OK ->
  		  Fetch = 10000 div wxSlider:getValue(FetchSl),
  		  Secs = wxSlider:getValue(SecsSl) * 60,
  		  Ti#ti{fetch=Fetch, secs=Secs, disp=10*?DISP_FREQ/Fetch};
  	      ?wxID_CANCEL ->
  		  Ti
  	  end,
      wxDialog:destroy(Dialog),
      Res.
  
  slider(Parent, Str, Value, Min, Max) ->
      Sz = wxBoxSizer:new(?wxHORIZONTAL),
      Center = [{flag, ?wxALIGN_CENTER_VERTICAL}],
      wxSizer:add(Sz, wxStaticText:new(Parent, ?wxID_ANY, Str), [{proportion, 1}|Center]),
      Opt = [{style, ?wxSL_HORIZONTAL bor ?wxSL_LABELS}],
      Slider = wxSlider:new(Parent, ?wxID_ANY, Value, Min, Max, Opt),
      wxSizer:add(Sz, Slider, [{proportion, 2}|Center]),
      case Min > 1 of
  	false ->
  	    {Sz, Slider};
  	true ->
  	    CB = fun(#wx{event=Ev},_) -> step(Ev, Slider, Min) end,
  	    wxSlider:connect(Slider, scroll_thumbtrack, [{callback, CB}]),
  	    wxSlider:connect(Slider, scroll_changed, [{callback, CB}]),
  	    {Sz, Slider}
      end.
  
  step(_Ev = #wxScroll{commandInt=Value}, Slider, Min) ->
      Val = Min * round(Value / Min),
      wxSlider:setValue(Slider, Val),
      ok.
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  collect_data(runq, {N, Q}) ->
  