SharpPlot Reference > SharpPlot Properties > XCaption Property

SharpPlot.XCaption Property

Sets the X-axis caption or captions. A single caption is written below the end of the axis, spaced to allow room for labels (if any).

public string XCaption {get; set;}

Example

sp.XCaption = "Weeks (2005)";

You can control the positioning with the X-axis style to place the caption centred (below the axis) or at the right-hand end. The caption text will be split over more than one line if you include a ‘\n’ in the text, for example:

sp.XCaption = "Elapsed days\nfrom start of project";

Use the CaptionLineSpacing property to control the vertical pitch here.

Setting a pair of captions

If you pass a pair of captions separated by the tab character, they are written at the left and right-hand ends of the axis.

sp.XCaption = "Low end\tHigh end";

This is a useful technique when the Y-axis is horizontally centered.


sp.XAxisStyle = XAxisStyles.ArrowedAxis|XAxisStyles.BalancedAxis|XAxisStyles.AtEndCaption;

sp.YCaption = "Cooler\tHotter";
sp.XCaption = "Drier\tMuch\nWetter";

sp.YAxisStyle = YAxisStyles.ArrowedAxis|YAxisStyles.BalancedAxis|YAxisStyles.AtEndCaption;


See also ...

Formatting text with simple HTML tags | SharpPlot Members | SharpPlot.CaptionLineSpacing Property | SharpPlot.CaptionStyle Property | SharpPlot.SetXCaptionFont Method


Send comments on this topic
© Dyalog Ltd 2021