{"id":2053,"date":"2026-05-10T07:11:47","date_gmt":"2026-05-09T23:11:47","guid":{"rendered":"https:\/\/xlwings.net\/blog\/?p=2053"},"modified":"2026-03-28T05:50:17","modified_gmt":"2026-03-28T05:50:17","slug":"how-to-use-applicationchartdatapointtrack-in-the-xlwings-api-way","status":"publish","type":"post","link":"https:\/\/xlwings.net\/blog\/how-to-use-applicationchartdatapointtrack-in-the-xlwings-api-way\/","title":{"rendered":"How to use Application.ChartDataPointTrack in the xlwings API way"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">The <strong>ChartDataPointTrack<\/strong> member of the <strong>Application<\/strong> object in the Excel object model is a Boolean property that controls whether data points in charts are tracked when the underlying data changes. When this property is set to <strong>True<\/strong>, Excel automatically updates data labels and other data point-related elements to reflect changes in the source data. This is particularly useful in dynamic dashboards or reports where the chart data is frequently updated, as it ensures visual elements remain synchronized without manual intervention. In xlwings, this property can be accessed and modified through the Application object, allowing Python scripts to manage this tracking behavior programmatically.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In xlwings, the syntax for accessing and setting the <strong>ChartDataPointTrack<\/strong> property is straightforward. Since it belongs to the Application object, you reference it via the <code>xlwings.App<\/code> instance. The property is a Boolean, accepting <strong>True<\/strong> or <strong>False<\/strong> values. Here\u2019s the basic syntax:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\n\n# Connect to the active Excel instance or start a new one\napp = xw.apps.active # Or xw.App() for a new instance\n\n# Get the current value of ChartDataPointTrack\ncurrent_setting = app.api.ChartDataPointTrack\nprint(f\"Current setting: {current_setting}\")\n\n# Set ChartDataPointTrack to True to enable tracking\napp.api.ChartDataPointTrack = True\n\n# Set it to False to disable tracking\napp.api.ChartDataPointTrack = False<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">In this code, <code>app.api<\/code> provides direct access to the underlying Excel object model, allowing you to use the <strong>ChartDataPointTrack<\/strong> property as defined in Excel&#8217;s VBA documentation. There are no additional parameters for this property; it\u2019s a simple read\/write Boolean. When enabled, it affects all charts in the workbook that are linked to dynamic data sources, ensuring data points update automatically. This can be especially beneficial when combined with other xlwings features for data manipulation, such as updating cell values from Python, as changes will propagate to charts seamlessly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here\u2019s a practical example demonstrating the use of <strong>ChartDataPointTrack<\/strong> with xlwings. Suppose you have an Excel workbook with a chart that visualizes sales data, and you\u2019re updating the data from Python. By enabling <strong>ChartDataPointTrack<\/strong>, you ensure the chart\u2019s data points adjust automatically:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import xlwings as xw\nimport pandas as pd\n\n# Start or connect to Excel\napp = xw.App(visible=True) # Make Excel visible for demonstration\nwb = app.books.open('sales_report.xlsx') # Open a workbook with a chart\nsheet = wb.sheets&#91;'Data']\n\n# Enable ChartDataPointTrack for automatic updates\napp.api.ChartDataPointTrack = True\nprint(\"Chart data point tracking enabled.\")\n\n# Simulate updating the underlying data with new sales figures\nnew_data = pd.DataFrame({\n'Month': &#91;'Jan', 'Feb', 'Mar'],\n'Sales': &#91;15000, 18000, 22000]\n})\nsheet.range('A1').value = new_data # Overwrite the existing data range\n\n# The chart linked to this data range will now update its data points automatically\n# For instance, if data labels were showing, they\u2019d reflect the new Sales values\n\n# Optional: Disable tracking after updates if needed\napp.api.ChartDataPointTrack = False\nprint(\"Tracking disabled after updates.\")\n\n# Save and close\nwb.save()\napp.quit()<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The **ChartDataPointTrack** member of the **Application** object in the Excel object model is a Bool&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[],"class_list":["post-2053","post","type-post","status-publish","format-standard","hentry","category-xlwings-api-reference"],"_links":{"self":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/comments?post=2053"}],"version-history":[{"count":2,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2053\/revisions"}],"predecessor-version":[{"id":3141,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/posts\/2053\/revisions\/3141"}],"wp:attachment":[{"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/media?parent=2053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/categories?post=2053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/xlwings.net\/blog\/wp-json\/wp\/v2\/tags?post=2053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}