method Chart.Zoom (StartDate as Date, EndDate as Date, [ChangeUnitWidth as Variant])
Sets or retrieves the magnification scale of the chart.

 TypeDescription 
   StartDate as Date A Date expression that indicates the start date.  
   EndDate as Date A Date expression that indicates the end date.  
   ChangeUnitWidth as Variant A Boolean expression that indicates whether the Zoom method may change the UnitWidth property., If missing, the ChangeUnitWidth parameter is True.  
The Zoom method zooms the chart to ensure that interval StartDate and EndDate fits the chart's area. The Zoom method may change the Label, Unit, Count and the ToolTip properties for all levels in the chart. If the ChangeUnitWidth parameter is True, the Zoom method changes the UnitWidth property as necessary. Use the LevelCount property to specify the number of levels in the chart. Use the Level property to access the level in the chart area. Use the NextDate property to compute the next date based on a given unit. Use the NonworkingDaysPattern property on hide the nonworking days. Once the user selects a new time scale unit in the overview zoom area, the control fires the OverviewZoom event.

When zooming 

The following VB sample zooms the chart to display one week:

 With G2antt1.Chart
    .Label(exThirdMonth) = ""
    .Label(exDay) = "<%d%>/<%m%>"
    .Zoom .FirstVisibleDate, .NextDate(.FirstVisibleDate, exWeek), True
End With

The following C++ sample zooms the chart to display one week:

CChart chart = m_g2antt.GetChart();
chart.SetLabel(17 /*exThirdMonth*/, "" );
chart.SetLabel(4096 /*exDay*/, "<%d%>/<%m%>" );
chart.Zoom( V2D( &chart.GetFirstVisibleDate() ), chart.GetNextDate( V2D( &chart.GetFirstVisibleDate() ), 256, COleVariant( (long)1 ) ), COleVariant( (long)TRUE ) );

The following VB.NET sample zooms the chart to display one week:

With AxG2antt1.Chart
    .Label(EXG2ANTTLib.UnitEnum.exThirdMonth) = ""
    .Label(EXG2ANTTLib.UnitEnum.exDay) = "<%d%>/<%m%>"
    .Zoom(.FirstVisibleDate, .NextDate(.FirstVisibleDate, EXG2ANTTLib.UnitEnum.exWeek), True)
End With

The following C# sample zooms the chart to display one week:

EXG2ANTTLib.Chart chart = axG2antt1.Chart;
chart.set_Label(EXG2ANTTLib.UnitEnum.exThirdMonth, "");
chart.set_Label(EXG2ANTTLib.UnitEnum.exDay, "<%d%>/<%m%>");
chart.Zoom(Convert.ToDateTime( chart.FirstVisibleDate ), chart.get_NextDate(Convert.ToDateTime(chart.FirstVisibleDate), EXG2ANTTLib.UnitEnum.exWeek, 1), true);

The following VFP sample zooms the chart to display one week:

With thisform.G2antt1.Chart
    .Label(17) = "" && exThirdMonth
    .Label(4096) = "<%d%>/<%m%>" && exDay
    .Zoom(.FirstVisibleDate, .NextDate(.FirstVisibleDate, 256), .t.) && exWeek
EndWith

 


Send comments on this topic.
1999-2017 Exontrol.COM, Software. All rights reserved.