Back to Devexpress

ChartLineOptions.Visible Property

officefileapi-devexpress-dot-spreadsheet-dot-charts-dot-chartlineoptions.md

latest7.9 KB
Original Source

ChartLineOptions.Visible Property

Gets or sets a value indicating whether the specific lines are visible on a chart.

Namespace : DevExpress.Spreadsheet.Charts

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
bool Visible { get; set; }
vb
Property Visible As Boolean

Property Value

TypeDescription
Boolean

true , to display the lines; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to Visible
Axis

.MajorGridlines .Visible

| | Axis |

.MinorGridlines .Visible

| | ChartView |

.DropLines .Visible

| | ChartView |

.HighLowLines .Visible

| | ChartView |

.SeriesLines .Visible

| | DataLabelOptions |

.LeaderLines .Visible

|

Remarks

Use the Visible property to display or hide the major (Axis.MajorGridlines) and minor (Axis.MinorGridlines) gridlines, leader lines (DataLabelOptions.LeaderLines), drop lines (ChartView.DropLines), high-low lines (ChartView.HighLowLines), or series lines (ChartView.SeriesLines) on a chart.

Example

The example below demonstrates how to create a simple line chart and display major gridlines for the category axis and the minor gridlines for the value axis by setting the ChartLineOptions.Visible property to true.

View Example

csharp
Worksheet worksheet = workbook.Worksheets["chartTask5"];
workbook.Worksheets.ActiveWorksheet = worksheet;

// Create a chart and specify its location.
Chart chart = worksheet.Charts.Add(ChartType.Line, worksheet["B2:C8"]);
chart.TopLeftCell = worksheet.Cells["F2"];
chart.BottomRightCell = worksheet.Cells["L15"];

// Display the major gridlines of the category axis.
chart.PrimaryAxes[0].MajorGridlines.Visible = true;
// Display the minor gridlines of the value axis.
chart.PrimaryAxes[1].MinorGridlines.Visible = true;

// Hide the legend.
chart.Legend.Visible = false;
vb
Dim worksheet As Worksheet = workbook.Worksheets("chartTask5")
workbook.Worksheets.ActiveWorksheet = worksheet

' Create a chart and specify its location.
Dim chart As Chart = worksheet.Charts.Add(ChartType.Line, worksheet("B2:C8"))
chart.TopLeftCell = worksheet.Cells("F2")
chart.BottomRightCell = worksheet.Cells("L15")

' Display the major gridlines of the category axis.
chart.PrimaryAxes(0).MajorGridlines.Visible = True
' Display the minor gridlines of the value axis.
chart.PrimaryAxes(1).MinorGridlines.Visible = True

' Hide the legend.
chart.Legend.Visible = False

The following code snippets (auto-collected from DevExpress Examples) contain references to the Visible property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

wpf-spreadsheet-chart-api/CS/SpreadsheetWPFChartAPISamples/CodeExamples/TrendlineActions.cs#L54

csharp
axis.Scaling.Max = 1.0;
chart.PrimaryAxes[1].MajorGridlines.Visible = false;

winforms-spreadsheet-chart-api/CS/SpreadsheetChartAPISamples/CodeExamples/TrendlineActions.cs#L54

csharp
axis.Scaling.Max = 1.0;
chart.PrimaryAxes[1].MajorGridlines.Visible = false;

spreadsheet-document-api-chart-examples/CS/SpreadsheetDocServerChartAPISamples/CodeExamples/TrendlineActions.cs#L54

csharp
axis.Scaling.Max = 1.0;
chart.PrimaryAxes[1].MajorGridlines.Visible = false;

wpf-spreadsheet-chart-api/VB/SpreadsheetWPFChartAPISamples/CodeExamples/TrendlineActions.vb#L50

vb
axis.Scaling.Max = 1.0
chart.PrimaryAxes(1).MajorGridlines.Visible = False

winforms-spreadsheet-chart-api/VB/SpreadsheetChartAPISamples/CodeExamples/TrendlineActions.vb#L49

vb
axis.Scaling.Max = 1.0
chart.PrimaryAxes(1).MajorGridlines.Visible = False

spreadsheet-document-api-chart-examples/VB/SpreadsheetDocServerChartAPISamples/CodeExamples/TrendlineActions.vb#L55

vb
axis.Scaling.Max = 1.0
chart.PrimaryAxes(1).MajorGridlines.Visible = False

See Also

MajorGridlines

MinorGridlines

DropLines

HighLowLines

SeriesLines

LeaderLines

ChartLineOptions Interface

ChartLineOptions Members

DevExpress.Spreadsheet.Charts Namespace