SettableChartGlobalizationSettings.GetOtherName

SettableChartGlobalizationSettings.GetOtherName method

Gets the name of “Other” labels for Chart.

public override string GetOtherName()

Examples

namespace AsposeCellsExamples
{
    using Aspose.Cells;
    using System;

    public class SettableChartGlobalizationSettingsMethodGetOtherNameDemo
    {
        public static void Run()
        {
            // Create a new workbook and get the first worksheet
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];

            // Add minimal data (optional, just for a complete workbook)
            worksheet.Cells["A1"].PutValue("Category");
            worksheet.Cells["A2"].PutValue("Item 1");
            worksheet.Cells["A3"].PutValue("Item 2");
            worksheet.Cells["B1"].PutValue("Value");
            worksheet.Cells["B2"].PutValue(120);
            worksheet.Cells["B3"].PutValue(250);

            try
            {
                // Instantiate the globalization settings object
                SettableChartGlobalizationSettings settings = new SettableChartGlobalizationSettings();

                // Set a custom name for the "Other" label
                settings.SetOtherName("Custom Other Label");

                // Retrieve the name using GetOtherName
                string otherName = settings.GetOtherName();

                Console.WriteLine("Other Name retrieved: " + otherName);
            }
            catch (Exception ex)
            {
                Console.WriteLine($"Error calling GetOtherName: {ex.Message}");
            }

            // Save the workbook (the settings are not directly attached to the chart in this demo)
            workbook.Save("GetOtherNameDemo.xlsx");
        }
    }
}

See Also