Line.IsAutomaticColor
Line.IsAutomaticColor property
Indicates whether the color of line is automatic assigned.
public bool IsAutomaticColor { get; }
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Charts;
using Aspose.Cells.Drawing;
using System;
public class LinePropertyIsAutomaticColorDemo
{
public static void Run()
{
// Create a new workbook and get the first worksheet
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Add sample data for a chart
worksheet.Cells["A1"].PutValue("Category");
worksheet.Cells["A2"].PutValue("A");
worksheet.Cells["A3"].PutValue("B");
worksheet.Cells["B1"].PutValue("Value");
worksheet.Cells["B2"].PutValue(10);
worksheet.Cells["B3"].PutValue(20);
try
{
// Add a line chart
int chartIndex = worksheet.Charts.Add(ChartType.Line, 5, 0, 15, 5);
Chart chart = worksheet.Charts[chartIndex];
chart.NSeries.Add("B2:B3", true);
chart.NSeries.CategoryData = "A2:A3";
// Access the line (border) of the first series
Line seriesLine = chart.NSeries[0].Border;
// Read and display the IsAutomaticColor property value
Console.WriteLine("IsAutomaticColor value: " + seriesLine.IsAutomaticColor);
// Save the workbook
workbook.Save("IsAutomaticColorDemo.xlsx");
Console.WriteLine("Workbook saved successfully.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
See Also
- class Line
- namespace Aspose.Cells.Drawing
- assembly Aspose.Cells