Enum ChartMarkerType

ChartMarkerType enumeration

Represents the marker style in a line chart, scatter chart, or radar chart.

public enum ChartMarkerType

Values

NameValueDescription
Automatic0Automatic markers.
Circle1Circular markers.
Dash2Long bar markers
Diamond3Diamond-shaped markers.
Dot4Short bar markers.
None5No markers.
SquarePlus6Square markers with a plus sign.
Square7Square markers.
SquareStar8Square markers with an asterisk.
Triangle9Triangular markers.
SquareX10Square markers with an X.
Picture11Picture

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using Aspose.Cells.Charts;
    using System;
    using System.Drawing;

    public class ChartMarkerTypeDemo
    {
        public static void ChartMarkerTypeExample()
        {
            // Create a new workbook
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add sample data for the chart
            worksheet.Cells["A1"].PutValue("Category");
            worksheet.Cells["A2"].PutValue("A");
            worksheet.Cells["A3"].PutValue("B");
            worksheet.Cells["A4"].PutValue("C");

            worksheet.Cells["B1"].PutValue("Value");
            worksheet.Cells["B2"].PutValue(10);
            worksheet.Cells["B3"].PutValue(20);
            worksheet.Cells["B4"].PutValue(30);

            // Add a chart to the worksheet
            int chartIndex = worksheet.Charts.Add(ChartType.Line, 5, 0, 20, 10);
            Chart chart = worksheet.Charts[chartIndex];

            // Add the data series to the chart
            chart.NSeries.Add("B2:B4", true);
            chart.NSeries.CategoryData = "A2:A4";

            // Access the marker of the first series
            Marker marker = chart.NSeries[0].Marker;

            // Set the marker style
            marker.MarkerStyle = ChartMarkerType.Circle;

            // Set the marker size
            marker.MarkerSize = 10;

            // Set the marker foreground and background colors
            marker.ForegroundColor = Color.Red;
            marker.BackgroundColor = Color.Yellow;

            // Save the workbook
            workbook.Save("ChartMarkerTypeExample.xlsx");
            workbook.Save("ChartMarkerTypeExample.pdf");
            return;
        }
    }
}

See Also