Progress® Telerik® Reporting R1 2020

Axes

This article is obsolete. The Chart item is now superseded by the more advanced Graph item. The Graph item is most often used for building powerful OLAP/Pivot charts.

X and Y axes are included in all chart types but the Pie chart. Typically the YAxis ChartPlotArea.YAxis displays values and the XAxis ChartPlotArea.XAxis displays categories.  For example, the YAxis ChartPlotArea.YAxis might show "items sold" or "revenue", while the XAxis ChartPlotArea.XAxis might show "Months" or "Products". The X axis can also display values. A second "Y" axis property YAxis2 ChartPlotArea.YAxis2 is provided for displaying a second scale of measurements.

XAxis, YAxis and YAxis2

Axis Elements

Each axis has:

  • Grid lines display perpendicular to the axis covering the plot area.
  • Axis line
  • Axis label
  • Axis marks along the axis line
  • Item labels below the axis line

The example below shows a sample X-axis with several appearance related properties customized.

Axis Elements

The Chart PlotArea ChartPlotArea property has sub properties XAxis ChartPlotArea.XAxis, YAxis ChartPlotArea.YAxis and YAxis2 ChartPlotArea.YAxis2. Each axis object has an Appearance StyleAxis property used to make the customizations shown above.  Some significant axis appearance related properties are:

  • The StyleAxis.LabelAppearance property includes sub properties that control the axis label Style.Visible, Style.Border, StyleLabel.Corners, LayoutStyle.Dimensions, StyleLabel.FillStyle, LayoutStyle.Position and Style.Shadow.
  • StyleAxis.MajorGridLines controls the appearance of grid lines displaying over the plot area including StyleBorder.Visible, StyleGridLine.Color, StyleGridLine.PenStyle and StyleGridLine.Width.
  • StyleAxis.TextAppearance handles the axis item label text, most notably TextProperties  controls font properties and color.

Axis properties can be set from the Properties Window of Visual Studio, in the XML configuration file, or through the API. Properties for the X and Y axis are identical except where noted.

Formatting Axis

You can modify the overall appearance of an axes by changing the ChartAxis.AutoScale and ChartXAxis.AutoShrink properties.  These properties when set to true cause the axis to expand and shrink to accommodate dynamically added and removed items. This is useful when the number of items changes on-the-fly.

Turn ChartAxis.AutoScale off if you want complete control over labeling of an axis.

Formatting Axis Labels

Axis Positioning

To display a range of values along an axis, specify for the ChartAxis a starting ChartAxis.MinValue, an ending ChartAxis.MaxValue, and a Step ChartAxis.Step. In the example above, the YAxis has a ChartAxis.MinValue of "0", a ChartAxis.MaxValue of "250" and a ChartAxis.Step of "50". The X axis is labeled explicitly by setting ChartPlotArea.XAxis properties:

  • ChartAxis.AutoScale = False
  • ChartAxis.MaxValue = 3
  • ChartAxis.MinValue = 1
  • ChartAxis.Step = 1
  • ChartAxis.Visible = True
  • ChartAxis.Items is populated with with 3 ChartAxisItem objects where the Appearance.Text property contains "Non-Smokers", "Social Smokers" and "Heavy Smokers".

You can control the size and position of the labels using the axis StyleAxis.LabelAppearance, LayoutStyle.Dimensions and LayoutStyle.Position properties.

X-Axis Properties Used in Data Binding

ChartXAxis.DataLabelsColumn: This is the name of a data source column that will supply the text that displays next to each X Axis item.

Unique YAxis and YAxis2 Properties

ChartYAxis.AxisMode: AxisMode can be Normal (the default) or Extended. Extended mode provides buffer space above the largest value for best visual formatting.

ChartYAxis.ScaleBreaks: The ScaleBreaks feature allows you to "break off" large chunks of the axis so that graphs with large amplitude are easier to read. ScaleBreaks are available for both YAxis and YAxis2 of the plot area. By default ScaleBreak.Enabled is false so scale breaks do not display. Set the maximum number of breaks using ScaleBreak.MaxCount   to set the minimum interval between data points before a break will occur.   For the lines ScaleBreak.Line   controls the shape of the line (i.e. Sinusoid,   Straight, JaggedCurve   and Curve).

In this article
Not finding the help you need?