Hello,
How would I get a TSeriesChart to display the background grid as single dots where the major tickmarks of the bottom and left axes would cross? (So the background would have uniformly spaced dots which would coincide with the major ticks on the left and bottom axes.)
I have searched through this newsgroup and the web, but have not found the answer to this.
Thank you.
Jerry B.
Background grid as dots at major axes?
Re: Background grid as dots at major axes?
Hi Jerry,
If I understand correctly what you mean, I think the easiest way to do it is using SmallDots with GDI:
However, the above doesn't work for GDI+ and won't probably work as you want if you scroll or zoom in the chart. A more accurate but complex alternative would be using custom drawing techniques at OnBeforeDrawSeries event:
If I understand correctly what you mean, I think the easiest way to do it is using SmallDots with GDI:
Code: Select all
uses Series, TeCanvas;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.Canvas:=TTeeCanvas3D.Create;
Chart1.View3D:=false;
Chart1.AddSeries(TLineSeries).FillSampleValues;
Chart1.Draw;
with Chart1.Axes.Left.Grid do
begin
Style:=psDot;
SmallDots:=true;
SmallSpace:=Abs(Chart1.Axes.Bottom.Items[0].LabelPos-Chart1.Axes.Bottom.Items[1].LabelPos)-1;
end;
Chart1.Axes.Bottom.Grid.Visible:=false;
end;
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
begin
Chart1.View3D:=false;
Chart1.AddSeries(TLineSeries).FillSampleValues;
Chart1.Axes.Left.Grid.Visible:=false;
Chart1.Axes.Bottom.Grid.Visible:=false;
end;
procedure TForm1.Chart1BeforeDrawSeries(Sender: TObject);
var bIndex, lIndex, tmpX, tmpY: Integer;
begin
with Chart1.Canvas do
begin
Pen.Color:=Chart1.Axes.Left.Grid.Color;
for bIndex:=0 to Chart1.Axes.Bottom.Items.Count-1 do
begin
tmpX:=Chart1.Axes.Bottom.Items[bIndex].LabelPos;
for lIndex:=0 to Chart1.Axes.Left.Items.Count-1 do
begin
tmpY:=Chart1.Axes.Left.Items[lIndex].LabelPos;
Ellipse(tmpX-1, tmpY-1, tmpX+1, tmpY+1);
end;
end;
end;
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Background grid as dots at major axes?
That does it.
Thank you.
Jerry B.
Thank you.
Jerry B.