How to Center Scatter Plot Labels and Auto-Change Marker Colors in Excel
Question details
The user needs to center date labels between gridlines on a scatter plot used for a project timeline, and automate the chart's data-marker colors to change based on linked status values.
- Product
- Excel
- Device & OS
- not provided
- Scenario
- Creating a dynamic project timeline chart where visual elements, such as gridline label positioning and marker colors, automatically reflect the latest project statuses.
- Observed behavior
- The user requires a setup where labels align correctly between gridlines and marker colors automatically respond to status values (either manually entered or fetched via formula) when the worksheet updates.
Ensure your timeline data is organized into clear columns for Dates (X-values), Tasks (Y-values), and Statuses. If you choose to automate colors using a macro, save your file as an Excel Macro-Enabled Workbook (.xlsm).
Automate Marker Colors Using VBA Macros
Use a VBA macro triggered by worksheet activation to automatically scan status cells and apply corresponding colors to your scatter plot markers.
Excel does not natively support conditional formatting directly on chart data points. To dynamically change marker colors based on cell values, a VBA macro is the most effective approach. The macro runs in the background and updates the chart whenever the worksheet is activated.
Navigate to the Developer tab on the Excel ribbon and click 'Visual Basic' (or press ALT + F11). In the Project Explorer, double-click the worksheet containing your scatter plot.
Select 'Worksheet' from the left drop-down and 'Activate' from the right drop-down. Write a VBA script that loops through the Points collection of your chart's SeriesCollection.
Inside the loop, use a 'Select Case' statement to read the status value from your data range and assign a specific RGB color to the 'Point.MarkerBackgroundColor' and 'Point.MarkerForegroundColor' properties.
Save your file as a Macro-Enabled Workbook (.xlsm). Ensure that macro security settings allow the code to run when the workbook is opened so the colors update seamlessly.
Dynamically Link Status Values Using XLOOKUP
Use XLOOKUP to pull real-time project statuses from a separate tracking worksheet into your chart's source data.
Center Scatter Plot Labels Using Dummy Series
Since scatter plot axes default to placing labels exactly on tick marks, creating an invisible dummy series is the best way to center labels visually between gridlines.
Create and Automate Dynamic Scatter Plots in WPS Spreadsheet
WPS Spreadsheet fully supports advanced charting techniques, including complex scatter plots, dynamic array formulas like XLOOKUP, and VBA macros. You can easily center data labels and automate marker colors to build professional project timelines.
- 1. Organize Your Data: Open WPS Spreadsheet and organize your timeline data into clear X (Dates) and Y (Tasks) columns alongside a Status column.
- 2. Insert a Scatter Plot: Highlight your data, navigate to 'Insert' > 'Chart', and select the 'Scatter' chart type to generate your baseline timeline.
- 3. Apply Automations: Use the WPS Developer tab to add your Worksheet_Activate macro for automated marker colors, and save the document as a Macro-Enabled Workbook.

Frequently Asked Questions
Why aren't my scatter plot marker colors updating automatically?
If you are using a VBA macro to update marker colors, ensure that macros are enabled in your Excel or WPS Spreadsheet security settings. Additionally, verify that the workbook is saved in the .xlsm format and that the code is placed in the correct event module (such as Worksheet_Activate or Worksheet_Change).
Can I conditionally format chart marker colors without macros?
Standard conditional formatting does not apply to chart data points. To change colors without macros, you must create multiple data series (one for each status, e.g., 'Complete', 'Pending') and use IF formulas to sort your data into these distinct columns. You can then assign a static color to each series.
How does XLOOKUP help with my chart's data source?
XLOOKUP allows your chart's data table to dynamically retrieve statuses from a separate, master project-tracking worksheet. This means you do not have to manually copy and paste statuses into the chart sheet; the chart's source updates automatically when the master sheet changes.
How can I force date labels to sit perfectly between scatter plot gridlines?
Because scatter plot values map strictly to the numerical axis, labels land directly on the tick marks. To center them, you can format the horizontal axis position to 'Between tick marks' (if supported by your specific chart configuration) or use a hidden dummy data series with calculated midpoint X-values to anchor perfectly centered data labels.




