Web forum is in read-only mode. Login as active registered customer for write access
  Forum Search   New Posts New Posts

X-Axis has extra dates

 Post Reply Post Reply
Author
Kwascha George View Drop Down
New Member
New Member
Avatar

Joined: 08 Jul 2017
Posts: 9
Post Options Post Options   Quote Kwascha George Quote  Post ReplyReply Direct Link To This Post Topic: X-Axis has extra dates
    Posted: 08 Jul 2017 at 3:15pm
My X-Axis is formatted for dates. The data from my stringlist displays correctly however I have a 12/30/1899 date on the x-axis at the first data point. How do I remove this date?

Also .... to the left of my first point the chart shows other dates without data points AND to the right of my last data point the chart shows other dates with no data points. How do I fix this issue?

I use Rangeto & RangeFrom to display the data, but scrolling shows the extra dates. I am using candlsticks.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7966
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 10 Jul 2017 at 11:55am
From your description, it would appear there was already series data with a null value inserted before you added the values with dates. Did you try to first clear the data points before adding the ones with defined dates?
Back to Top
Kwascha George View Drop Down
New Member
New Member
Avatar

Joined: 08 Jul 2017
Posts: 9
Post Options Post Options   Quote Kwascha George Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jul 2017 at 12:20am
I was able to clear the extra dates with the following commands
  AdvChartView1.Panes[0].Series[0].ClearPoints;
  AdvChartView1.Panes[0].Series[1].ClearPoints;
  AdvChartView1.Panes[0].Series[2].ClearPoints;

However, the 12/30/1899 date still displays at my first point. How do I remove this 1899 date?
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7966
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jul 2017 at 3:07pm
I have retested this here but I cannot see this.

Test code applied on a default TAdvChartView:

var
  dt: TDateTime;
  i: Integer;
begin

  dt := Now;

  AdvChartView1.BeginUpdate;

  AdvChartView1.Panes[0].Series[0].XAxis.MinorUnitTimeFormat := 'dd/mm';
  AdvChartView1.Panes[0].Series[0].XAxis.MajorUnitTimeFormat := 'dd/mm';

  AdvChartView1.Panes[0].XAxis.UnitType := utDay;
  AdvChartView1.Panes[0].Series[0].ClearPoints;

  for i := 0 to 10 do
  begin
    AdvChartView1.Panes[0].Series[0].AddSinglePoint(random(10), dt);
    dt := dt + 1;
  end;
  AdvChartView1.EndUpdate;
end;

This shows the first date as today, i.e. July, 12

What are you doing different?
Back to Top
Kwascha George View Drop Down
New Member
New Member
Avatar

Joined: 08 Jul 2017
Posts: 9
Post Options Post Options   Quote Kwascha George Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jul 2017 at 8:06pm
The documentation is very incomplete so I set many settings in the iDE. I am not starting with a default chart.

This is my code with your suggestions. The 12/30/1899 problem is still on the chart. I tried to attach a screenshot but your system will not allow me to do so.

Why do I get an undeclared identifier utDay?

procedure TFormChart.DisplayChart;
var High,Low,Open,Close : double;
    sDate               : string;
    i                   : integer;
begin
  AdvChartView1.BeginUpdate;
  AdvChartView1.Panes[0].Series[0].XAxis.MinorUnitTimeFormat:= 'dd/mm/yyyy';
  AdvChartView1.Panes[0].Series[0].XAxis.MajorUnitTimeFormat:= 'dd/mm/yyyy';
//AdvChartView1.Panes[0].XAxis.UnitType:= utDay;   //utDay is undeclared identifier
  AdvChartView1.Panes[0].Series[0].ClearPoints;
  AdvChartView1.PaneByID[0].Series[0].LegendText:=sSymbol;
  AdvChartView1.PaneByID[0].Series[1].LegendText:='TURNS';
  AdvChartView1.PaneByID[0].Series[0].ValueFormat:= '%.2f';
  AdvChartView1.EndUpdate;

  for i:=1 to (StringGridData.RowCount-1) do    //-offset) do    //skip first line 0
  begin
    sDate:= StringGridData.Cells[0,i];
    Open:= StrToFloat(StringGridData.Cells[2,i]);
    High:= StrToFloat(StringGridData.Cells[3,i]);
    Low:=  StrToFloat(StringGridData.Cells[4,i]);
    Close:=StrToFloat(StringGridData.Cells[5,i]);
    AdvChartView1.PaneByID[0].Series[0].AddMultiPoints(High,Low,Open,Close,sDate);
  end;

end;
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7966
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 12 Jul 2017 at 11:32pm
Please add the unit AdvChart to your uses list. This unit has the definition for utDay.

Back to Top
Kwascha George View Drop Down
New Member
New Member
Avatar

Joined: 08 Jul 2017
Posts: 9
Post Options Post Options   Quote Kwascha George Quote  Post ReplyReply Direct Link To This Post Posted: 13 Jul 2017 at 12:31am
utDay issue has been solved. The 12/30/1899 date remains.
My dates are oriented vertically but the 12/30/1899 date displays horizontally at my first data point.
This may be a clue.
Back to Top
Bruno Fierens View Drop Down
TMS Support
TMS Support
Avatar

Joined: 11 May 2010
Posts: 7966
Post Options Post Options   Quote Bruno Fierens Quote  Post ReplyReply Direct Link To This Post Posted: 13 Jul 2017 at 12:36am
Please isolate this issue and provide a sample source app with which we can reproduce your problem here, as we cannot see this problem here. Contact us by email and provide such sample source project and step by step instructions to allow to reproduce this.
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down