Max: DateTime;
Max: System.DateTime;
The Max property determines a maximum value on the dates axis.
The property is available and can be saved only for the X axis. The Max property is taken into account if the conditions are satisfied:
The IChartAxis.AxisType property must be set to ChartAxisType.DateAxis.
The IChartAxis.AutoMin property must bet set to False.
Executing the example requires that the repository contains a regular report with the REGULAR_REPORT_AXISTYPE identifier. This report must contain only line chart with five series.
Add links to the Chart, Metabase, Report, Tab system assemblies.
Sub Userproc;
Var
mb: IMetaBase;
regrep: IPrxReport;
chart: IChart;
sheet: IPrxSheet;
table: ITabSheet;
objects: ITabObjects;
axis1: IChartAxis;
settings: IChartDateAxisSettings;
Begin
// Open a regular report for edit
mb := MetabaseClass.Active;
regrep := mb.ItemById("Regular_Report_AxisType").Edit As IPrxReport;
// Get chart from regular report
sheet := regrep.Activesheet;
table := sheet.Table;
objects := table.Objects;
chart := objects.Item(0).Extension As IChart;
// Get X axis
axis1 := chart.AxisX;
// Present X axis with labels as dates
axis1.AxisType := ChartAxisType.DateAxis;
// Edit dates axis
settings := axis1.DateAxisSettings;
// Cancel automatic substitution of maximum and minimum values
axis1.AutoMin := False;
axis1.AutoMax := False;
// Set minimum value of dates axis
settings.Min := DateTime.Parse("02.03.2014");
// Set maximum value of dates axis
settings.Max := DateTime.Parse("04.05.2014");
// Set displaying by months on dates axis
settings.BaseUnit := ChartDateAxisUnit.Month;
// Set the point of dates axis, in which it is crossed by the main value axis
settings.CrossAxisPositionValue := DateTime.Parse("04.04.2014");
//Set the dates axis point, with which major tick marks start
settings.MajorTickStartAt := DateTime.Parse("01.04.2014");
// Set major tick mark interval
settings.MajorTickUnitInterval := 3;
// Set minor tick mark interval
settings.MinorTickUnitInterval := 1;
// Set measurement units of major tick marks
settings.MajorTickUnit := ChartDateAxisUnit.Month;
// Set measurement units of minor tick marks
settings.MinorTickUnit := ChartDateAxisUnit.Days;
// Set aggregation method by the average of dates axis elements
settings.CategoryPointCollapse := DateCategoryPointCollapseType.Total;
// Save changes
(regrep As IMetabaseObject).Save;
End Sub UserProc;
After executing the example:
The X axis becomes the dates axis.
The minimum and maximum values of the dates axis are set.
Data on the dates axis is displayed by months.
The dates axis is intersected with the Y axis in the set point.
Major tick marks start with the set point on the dates axis.
The major tick mark interval on the dates axis is changed.
The minor tick mark interval on the dates axis is changed.
Months are used as measurement units for major tick marks on the dates axis.
Days are used as measurement units for minor tick marks on the dates axis.
The Sum aggregation method is used, and daily data is summed for the monthly frequency.
The requirements and result of the Fore.NET example execution match with those in the Fore example.
Imports Prognoz.Platform.Interop.Chart;
Imports Prognoz.Platform.Interop.Report;
Imports Prognoz.Platform.Interop.Tab;
…
Public Shared Sub Main(Params: StartParams);
Var mb: IMetaBase;
regrep: IPrxReport;
chart: IChart;
sheet: IPrxSheet;
table: ITabSheet;
objects: ITabObjects;
axis1: IChartAxis;
settings: IChartDateAxisSettings;
Begin
// Open a regular report for edit
mb := Params.Metabase;
regrep := mb.ItemById["Regular_Report_AxisType"].Edit() As IPrxReport;
// Get chart from regular report
sheet := regrep.Activesheet;
table := sheet.Table;
objects := table.Objects;
chart := objects.Item[0].Extension As IChart;
// Get X axis
axis1 := chart.AxisX;
// Present X axis with labels as dates
axis1.AxisType := ChartAxisType.catDateAxis;
// Edit dates axis
settings := axis1.DateAxisSettings;
// Cancel automatic substitution of maximum and minimum values
axis1.AutoMin := False;
axis1.AutoMax := False;
// Set minimum value of dates axis
settings.Min := DateTime.Parse("02.03.2014");
// Set maximum value of dates axis
settings.Max := DateTime.Parse("04.05.2014");
// Set displaying by months on dates axis
settings.BaseUnit := ChartDateAxisUnit.dauMonth;
// Set the dates axis point, in which it is crossed by the main value axis
settings.CrossAxisPositionValue := DateTime.Parse("04.04.2014");
//Set the dates axis point, from which major tick marks start
settings.MajorTickStartAt := DateTime.Parse("01.04.2014");
// Set major tick mark interval
settings.MajorTickUnitInterval := 3;
// Set minor tick mark interval
settings.MinorTickUnitInterval := 1;
// Set measurement units of major tick marks
settings.MajorTickUnit := ChartDateAxisUnit.dauMonth;
// Set measurement units of minor tick marks
settings.MinorTickUnit := ChartDateAxisUnit.dauDays;
// Set aggregation method by the average of dates axis elements
settings.CategoryPointCollapse := DateCategoryPointCollapseType.dcpcAverage;
// Save changes
(regrep As IMetabaseObject).Save();
End Sub;
See also: