This page is a translated version of the page Extension:Chart/Project and the translation is 100% complete.

2015年至2023年間,編輯者可以使用Graph擴充功能來視覺化整個維基媒體專案的資料。數十萬篇維基百科條目含有這些Graph圖表,以此來豐富文字為主的維基內容。2023年,Graph圖表出於安全原因遭停用。這讓編輯者們感到沮喪,因為讀者無法查看他們投入時間和精力創建的圖表。

維基媒體基金會與社群成員討論了Graph的未來,本專案就是這些討論的成果。我們正在建立一個新的、安全的工具,我們稱之為Chart,作為Graph擴充功能的後繼者。Chart將處理維基百科條目上的大多數簡單資料視覺化應用。如果基金會或社群開發者打算在未來使Chart能支援更多用例,Chart的建構方式將使其更容易實現。當編輯者開始使用新工具替換舊Graph圖表時,我們就知道我們成功了。

在2024–2025年度計畫中,Chart專案被列為維基經驗3.3關鍵結果

策略

  • 受眾:我們以維基百科讀者的需求為首要考慮。我們關注的重點為資料視覺化在增強百科全書內容方面最常見的用途。這意味著條目以外的使用(例如PageViews)現在不再是優先事項。然而,儘管主要焦點將放在維基百科條目上,但Chart圖表將不限於主命名空間的頁面,並且將在非維基百科維基上提供。
  • 易於使用:我們希望讓任何編輯者都能輕鬆直觀地創建Chart圖表。以前,新增和編輯Graph圖表相當困難。編輯者必須熟悉與Vega——支援Graph圖表的底層軟體——互動。因此,編輯者大多使用包含預先定義Vega代碼的模板來創建Graph圖表。雖然模板更方便使用者使用,但無法在不同維基重複使用。這次,不同類型的Chart圖表將由工具定義,並可在所有維基中使用。編輯者將能使用熟悉的wikitext格式新增Chart圖表,而不需要有關底層軟體的技術知識。這些變更將減少對模板的依賴,還能在不影響既有Chart圖表的情況下升級底層庫。
  • 架構:Chart圖表將在維基媒體基金會伺服器上使用開源資料視覺化庫進行渲染——將代碼轉換為視覺內容,該程式庫是從定義的來源提取的資料生成的。具體來說:
    • 在我們的伺服器渲染Chart圖表將加快頁面載入速度。這還能避免我們在Graph擴充功能面臨的安全性問題。這還將使Chart圖表能夠出現在行動應用程式、匯出和其他重複使用/離線情景中。
    • 在資料視覺化方面,將使用一個開源庫產生Chart圖表。該函式庫必須滿足我們的需求,例如支援不同語言、一定程度的互動性、能自訂顏色等。
    • 起初,Chart圖表只會有一個資料來源:維基共享資源Data命名空間頁面。這將使Chart圖表之間的資料重複使用變得容易,避免將資料內嵌在wikitext中造成的混亂。我們還將設計系統以支援將來新增更多資料來源。
  • 編者支援:只有當編輯者將既有Graph代碼轉換為Chart並開始創建新圖表,專案才會成功。我們將想方設法支援編輯者透過自動和手動流程轉換既有Graph圖表。我們也將設法保留不太可能轉換為Chart的既有Graph圖表。這可能意味著將其替換為靜態圖像,或將其用例轉至其他工具。

最新進展

2024年8月:Wikimania回顾和Beta集群部署

Wikimania会议录音
  • Wikimania 总结:。感谢所有参加Wikimania会议或者在产品与技术桌前停下来讨论项目的朋友。通过与大家的交流,我们学到了很多,了解了你们之前创建的图表类型以及未来希望创建的图表类型。我们在Wikimania交流中了解到的一些主要主题已在Phabricator上总结。主要收获是要继续致力于支持最受欢迎的图表模板所启用的核心图表类型,并探索对维基数据等替代数据源的支持。我们还将研究使用Commons作为图表集中存储解决方案时遇到的一些挑战。
  • Beta集群部署
    • 您现在可以在Beta版的Commons中创建图表(示例),并将其嵌入到其他Beta维基上的页面中(示例:英文Beta维基百科德文Beta维基百科)!这让我们更接近于今年秋季在常规维基上进行部署。我们还将开发更多功能,例如支持其他图表类型和视觉自定义。请自行测试这些图表,并告知我们您遇到的任何问题!
    • 一些重要功能仍然缺失。例如,当您在Beta版Commons上编辑图表定义或数据页面,并且该图表在另一个Beta维基的页面上使用时,其外观不会自动更新。要更新图表渲染,您必须清除页面缓存或进行一次空编辑。我们将使其自动更新:T370378

人員

常見問題

What is the timeline of the project?

We want to have charts ready to use by editors by the end of September 2024. The project will run until the end of calendar year 2024 (half of the fiscal year 2024–2025).

Which library will be used to render charts?

We have decided to use Apache eCharts. However, if we experience issues with eCharts and think Vega (the library previously used for Graphs) might be better, we might switch to it later. We might also build most charts in eCharts but use a different library for certain specific chart types if it turns out to be much better than eCharts.

For details on why we chose these two libraries and prioritized eCharts, go to T368336#9971574.

What types of charts will be supported?

There will initially be a limited set of supported chart types. We will start with line charts. Their parameters should be reusable for other related chart types too, like area, bar, and pie charts. After line charts, we will move on to map-based visualizations.

For the exact list of line chart parameters, see T368478#9978405.

Where will we store chart definitions? Where do I go if I want to edit a particular chart?

Chart definitions will live on their own .chart pages on Commons, under the Data: namespace. We want to treat charts as a standalone content type, rather than just a part of an article. It will be easy to reuse the same chart across wikis, and beyond Wikimedia platforms by making them available as links. Editors who want to embed charts in an article will be able to do so with a short piece of wikitext, similar to including an image from Commons, all without needing to interact with complex templates.

We have heard comments that requiring the data come from Commons tabular data may not address some common data sourcing flows, like from MediaWiki APIs or Wikidata Query Service. While those sources are not the focus for this project, we want to ensure the extension is designed in a way that they can be supported in the future.

Example chart definition (from Commons) 
// Data:1993 Canadian federal elections.chart

{
   "version": 1,
   "type": "line",
   "width": 350,
   "height": 200,
   "xAxis": {
       "title": "",
       "type": "date"
   },
   "yAxis": {
       "title": {
           "en": "%support",
           "fr": "%soutien"
       }
   },
   "legend": {
       "en": "Party",
       "fr": "Parti"
   },
   "interpolate": "basis",
   "showSymbols": true,
   "source": "1993 Canadian federal election.tab"
}

Example invocation (in an article page):

{{#chart:format=1993 Canadian federal election.chart}}

How can volunteers add more chart types?

Once we set up the initial infrastructure to create charts, we will welcome technical volunteers to contribute more chart types. In the meantime, we encourage you to tell us what you think – which types of charts are most important to start with.

What will happen with the existing graphs?

For now, the existing graphs will remain in their current state. Some wikis have chosen to hide graphs entirely while others render a message explaining that graphs are disabled. Once it's possible to create charts that can replace graph uses, we will work with volunteers to start converting them so that readers can start to see them again.

It is unlikely that all graphs will be able to be converted to charts. For graphs that cannot be converted, it may be more beneficial to either: find an alternative tool to recreate the graph, convert the graph to a static image, or remove the graph altogether.

如何參與