DropBars.Border
DropBars.Border property
Gets the border Line.
public Line Border { get; }
Examples
namespace AsposeCellsExamples
{
using Aspose.Cells;
using Aspose.Cells.Charts;
using Aspose.Cells.Drawing;
using System;
using System.Drawing;
public class DropBarsPropertyBorderDemo
{
public static void Run()
{
// Create a new workbook
Workbook workbook = new Workbook();
Worksheet worksheet = workbook.Worksheets[0];
// Add sample data for the chart
worksheet.Cells["A1"].PutValue(50);
worksheet.Cells["A2"].PutValue(100);
worksheet.Cells["A3"].PutValue(150);
worksheet.Cells["B1"].PutValue(60);
worksheet.Cells["B2"].PutValue(32);
worksheet.Cells["B3"].PutValue(50);
// Add a line chart
int chartIndex = worksheet.Charts.Add(ChartType.Line, 5, 0, 15, 5);
Chart chart = worksheet.Charts[chartIndex];
// Add data series to the chart
chart.NSeries.Add("A1:B3", true);
// Enable up/down bars
chart.NSeries[0].HasUpDownBars = true;
try
{
// Access the DropBars objects
DropBars upBars = chart.NSeries[0].UpBars;
DropBars downBars = chart.NSeries[0].DownBars;
// Display current border properties (read-only access)
Console.WriteLine("Up Bars Border Color: " + upBars.Border.Color);
Console.WriteLine("Up Bars Border Style: " + upBars.Border.Style);
Console.WriteLine("Up Bars Border Weight: " + upBars.Border.WeightPt);
Console.WriteLine("Up Bars Border Visibility: " + upBars.Border.IsVisible);
Console.WriteLine("\nDown Bars Border Color: " + downBars.Border.Color);
Console.WriteLine("Down Bars Border Style: " + downBars.Border.Style);
Console.WriteLine("Down Bars Border Weight: " + downBars.Border.WeightPt);
Console.WriteLine("Down Bars Border Visibility: " + downBars.Border.IsVisible);
// Modify border properties (since Line is not read-only)
upBars.Border.Color = Color.Blue;
upBars.Border.Style = LineType.Solid;
upBars.Border.WeightPt = 2.0;
upBars.Border.IsVisible = true;
downBars.Border.Color = Color.Red;
downBars.Border.Style = LineType.Dash;
downBars.Border.WeightPt = 1.5;
downBars.Border.IsVisible = true;
// Save the workbook
workbook.Save("DropBarsBorderDemo.xlsx");
Console.WriteLine("\nBorder properties have been demonstrated and saved to file.");
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}
}
See Also
- class Line
- class DropBars
- namespace Aspose.Cells.Charts
- assembly Aspose.Cells