Page 1 of 1

Bar Chart Missing Some Bars

Posted: Tue Apr 28, 2009 11:05 pm
by 9337074
I am using TeeChart 7.12 with Delphi 2006 Studio VCL. I have a form with a DB Chart filled by a NexusDB query. The DBChart shows a bar chart series with dates along the X axis and numerical values from 0 to 5 on the Y axis. I have a tee navigator attached to the chart so that I can page through the points when they total more then 10. On some of the chart pages some of the bars do not appear even though the label for the point appears. I checked the query and the points do have data. Can you suggest what I can check to fix the problem?

Posted: Wed Apr 29, 2009 11:20 am
by yeray
Hi McMClark,

We have some similar bugs identified with TeeChart v8 (and some of them are already fixed) but I'm not sure to identify what is your exact problem.

Here is the code I used to try to reproduce it, but I couldn't. Could you please modify it in order to reproduce it? Or could you send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.

Code: Select all

uses series;

procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
    series1: TBarSeries;
begin
  ChartPageNavigator1.Chart := Chart1;

  series1 := TBarSeries.Create(self);
  Chart1.AddSeries(series1);

  for i:=0 to 25 do
    series1.Add(random*5);

  Chart1.MaxPointsPerPage := 10;
end;

Posted: Wed Apr 29, 2009 6:15 pm
by 9337074
Below are there procedures that involve assigning values to the series,
updating the points per page with the user's selection, and getting the first date from the X axis value on the DBChart page.



procedure TfrmDefaultResultGraphAndDocuments.FormShow(Sender: TObject);
begin
//This code adds a series to the dbChart based on a query attached to a datasource
ChartPageNavigator1.Chart := DBChart1;
DBChart1.MaxPointsPerPage := intPointsPerPage;
intList2 := ds1.RecordCount;
with tmpDefaultSeries do
begin
DataSource := ds1;
YValues.ValueSource := strYSource;
XLabelsSource := strXSource;
XValues.ValueSource := strXSource;
try
XValues.DateTime := True;
except
end;
Title := strSubModel + ' ' + strSeriesName;
tmpDefaultSeries.ColorEachPoint := False;
tmpDefaultSeries.Marks.Visible := True;
tmpDefaultSeries.Marks.Style := smsValue;
DBChart1.Draw;
end;
end;

procedure TfrmDefaultResultGraphAndDocuments.UpdatePointsPerPage(var DBChart1: TDBChart; blRestrictPoints: Boolean; var intMaxPointsPerPage2: integer; intDefaultMaxPointPerPage: Integer);
begin
//This code updates the points per dbChart page based on the user selection

if blRestrictPoints then
begin
if intMaxPointsPerPage2 = 0 then
begin
intMaxPointsPerPage2 := intDefaultMaxPointPerPage;
end;
DBChart1.MaxPointsPerPage := intMaxPointsPerPage2;
end
else
begin
intMaxPointsPerPage2 := 0;
DBChart1.MaxPointsPerPage := intMaxPointsPerPage2;
end;
end;


procedure TfrmDefaultResultGraphAndDocuments.ChartPageNavigator1ButtonClicked(
Index: TTeeNavigateBtn);
var
strXVar: String;
dbXVar: Double;
Sender2: TChartSeries;
intPage: integer;
dtAnalysisDate1: TDate;
intPointsPerPage: integer;
begin

//This code gets the first date on the page to use to synch up information about that //date
DBChart1.Axes.Reset;
try
Sender2 := DBChart1.Series[0];
intPage := DBChart1.Page;
intPointsPerPage := DBChart1.MaxPointsPerPage;

if intPage = 1 then
begin
strXVar := Sender2.XValueToText(Sender2.XValue[0])
end
else
begin
strXVar := Sender2.XValueToText(Sender2.XValue[((intPage -1) * intPointsPerPage)]);
end;

try
dtAnalysisDate1 := strToDate(strXVar);
except
end;


except
end;
end;

Posted: Thu Apr 30, 2009 9:35 am
by yeray
Hi McMClark,

There are many things I cannot use only with this code (datasource, UpdatePointsPerPage). Here is how I simplified it in order to be runnable as-is:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
  Series1.FillSampleValues(100);
  ChartPageNavigator1.Chart := Chart1;
  Chart1.MaxPointsPerPage := 5;

  with Series1 do
  begin
    ColorEachPoint := False;
    Marks.Visible := True;
    Marks.Style := smsValue;
    XValues.DateTime := True;
  end;

  Chart1.Draw;
end;

procedure TForm1.ChartPageNavigator1ButtonClicked(Index: TTeeNavigateBtn);
var
  strXVar: String;
  Sender2: TChartSeries;
  intPage: integer;
  intPointsPerPage: integer;
begin

  //This code gets the first date on the page to use to synch up information about that //date
  Chart1.Axes.Reset;
  try
    Sender2 := Chart1.Series[0];
    intPage := Chart1.Page;
    intPointsPerPage := Chart1.MaxPointsPerPage;

    if intPage = 1 then
      strXVar := Sender2.XValueToText(Sender2.XValue[0])
    else
      strXVar := Sender2.XValueToText(Sender2.XValue[((intPage -1) * intPointsPerPage)]);
  except
  end;

  Caption:= strXVar;
end;
But I'm afraid that with this I still can't reproduce the issue. Please, try to modify it until the problem will be reproducible as-is or send us a simple example project we can run as-is here.

Posted: Tue Jun 02, 2009 7:37 pm
by 9337074
Thank you for the reply. I am still working on producing a reproducible example of the error. But I wanted to let you know that the missing bars reappear when I turn off the 3D display. If I toggle the 3D button on the tee commander, the appears and disappears.