diff --git a/components/fpspreadsheet/examples/other/chart/write_chart_demo.lpr b/components/fpspreadsheet/examples/other/chart/write_chart_demo.lpr index e379bb534..8c4847d26 100644 --- a/components/fpspreadsheet/examples/other/chart/write_chart_demo.lpr +++ b/components/fpspreadsheet/examples/other/chart/write_chart_demo.lpr @@ -126,6 +126,10 @@ begin ch.YAxis.CaptionFont.Size := 12; //ch.YAxis.LabelRotation := 90; //ch.YAxis.CaptionRotation := 90; + ch.YAxis.Min := -5; + ch.yAxis.Max := 5; + ch.YAxis.AutomaticMin := false; + ch.YAxis.AutomaticMax := false; ch.YAxis.MajorGridLines.Color := scBlue; ch.YAxis.MajorGridLines.Style := clsLongDash; //clsSolid; ch.YAxis.MajorGridLines.Width := 0.5; // mm diff --git a/components/fpspreadsheet/source/common/fpschart.pas b/components/fpspreadsheet/source/common/fpschart.pas index 3180a2be3..228b1bc98 100644 --- a/components/fpspreadsheet/source/common/fpschart.pas +++ b/components/fpspreadsheet/source/common/fpschart.pas @@ -504,6 +504,8 @@ constructor TsChartAxis.Create(AChart: TsChart); begin inherited Create(AChart); + FAutomaticMin := true; + FAutomaticMax := true; FAutomaticMajorInterval := true; FAutomaticMinorSteps := true; diff --git a/components/fpspreadsheet/source/common/fpsopendocumentchart.pas b/components/fpspreadsheet/source/common/fpsopendocumentchart.pas index b77ad947c..1b8f026b6 100644 --- a/components/fpspreadsheet/source/common/fpsopendocumentchart.pas +++ b/components/fpspreadsheet/source/common/fpsopendocumentchart.pas @@ -197,6 +197,18 @@ begin if Axis.Logarithmic then chartProps := chartProps + 'chart:logarithmic="true" '; + if not Axis.AutomaticMin then + chartProps := chartProps + Format('chart:minimum="%g" ', [Axis.Min], FPointSeparatorSettings); + + if not Axis.AutomaticMax then + chartProps := chartProps + Format('chart:maximum="%g" ', [Axis.Max], FPointSeparatorSettings); + + if not Axis.AutomaticMajorInterval then + chartProps := chartProps + Format('chart:interval-major="%g" ', [Axis.MajorInterval], FPointSeparatorSettings); + + if not Axis.AutomaticMinorSteps then + chartProps := chartProps + Format('chart:interval-minor-divisor="%d" ', [Axis.MinorSteps]); + if Axis.Inverted then chartProps := chartProps + 'chart:reverse-direction="true" ';