DisplaySelectedPoints([FitToAll: Boolean = false]);
DisplaySelectedPoints(FitToAll: Boolean);
FitToAll. Chart scale mode.
The DisplaySelectedPoints method scales the chart so that all selected points are displayed.
The method is used to work with a chart, which category axis is scaled, that is, the IChart.InteractiveMode property is set to ChartInteractiveMode.Zoom, and the IChart.ZoomMode property is set to ChartZoomMode.AxisX.
Available values of the FitToAll parameter:
True. All selected points are maximally scaled on the chart.
False. Default value for Fore. If all selected points are displayed on the chart, the chart is not rebuilt; if there are selected points beyond the visible area, the chart is scaled so that all points are displayed on the chart.
Executing the example requires a form containing the ChartBox component with the ChartBox1 identifier and the UiChart component with the UiChart1 identifier that is a data source for ChartBox1. The UiChart1 component must contain two or more series, each series must contain more than 10 points.
Sub UserProc;
Var
Chart: IChart;
Series: IChartSeries;
Serie: IChartSerie;
Begin
// Get chart
Chart := UiChart1.Chart;
// Set scale mode for category axis
Chart.InteractiveMode := ChartInteractiveMode.Zoom;
Chart.ZoomMode := ChartZoomMode.AxisX;
// Get chart series
Series := Chart.Series;
// Get the first series and select the second and fourth points
Serie := Series.Item(0);
Serie.SeriePoint(1).Selected := True;
Serie.SeriePoint(3).Selected := True;
// Get the second series and select the sixth and ninth points
Serie := Series.Item(1);
Serie.SeriePoint(5).Selected := True;
Serie.SeriePoint(8).Selected := True;
// Rebuild chart so that all selected points are displayed
Chart.AxisX.DisplaySelectedPoints(True);
End Sub UserProc;
After executing the example the second and fourth points of the first series and the sixth and the ninth points of the second series are selected on the chart. The chart is scaled so that the selected points are maximally scaled.
The requirements and result of the Fore.NET example execution match with those of the Fore example. Use Fore.NET analogs instead of Fore components.
Imports Prognoz.Platform.Interop.Chart;
…
Public Sub UserProc();
Var
Chart: IChart;
Series: IChartSeries;
Serie: IChartSerie;
Begin
// Get chart
Chart := uiChartNet1.ChartUi.Chart;
// Set scale mode for category axis
Chart.InteractiveMode := ChartInteractiveMode.ciamZoom;
Chart.ZoomMode := ChartZoomMode.czmmAxisX;
// Get chart series
Series := Chart.Series;
// Get the first series and select the second and fourth points
Serie := Series.Item[0];
Serie.SeriePoint[1].Selected := True;
Serie.SeriePoint[3].Selected := True;
// Get the second series and select the sixth and ninth points
Serie := Series.Item[1];
Serie.SeriePoint[5].Selected := True;
Serie.SeriePoint[8].Selected := True;
// Rebuilt chart so that all selected points are displayed
Chart.AxisX.DisplaySelectedPoints(True);
End Sub UserProc;
See also: