anchor.diff:  
   procedure TKMChart.Paint;
   const
  -  IntervalCount: array [0..9] of Word = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000);
  -  IntervalTime: array [0..10] of Word = (30, 1*60, 5*60, 10*60, 15*60, 30*60, 1*60*60, 2*60*60, 3*60*60, 4*60*60, 5*60*60);
  +  INTERVAL_CNT: array [0..9] of Word = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000);
  +  INTERVAL_TIME: array [0..10] of Word = (30, 1*60, 5*60, 10*60, 15*60, 30*60, 1*60*60, 2*60*60, 3*60*60, 4*60*60, 5*60*60);
   
   var
     G: TKMRect;
  
positive.code:   const
      MARKS_FONT: TKMFont = fntGrey;
    var
      I, J, S, CheckSize, XPos, YPos, Height: Integer;
      TitleDetailedH: Integer;
      NewColor: TColor4;
    begin
      CheckSize := gRes.Fonts[MARKS_FONT].GetTextSize('v').Y + 1;
      S := 0;
      XPos := G.Right + 10;
      YPos := G.Top + 8 + 20*Byte(fLegendCaption <> '');
  
      TitleDetailedH := 0;
      //Charts and legend
      for I := 0 to fCount - 1 do
      begin
        NewColor := GetLineColor(fLines[I].Color);
  
        if (csOver in State) and (I = fLineOver) then
          NewColor := clChartHighlight;
  
        //Charts
        if fLines[I].Visible then
        begin
          TKMRenderUI.WritePlot(G.Left, G.Top, G.Right-G.Left, G.Bottom-G.Top, fLines[I].Values, topValue, NewColor, 2);
          if Length(fLines[I].ValuesAlt) > 0 then
            TKMRenderUI.WritePlot(G.Left, G.Top, G.Right-G.Left, G.Bottom-G.Top, fLines[I].ValuesAlt, topValue, NewColor, 1);
        end;
  
        if SeparatorPos[S] = I then
        begin
          Inc(YPos, fSeparatorHeight);
          Inc(S);
        end;
  
        //Checkboxes
        TKMRenderUI.WriteBevel(XPos, YPos, CheckSize - 4, CheckSize - 4, 1, 0.3);
        TKMRenderUI.WriteOutline(XPos, YPos, CheckSize - 4, CheckSize - 4, 1, clChkboxOutline);
        if fLines[I].Visible then
          TKMRenderUI.WriteText(XPos + (CheckSize-4) div 2, YPos - 1, 0, 'v', MARKS_FONT, taCenter, NewColor);
  
        //Legend
        TKMRenderUI.WriteText(XPos + CheckSize, YPos, 0, fLines[I].Title, fntGame, taLeft, NewColor);
        Inc(YPos, fItemHeight);
  
        //Detailed legend
        for J := Low(fLines[I].TitleDetailed) to High(fLines[I].TitleDetailed) do
        begin
          TKMRenderUI.WriteText(XPos + CheckSize + 5, YPos, 0, fLines[I].TitleDetailed[J], fntGrey, taLeft, GetLineColor(fLines[I].TitleDetailedColor[J]));
          Inc(YPos, fItemHeight);
          Inc(TitleDetailedH, fItemHeight);
        end;
      end;
  
      //Legend title and outline
      Height := fItemHeight*fCount + TitleDetailedH + 6 + 20*Byte(fLegendCaption <> '') + fSeparatorPositions.Count*fSeparatorHeight;
      TKMRenderUI.WriteShape(G.Right + 5, G.Top, fLegendWidth, Height, icDarkestGrayTrans);
      TKMRenderUI.WriteOutline(G.Right + 5, G.Top, fLegendWidth, Height, 1, icGray);
      if fLegendCaption <> '' then
        TKMRenderUI.WriteText(G.Right + 5, G.Top + 4, fLegendWidth, fLegendCaption, fntMetal, taCenter, icWhite);
    end;
  
negative.code: 
    //Find first interval that will have less than 10 ticks
    best := 0;
    for I := Low(INTERVAL_CNT) to High(INTERVAL_CNT) do
      if topValue div INTERVAL_CNT[I] < 10 then
      begin
        best := INTERVAL_CNT[I];
        Break;
      end;
  
  