Hello,
I have modified by chartAxis.positionPercent such that the axes are located at the 0,0 data point
see below:
As you can see in the image, the axis titles are still located just below, and to the left of the axes. What I would like to do is put the axis titles at the bottom and left of the plot. Is there any way to do that? I could not seem to find an AxisTitlePos property or something along those lines.
custom axis title position
-
- Newbie
- Posts: 71
- Joined: Fri Jul 02, 2004 4:00 am
- Location: Culver City
- Contact:
-
- Newbie
- Posts: 71
- Joined: Fri Jul 02, 2004 4:00 am
- Location: Culver City
- Contact:
Hello,
One idea I stumbled across was to leave the bottomAxis and leftAxis alone, and create custom axes at the zero position of the data. I would only make the title of the left and bottom visible, and would associate the tickmarks and labels with the custom axes. That would give me the effect that I want, with the titles at the bottom and left and the axes at the zero position of the data.
This works great, except that it seems that I can only associate one series with one axis. Does that mean I have to make a second series that is a duplicate of my real data series in order to use the custom axis? I don't want the series to be drawn twice. I don't mind creating a "fake series" as long as I can tell it not to draw its data.
I have done this in a sample app by making a fake series and setting the data source to the real series. However, as soon as I make the fake series invisible, the custom axis for the fake series becomes invisible.
Any help would be appreciated.
One idea I stumbled across was to leave the bottomAxis and leftAxis alone, and create custom axes at the zero position of the data. I would only make the title of the left and bottom visible, and would associate the tickmarks and labels with the custom axes. That would give me the effect that I want, with the titles at the bottom and left and the axes at the zero position of the data.
This works great, except that it seems that I can only associate one series with one axis. Does that mean I have to make a second series that is a duplicate of my real data series in order to use the custom axis? I don't want the series to be drawn twice. I don't mind creating a "fake series" as long as I can tell it not to draw its data.
I have done this in a sample app by making a fake series and setting the data source to the real series. However, as soon as I make the fake series invisible, the custom axis for the fake series becomes invisible.
Any help would be appreciated.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi David,
An easy solution would be custom drawing on TeeChart's canvas in the OnAfterDraw event:
An easy solution would be custom drawing on TeeChart's canvas in the OnAfterDraw event:
Code: Select all
procedure TForm1.Chart1AfterDraw(Sender: TObject);
begin
With Chart1.Canvas do
begin
Font.Color:=clRed;
Font.Size:=12;
TextOut((Chart1.Width div 2) - 10,Chart1.ChartRect.Bottom+20,'Bottom title');
RotateLabel(Chart1.ChartRect.Left-40,(Chart1.Height div 2)+10,'Left title',90);
end;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 71
- Joined: Fri Jul 02, 2004 4:00 am
- Location: Culver City
- Contact:
Hi Narcis,
How do I then tell the chart frame to leave room for the title as the chart frame is figuring out its size. Currently, it sizes the chartRect to accomodate the title. If I made the title text blank on the tChartAxis, so it does not show up in the middle of the plot, will the chart leave room at the bottom.
Also, I make use of many of your title properties like the background color, shadow, alignment etc that I will have to duplicate on my own.
Is there a way to get the custom axes to work without making another series?
I did not think this would be such a rare thing? Don't most people put the axes at the zero points of the data? If so, do they all have the axis titles in the middle of the data?
How do I then tell the chart frame to leave room for the title as the chart frame is figuring out its size. Currently, it sizes the chartRect to accomodate the title. If I made the title text blank on the tChartAxis, so it does not show up in the middle of the plot, will the chart leave room at the bottom.
Also, I make use of many of your title properties like the background color, shadow, alignment etc that I will have to duplicate on my own.
Is there a way to get the custom axes to work without making another series?
I did not think this would be such a rare thing? Don't most people put the axes at the zero points of the data? If so, do they all have the axis titles in the middle of the data?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi David,
This will give you absolute control of where your custom titles are positioned.
You can set TChart's panel margins:How do I then tell the chart frame to leave room for the title as the chart frame is figuring out its size. Currently, it sizes the chartRect to accomodate the title. If I made the title text blank on the tChartAxis, so it does not show up in the middle of the plot, will the chart leave room at the bottom.
Code: Select all
Chart1.MarginLeft:=100;
Chart1.MarginBottom:100;
You can draw a color rectangle and the text over it or use an annotation tool or a rectangel tool which have those features and allow text. The only inconvenient is that the text can not be rotated.Also, I make use of many of your title properties like the background color, shadow, alignment etc that I will have to duplicate on my own.
Not for now. It is on our wish-list to implemented for future releases that a series can have more than one horizontal and vertical axis associated.Is there a way to get the custom axes to work without making another series?
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Newbie
- Posts: 71
- Joined: Fri Jul 02, 2004 4:00 am
- Location: Culver City
- Contact:
Hi Narcis,
Thanks for the detailed answer.
Do you think I can create a fake series with no data and link it to my custom axis. As long as I set the tickmarks, min max, etc. etc the same on the custom axis as my "real axis", then do you think that should work? I should be able to have my real axis on the bottom showing just the title, and my custom axis anywhere I want showing the tickmarks and labels.
Do you think that has a chance?
Thanks for the detailed answer.
Do you think I can create a fake series with no data and link it to my custom axis. As long as I set the tickmarks, min max, etc. etc the same on the custom axis as my "real axis", then do you think that should work? I should be able to have my real axis on the bottom showing just the title, and my custom axis anywhere I want showing the tickmarks and labels.
Do you think that has a chance?
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi David,
Yes, that works:
1. Create 2 series, the "real" series and one series without data.
2. Create one horizontal and one vertical custom axis.
3. Associate custom axes to the "real" series.
4. Set custom axes position where you want them to be.
5. Set default left and bottom axes title.
Yes, that works:
1. Create 2 series, the "real" series and one series without data.
2. Create one horizontal and one vertical custom axis.
3. Associate custom axes to the "real" series.
4. Set custom axes position where you want them to be.
5. Set default left and bottom axes title.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |