跳到正文
Microsoft Research·· 2026-10-23精选

微软详解Flint交互图表:用语义事件连接图表、表格与对话

AI 导读

Chenglong Wang等作者介绍Flint-interactive的三条使用路径:通过MCP在对话中生成交互图表、将图表嵌入应用,以及自定义交互。用户描述选中了什么、希望怎样更新,由编译器处理渲染依赖;图表选择也能传给后续对话。本文是使用与机制讲解,不将既有版本写成今天首次发布,可靠性与成本改善未独立复测。

推荐理由

已通读署名原文并核对精确发布时间;提供可复用的交互图表方法,适合AI数据分析与应用开发。

正文 · AI 翻译
Flint Interactive flowchart | purple gradient background

概览

  • 为 AI 生成的图表带来丰富的交互能力:Flint-interactive 使智能体能够创建数据可视化,让用户通过点击、筛选、缩放、高亮和跨图表交互直接探索数据。
  • 让复杂交互更易构建:Flint-interactive 无需用户编写底层可视化代码,而是让用户和智能体使用高层语义事件与更新算子来定义行为。
  • 提高可靠性并减少开发工作量:系统使用 Flint 的编译器处理交互逻辑和视觉依赖关系,有助于避免自定义交互式可视化中常见的许多布局、渲染和调试难题。
  • 连接图表、文本、表格和应用程序:Flint-interactive 支持交互式数据故事、仪表板以及相互联动的体验,在一个视图中执行的操作可以更新另一个视图中的图表、文档、组件或应用程序状态。

AI 智能体让分析数据和生成带有数据可视化的报告变得轻松。与阅读冗长的文字相比,它们帮助用户更高效地查看规律。然而,当我们想要探索时,就会希望超越静态可视化。:我们希望与图表交互,放大查看细节、比较不同图表中的数据,甚至通过在图表中选择内容来高亮文档中的相关文字,反之亦然。这要求智能体能够创建交互式数据可视化,在传达信息的同时,让读者能够探索作者所选视角之外的内容,最好能达到精良数据新闻中交互式故事的质量。这让我们不禁思考: 

  • (作为用户)我能否直接在聊天中与图表交互,探索数据,并根据选中的内容提出后续问题?
  • (作为开发者)我能否让我为客户构建的 AI 智能体生成交互式可视化,帮助他们探索和理解自己的数据?

可以做到,但在实际应用中仍存在显著差距。即使使用能力强大的前沿模型,我们仍然面临以下问题:

  • 生成成本高。智能体很少能在一轮交互中生成完全令人满意的交互式可视化。反复进行推理、编码和调试会消耗 token 和时间。
  • 可靠性。交互式可视化本身就颇具挑战,表达能力丰富的交互式图表很容易出现布局不佳或交互失效的问题,而在尝试修复时,我们又可能引入新问题。

这些挑战有助于解释,为什么在实际使用中,持续生成高质量的交互式可视化仍然很困难。与此同时,一些可视化库的内置交互功能本身不具备足够的表达能力,无法创建定制的交互式图表。这些挑战源于缺少一种兼具丰富表达能力与高层抽象的语言来定义视觉交互。

焦点:系列活动

Research Forum | abstract background with colorful hexagons

微软研究论坛

欢迎加入我们,持续交流通用 AI 时代的研究理念。最新各期节目现已支持点播观看。

Flint-interactive(在新标签页中打开) 是一种基于 Flint 创建交互式数据可视化的语言。它让用户能够更轻松地创建仪表板、数据故事和交互式作品。Flint-interactive 的强大能力来自 Flint 的编译器,它将用户交互转换为语义事件,捕捉用户所选内容背后的含义。随后,它使用高层算子响应这些事件并更新可视化,让复杂交互的创建和维护变得容易得多。这样,解决交互逻辑与视觉逻辑之间复杂依赖关系的繁重工作就交给了编译器,用户(或智能体)可以通过高层规范轻松描述表达能力丰富的交互。

Interactive Gapminder visualization showing linked brushing across two scatterplots of countries in 1952 and 2007. Each plot charts GDP per capita on the horizontal axis and life expectancy on the vertical axis, with countries colored by continent. A blue rectangular selection highlights a group of countries in the 1952 chart, and the same countries are simultaneously highlighted in the 2007 chart, demonstrating linked selection across years. A control panel on the right provides interaction options including rectangular selection, lasso selection, and x- or y-axis brushing. The figure illustrates how selecting data points in one view highlights corresponding points in another view for comparative analysis over time.
示例 1:我们可以让用户在一个可视化视图中进行刷选,并通过简单的预设交互 linked-brush,让图表高亮用户选中的所有国家分组。

使用方法

1. 在聊天中使用 Flint

按照 MCP 设置指南,通过 Flint-MCP 和 MCP Apps,直接在聊天或画布环境中使用 Flint Interactive。在最新版本中,只需告诉智能体要绘制什么图表,以及需要哪些交互;它就能在生成 Flint 图表规范的同时生成 interaction_spec,并在对话中渲染交互式图表。

