I found a solution for the case when the legend is on the Left/Right position. Legend has FirstValue property. So you can implement a kind of multiple pages legend. You can add a button and add this code for the OnClick event:
if peLineGraph.Legend.FirstValue = 0 then
begin
peLineGraph.Legend.FirstValue := peLineGraph.Legend.Items.Count;
btnShowMoreSeries.Caption := SHOW_FIRST_SERIES;
end
else begin
peLineGraph.Legend.FirstValue := 0;
btnShowMoreSeries.Caption := SHOW_NEXT_SERIES;
end;
Where peLineGraph is TChart and btnShowMoreSeries is your new button on the chart.
My code is for the case when there are only two pages in the legend. But you can also implement more pages if you need to.
Sure you don't want the btnShowMoreSeries button to show up there every time. You will need it only when the number of actual series is more than the number fit in the legend. That you can easily check in the peLineGraphAfterDraw event. You can also adjust the left position of your button there:
if btnShowMoreSeries.Visible = False then
begin
if (Sender as TChart).SeriesCount > (Sender as TChart).Legend.Items.Count then
begin
btnShowMoreSeries.Caption := SHOW_NEXT_SERIES;
btnShowMoreSeries.Visible := True;
end;
end;
btnShowMoreSeries.Left := (Sender as TChart).Legend.Left;
Initially btnShowMoreSeries.Visible can be False. And you need to set it to False every time when you generate a new chart.
I (Teechart 12 or so, should not matter) tried: DBChart1.Legend.MaxNumRows:=100;
and
DBChart1.Legend.NumRows:=100;
Unfortunately it does not change anything. I see only 16 lines. Maybe I blocked the line-increase by any other setting, but which? – Michael Meier Oct 27 '17 at 16:08