Man Without Face
Member | Редактировать | Профиль | Сообщение | Цитировать | Сообщить модератору begin //dbChart1.Title.Text.Add('График отклонения фактического движения за смену от расчетного'); //Подсчитываю количество линий: count_product:=0; while not(qCharts.Eof) do begin inc(count_product); SetLength(mproduct,count_product); mproduct[count_product-1]:=qCharts.FieldByName('rc_smenavol_volumenum').AsInteger; qCharts.Next; end; //Строю график qChart2.Open; for i:=0 to count_product-1 do begin SetLength(mseries,dbChart1.SeriesList.Count+1); mseries[dbChart1.SeriesList.Count]:=TFastLineSeries.Create(dbChart1); mseries[dbChart1.SeriesList.Count].LinePen.Width:=2; dbChart1.AddSeries(mseries[dbChart1.SeriesList.Count]); qChart2.First(); for j := Trunc(cxdedReservFrom.Date) to Trunc(cxdedReservTo.Date) do begin while trunc(qChart2.FieldByName('rc_sd_begindate').AsDateTime) < j do qChart2.Next(); value_found := False; showmessage(DateToStr(j)); while trunc(qChart2.FieldByName('rc_sd_begindate').AsDateTime) = j do begin if qChart2.FieldByName('rc_smenavol_volumenum').AsInteger = mproduct[i] then begin if cxRadioGroup1.ItemIndex = 0 then //График фактического отклонения движения за смену от расчетного mseries[dbChart1.SeriesList.Count-1].Add(qChart2.FieldByName('otklon_fakdvforsmena').AsInteger,datetostr(trunc((qChart2.FieldByName('rc_sd_begindate').Asdatetime)))) else //График фактического остатка от нарастающего расчетного mseries[dbChart1.SeriesList.Count-1].Add(qChart2.FieldByName('otklon_fakrestfromincrease').AsInteger,datetostr(trunc((qChart2.FieldByName('rc_sd_begindate').Asdatetime)))); value_found := True; end; qChart2.Next(); end; if not value_found then mseries[dbChart1.SeriesList.Count-1].Add(0,datetostr(trunc((qChart2.FieldByName('rc_sd_begindate').Asdatetime)))); end; end; end; |