Search code examples
.netstylesmschartaxes

How to style markers on .NET Chart axes


I need to indicate points on the X and Y axes of a .NET Chart(class System.Web.UI.DataVisualization.Charting.Chart) as hyphen-style markers. Right now the X and Y axes are completely plain.

Below is a picture of how I'd like to style my chart axes (screenshot taken from another charting tool): enter image description here

How can I do this?


Solution

  • I found the solution myself. The key properties here are MajorTickMark and MinorTickMark. eg.

    chartAreaObject.AxisX.MajorTickMark.Enabled = true;
    chartAreaObject.AxisX.MajorTickMark.LineColor = Color.White;