fpspreadsheet: Some progress with rotated axis labels in chart link.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@9086 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2023-12-15 23:38:58 +00:00
parent c085882894
commit 689b43288e
3 changed files with 20 additions and 2 deletions

View File

@@ -163,4 +163,8 @@ object Form1: TForm1
Left = 976
Top = 56
end
object ListChartSource1: TListChartSource
Left = 327
Top = 152
end
end

View File

@@ -7,7 +7,7 @@ interface
uses
Classes, SysUtils,
LCLVersion, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
TAGraph,
TAGraph, TASources,
fpSpreadsheet, fpsTypes, fpsOpenDocument,
fpSpreadsheetCtrls, fpSpreadsheetGrid, fpSpreadsheetChart;
@@ -21,6 +21,7 @@ type
Chart1: TChart;
ComboBox1: TComboBox;
Label1: TLabel;
ListChartSource1: TListChartSource;
OpenDialog1: TOpenDialog;
Panel1: TPanel;
Splitter1: TSplitter;

View File

@@ -1747,6 +1747,10 @@ begin
end;
procedure TsWorkbookChartLink.UpdateChartAxis(AWorkbookAxis: TsChartAxis);
const
ROTATED_ALIGNMENT: array[TChartAxisAlignment] of TChartAxisAlignment = (
// calLeft, calTop, calRight, calBottom
calBottom, calRight, calTop, calLeft);
var
align: TChartAxisAlignment;
axis: TChartAxis;
@@ -1767,6 +1771,10 @@ begin
align := calRight
else
raise Exception.Create('Unsupported axis alignment');
if AWorkBookAxis.Chart.RotatedAxes then
align := ROTATED_ALIGNMENT[align];
axis := FChart.AxisList.GetAxisByAlign(align);
if AWorkbookAxis.Visible and (axis = nil) then
@@ -1878,7 +1886,12 @@ begin
if FChart.SeriesCount = 0 then
exit;
axis := FChart.BottomAxis;
if AWorkbookChart.RotatedAxes then
axis := FChart.LeftAxis
else
axis := FChart.BottomAxis;
axis.Marks.SourceExchangeXY := AWorkbookChart.RotatedAxes;
case AWorkbookChart.GetChartType of
ctScatter, ctBubble:
begin