Chart & Visualization Issues

How to Programmatically Display Category Names in Modern Chart Labels

Tauseeq MagsiTauseeq Magsi Nov 2, 2026 869 views

Question details

The user wants to use code to configure data labels in a modern chart to display X-axis category names instead of data-point values, and is looking for a way to trigger chart reload events.

How to Programmatically Display Category Names in Modern Chart Labels
Product
Spreadsheet
Device & OS
not provided
Scenario
Customizing data labels and handling events via VBA or scripts for modern chart types (such as Treemap, Sunburst, or Waterfall).
Observed behavior
Modern charts lack a built-in programmatic method in the object model to replace default data values with category names, restricting automation.
Before you start

Determine whether you are using a standard chart (e.g., Column, Bar, or Pie) or a 'Modern Chart' (e.g., Waterfall, Sunburst, or Histogram), as their programmatic capabilities via VBA differ significantly.

Solution 1Recommended

Use Standard Charts as a Programmatic Workaround

Since Modern Charts currently restrict VBA access to data labels, use standard charts (like Clustered Column or Stacked Bar) if you must automate the display of category names.

The Excel Object Model has not yet fully exposed data label properties for Modern Charts introduced in Office 2016. Standard charts, however, offer full programmatic access to label properties.

1
Change the chart type

Right-click your existing Modern Chart, select 'Change Chart Type', and choose a standard alternative like a Clustered Column or Bar chart.

2
Access data label settings

Click on the chart series, then click the '+' icon (Chart Elements) next to the chart and check 'Data Labels'.

3
Format labels manually or via VBA

To format manually, right-click the labels, select 'Format Data Labels', and check 'Category Name'. To do it programmatically, use VBA: `ActiveChart.FullSeriesCollection(1).DataLabels.ShowCategoryName = True`.

Use Standard Charts as a Programmatic Workaround
Automation Restored: By switching to standard chart types, all VBA properties related to DataLabels become fully functional.
Free Microsoft Office alternative

Try WPS Office for Seamless Charting and Data Visualization

If you are frustrated by the programmatic limitations of modern charts in other software, consider switching to WPS Office. WPS Spreadsheet provides highly compatible standard charting tools, a familiar interface, and excellent VBA macro support, entirely for free. Visualize your data effectively without the high subscription costs.

  1. 1. Download the installer: Visit the official WPS Office website and click the free download button for your operating system.
  2. 2. Install WPS Office: Run the downloaded installer and follow the on-screen prompts to complete the installation in minutes.
  3. 3. Open your spreadsheets: Launch WPS Spreadsheet and easily open your existing .xlsx files to continue working seamlessly.
Highly compatible with Microsoft Excel (.xlsx, .xls) files and VBA macros.Rich selection of built-in chart types with deep customization options.Free, lightweight, and fast-loading spreadsheet application.Familiar UI that requires zero learning curve for Excel users.
QA img-9

Frequently Asked Questions

What are considered 'Modern Charts' in spreadsheets?

Modern Charts refer to the specific visualization types introduced in Office 2016, which include Treemap, Sunburst, Histogram, Box & Whisker, Waterfall, and Funnel charts. These rely on a newer rendering engine that has limited VBA object model support.

Can I manually show category names in Modern Chart labels?

No native toggle exists for Category Names in most Modern Chart data labels. You can manually double-click an individual data label and type the category name, but this text remains static and will not update if your source data changes.

Is it possible to trigger a chart reload event using VBA for modern charts?

VBA event handling for modern charts is highly restricted. Standard chart events like 'Calculate' or standard object model refresh methods often do not apply cleanly to Modern Charts. It is generally recommended to stick with standard charts if event-driven automation is required.