Hello,
We're having a problem in the display of labels from two series in the same chart.
Example: we create two LineSeries and we fill the values of those series giving for each value a different label. In the chart we see the two series but in the bottom axis we see only the labels from the fisrt serie.
We are using Teechart8 for Delphi6.
procedure TfmTestTeeChart.LoadData;
var
i,j : integer;
jSerie : TChartSeries;
begin
chart1.FreeAllSeries;
chart1.Title.Text.Text := 'Test labels';
//First serie
jSerie := TLineSeries.Create(chart1);
TLineSeries(jSerie).stairs := true;
chart1.AddSeries(jSerie);
jSerie.Title := 'SerieA';
jSerie.Identifier := 'A';
jSerie.AddXY(39479,109,'A1');
jSerie.AddXY(39483,155,'A2');
jSerie.AddXY(39488,184,'A3');
jSerie.AddXY(39493,111,'A4');
jSerie.AddXY(39498,58,'A5');
//Second serie
jSerie := TLineSeries.Create(chart1);
TLineSeries(jSerie).stairs := true;
chart1.AddSeries(jSerie);
jSerie.Title := 'SerieB';
jSerie.Identifier := 'B';
jSerie.AddXY(39455,125,'B1');
jSerie.AddXY(39462,800,'B2');
jSerie.AddXY(39469,140,'B3');
jSerie.AddXY(39471,108,'B4');
jSerie.AddXY(39476,116,'B5');
end;
What can we do in order to see the labels from all the series present in one chart?
Thanks for your attention,
Ana Fróis
Display of labels from two series in the same chart
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Ana,
Yes, this is by design. When series have text labels chart automatically only displays first series labels. You can solve your problem using custom axis labels as shown on the code below.
Yes, this is by design. When series have text labels chart automatically only displays first series labels. You can solve your problem using custom axis labels as shown on the code below.
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
i,j : integer;
jSerie : TChartSeries;
begin
chart1.FreeAllSeries;
chart1.Title.Text.Text := 'Test labels';
//First serie
jSerie := TLineSeries.Create(chart1);
TLineSeries(jSerie).stairs := true;
chart1.AddSeries(jSerie);
jSerie.Title := 'SerieA';
jSerie.Identifier := 'A';
jSerie.AddXY(39479,109,'A1');
jSerie.AddXY(39483,155,'A2');
jSerie.AddXY(39488,184,'A3');
jSerie.AddXY(39493,111,'A4');
jSerie.AddXY(39498,58,'A5');
//Second serie
jSerie := TLineSeries.Create(chart1);
TLineSeries(jSerie).stairs := true;
chart1.AddSeries(jSerie);
jSerie.Title := 'SerieB';
jSerie.Identifier := 'B';
jSerie.AddXY(39455,125,'B1');
jSerie.AddXY(39462,800,'B2');
jSerie.AddXY(39469,140,'B3');
jSerie.AddXY(39471,108,'B4');
jSerie.AddXY(39476,116,'B5');
Chart1.Axes.Bottom.Items.Clear;
for i:=0 to Chart1.SeriesCount -1 do
for j:=0 to Chart1[i].Count - 1 do
Chart1.Axes.Bottom.Items.Add(Chart1[i].XValue[j],Chart1[i].Labels[j]);
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 |