graphical user interface, chart
示例 2:在聊天环境中使用 Flint-interactive,让智能体通过简单的 Flint 规范更可靠地生成交互式图表。它还允许用户选择内容,并将其作为上下文传递给后续轮次。

2. 使用 Flint 构建交互式应用

使用 Flint Interactive Canvas,在仪表板、数据故事或其他应用程序中构建交互式图表。应用可以使用事件处理函数来处理 Flint Canvas 发出的语义事件,例如筛选表格、更新另一张图表,或更改应用程序状态。要让应用中的组件控制图表如何更新,可向 Flint Canvas 发送更新算子。

Interactive Gapminder dashboard for 2007 showing a table of countries alongside a bubble chart comparing GDP per capita and life expectancy. In the table, the row for the United States is selected and highlighted, displaying GDP per person of $42,952 and life expectancy of 78.2 years. The corresponding bubble on the scatterplot is emphasized and labeled with a callout showing the same values. Countries are colored by continent, bubble size represents population, GDP per capita is shown on a logarithmic horizontal axis, and life expectancy is plotted on the vertical axis. The figure demonstrates external selection, where choosing a country in a table highlights and annotates the matching data point in the visualization.
示例 2:Flint-interactive 允许开发者定义图表与外部元素(例如表格、段落)之间的交互。在这里,用户可以点击表格来高亮图表中的点,反之亦然。

3. 创建定制交互

要创建超出 Flint 预设范围的定制交互,可使用编程 API 定义触发条件和自定义处理函数,将语义事件映射为自定义的图表更新序列。例如,处理函数可以高亮被点击的国家,并标注其名称。它结合使用 set-style 和 set-annotation,无需操作渲染器特有的图形标记。

Interactive climate visualization showing a seasonal phase portrait for five U.S. cities, with temperature (°C) on the horizontal axis and precipitation (mm/day) on the vertical axis. Seattle is selected, and its annual weather cycle is displayed as a connected path labeled by month from January through December. The path shows cool, wet conditions in winter, peaking near 6 mm/day of precipitation, and warmer, drier conditions in summer, with precipitation dropping below 1 mm/day. Colored points represent Chicago, Houston, Los Angeles, New York, and Seattle. A details panel on the right displays the selected month, January, with a temperature of 4.2°C and precipitation of 5.7 mm/day. The figure demonstrates temporal dragging and animation, where moving a city’s position along its seasonal path updates all cities to the corresponding time of year.
示例 4:智能体可以使用 Flint 的编程 API 创建定制的交互式可视化。在这个 DimpVis 示例中,用户可以沿时间路径拖动数据点,直观查看所有城市的温度和降水量如何变化。

工作原理

Flint Canvas 是一个状态机,用于跟踪画布上的用户交互并管理视觉渲染状态。Flint 将由编译器管理的视觉逻辑,与用户在语义层面指定的交互逻辑分离,从而简化交互定义:

  • 视觉逻辑:编译器自动将点击、拖动和按键等原始触发操作解析为可识别图表元素和数据的语义事件。它还将更新算子转换为渲染后的画布变化,处理命中测试和底层视觉更新。
  • 交互逻辑:用户通过将语义交互事件映射到图表更新算子来指定交互,例如设置样式以高亮数据、设置注释以标注数据点,或设置视口以平移或缩放。用户还可以利用这些语义事件更新外部表格、组件或应用程序状态。 
Figure: Flint interactive allows the agent to describe interaction logic by mapping “what semantic event is the user interacting with” to “what updates they want for the canvas surface”. The compiler takes the heavy lifting of resolving visual updates and manages the runtime, which makes interaction authoring more reliable and cost effective.
图 1:Flint interactive 允许智能体通过将“用户正在与什么语义事件交互”映射到“他们希望画布呈现哪些更新”来描述交互逻辑。编译器承担解析视觉更新的繁重工作并管理运行时,使交互编写更可靠c、更具成本效益。

这种分离意味着用户无需逆向分析渲染逻辑,也无需操作渲染器特有的图形标记,从而让交互更易定义和维护。此外,由于事件生成与视觉更新可以组合,同一模型也能将 Flint 与表格、文本、其他图表及组件连接起来,构建交互式故事和仪表板。

立即试用!

图表用户:在聊天中设置 Flint(在新标签页中打开),并让智能体创建交互式图表。在交互示例库中寻找灵感。

应用构建者:使用编程 API(在新标签页中打开)构建交互式仪表板、数据故事和联动视图。将 interaction-author 技能分享给你的编程智能体,为应用添加预设交互。

交互设计者:探索定制示例(在新标签页中打开),设计一种新交互,并将其转化为可复用的预设。在 GitHub 上提议新的预设,并分享你的原型或实现,帮助扩展 Flint 的交互表达能力。

来源:Microsoft Research · microsoft.com