Jump to content

Extension:Chart/專案

From mediawiki.org
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年10月: Working towards production deployment

Throughout September and October, the team has been working on taking the prototype that is currently deployed in the beta cluster and getting it into a production-ready state. The next major milestone we are working towards is deploying the Chart extension to testwiki and testcommons, which we are aiming to do in November. We are simultaneously working towards a security review, which is an important step for the project given security concerns were the reason the Graph extension was ultimately disabled. Following production deployment and security approval, we will begin rolling out to real wikis.

What to expect

The initial version of the Chart extension released to testwiki and testcommons in production will be fully functional, but not yet feature-complete. We've simplified the prototype to focus on the core workflows of creating and embedding charts, in addition to designing a visually accessible reading experience on mobile and desktop devices. Editors will be able to define basic line, area (stacked), bar, and pie charts on testwiki using tabular data stored on testcommons. Documentation for the extension is now available on the extension page, with a working version on beta.

Once we've deployed to production, we'll be adding more features and functionality. Notably, we want to improve the experience of working with tabular datasets and support more customization of the visual presentation of charts (e.g. customizing the colors). We will also be turning our attention towards supporting editors with migrating legacy graphs to charts.

Deployment to real wikis

Soon after deploying to the test wikis, we are planning to deploy the extension to production Commons and real wikis so that we can collect feedback about real-world use and quickly address any high priority issues. Let us know if you'd like your wiki to be one of the first to receive the new extension.

人員

常見問題

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.

如何參與