I use TeeChart to plot two data sets on a common axis - see Two_Graphs.jpg. The second graph uses custom axes.
When the top axis is used in one graph and the bottom axis in the other, I can merge the two graphs into a single graph. If I set the bottom axis LabelStyle to talNone, the legend is placed correctly, but the units popup does not work on the bottom axis - see Single_Graph_Correct_Legend_no_popup.jpg. If I set BottomAxis.Visible to false, the units popup is activated but the legend is misplaced - see Single_Graph_Legend_Misplaced.jpg.
Any help with this would be greatly appreciated.
Thanks and regards
Errol
Merged Axes, Legend Placement and Popup Accessibility
Merged Axes, Legend Placement and Popup Accessibility
- Attachments
-
- Two_Graphs.jpg (95.43 KiB) Viewed 7730 times
-
- Single_Graph_Correct_Legend_no_popup.jpg (97.82 KiB) Viewed 7730 times
-
- Single_Graph_Legend_misplaced.jpg (95.98 KiB) Viewed 7730 times
Re: Merged Axes, Legend Placement and Popup Accessibility
Hello,
I see no difference in the legend for all the screenshots you've posted. I assume you mean the bottom axis title.
Here the simple example I'm using to test this. Feel free to modify it to reproduce the problems:
I see no difference in the legend for all the screenshots you've posted. I assume you mean the bottom axis title.
I'm not sure to understand. In that screenshot, I see the labels in the bottom axis.
How are you showing that popup? If that depends on the axis visibility, I'd expect that behaviour.
Here the simple example I'm using to test this. Feel free to modify it to reproduce the problems:
Code: Select all
uses Series;
procedure TForm1.FormCreate(Sender: TObject);
var i: Integer;
begin
Chart1.Align:=alClient;
Chart1.View3D:=False;
Chart1.Legend.Hide;
Chart1.Color:=clWhite;
Chart1.Gradient.Visible:=False;
Chart1.Walls.Back.Color:=clWhite;
Chart1.Walls.Back.Gradient.Visible:=False;
Chart1.Axes.Top.Grid.Hide;
Chart1.Axes.Top.Title.Text:='Top axis title';
Chart1.Axes.Bottom.Title.Text:='Bottom axis title';
Chart1.OnClickAxis:=ChartClickAxis;
with Chart1.AddSeries(TLineSeries) do
begin
Color:=clBlack;
HorizAxis:=aTopAxis;
FillSampleValues(40);
for i:=0 to Count-1 do
XValue[i]:=40+i;
end;
with Chart1.AddSeries(TLineSeries) do
begin
Color:=clRed;
FillSampleValues(200);
for i:=0 to Count-1 do
XValue[i]:=50+i;
end;
//Chart1.Axes.Bottom.LabelStyle:=talNone; // With this, I see no labels at the bottom axis, but the bottom axis line is still drawn and the OnClickAxis is still fired when I click on it
//Chart1.Axes.Bottom.Visible:=False; // With this, the OnClickAxis event isn't fired. Expected behaviour
end;
procedure TForm1.ChartClickAxis(Sender:TCustomChart; Axis:TChartAxis; Button:TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
if Axis=Chart1.Axes.Bottom then
ShowMessage('Bottom axis clicked');
end;
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |
Re: Merged Axes, Legend Placement and Popup Accessibility
Hi Yeray
I am sorry my explanation was not clear. In the merged chart, there are two overlaid axes, BottomAxis and CustomAxes[5].
In both cases, BottomAxis.LabelStyle is set to talNone.
If BottomAxis.Visible is True, the chart Legend is correctly placed below the BottomAxis title, but the units popup acts on BottomAxis and does not fire because there is no data associated with BottomAxis.
If BottomAxis.Visible is False, the units popup acts on CustomAxes[5] and fires correctly.. However, in this case. the chart Legend is not placed correctly, and obscures the BottomAxis title.
As far as I can see, I need show the BottomAxis to get the legend to be placed correctly. Is it possible to either place CustomAxes[5] on top of BottomAxis so the Units Popup is triggered by CustomAxes[5], or to associate the chart Legend with CustomAxes[5]?
I look forward to your comments.
Regards
Errol
I am sorry my explanation was not clear. In the merged chart, there are two overlaid axes, BottomAxis and CustomAxes[5].
In both cases, BottomAxis.LabelStyle is set to talNone.
If BottomAxis.Visible is True, the chart Legend is correctly placed below the BottomAxis title, but the units popup acts on BottomAxis and does not fire because there is no data associated with BottomAxis.
If BottomAxis.Visible is False, the units popup acts on CustomAxes[5] and fires correctly.. However, in this case. the chart Legend is not placed correctly, and obscures the BottomAxis title.
As far as I can see, I need show the BottomAxis to get the legend to be placed correctly. Is it possible to either place CustomAxes[5] on top of BottomAxis so the Units Popup is triggered by CustomAxes[5], or to associate the chart Legend with CustomAxes[5]?
I look forward to your comments.
Regards
Errol
Re: Merged Axes, Legend Placement and Popup Accessibility
Good afternoon Yeray
I am pleased to report that I fixed the Popup problem by checking that the selected Popup had any items. If not, and if it was a dual graph, the Popup for the bottom axis of the second graph was called. It is all working fine now.
Thanks and regards
Errol
I am pleased to report that I fixed the Popup problem by checking that the selected Popup had any items. If not, and if it was a dual graph, the Popup for the bottom axis of the second graph was called. It is all working fine now.
Thanks and regards
Errol
Re: Merged Axes, Legend Placement and Popup Accessibility
Hello Errol,
I'm glad to hear that!
Best Regards,
Yeray Alonso Development & Support Steema Software Av. Montilivi 33, 17003 Girona, Catalonia (SP) | |
Please read our Bug Fixing Policy |