Extension:Chart/ar

Category:GPL licensed extensions/ar
الدليل المرجعي لامتدادات ميدياويكي
Chart
حالة الإصدار مستقرCategory:Stable extensions/ar
تنفيذ وسم Category:Tag extensions/ar
بيان Renders charts
المؤلف/المؤلفون TODO
سياسة التوافق النسخة الرئيسية تحافظ على التوافق مع الإصدارات السابقة.
MediaWiki >= 1.44
تغييرات قاعدة البيانات لا
ترخيص رخصة جنو العمومية 3.0 أو ما بعدها
التنزيل Category:Extensions in Wikimedia version control/ar
README
  • $wgChartCliPath
  • $wgChartServiceUrl
  • $wgChartProgressiveEnhancement
تنزيلات ربع سنوية 37 (Ranked 78th)
ترجم الامتداد Chart لو كان متوفرا على translatewiki.net
المسائل المهام المفتوحة · الإبلاغ عن عطل تقني
Category:All extensions/ar

يوفر امتداد Chart قدرات تصور البيانات التفاعلية الأساسية المصممة لاستبدال امتداد Graph، وربما أيضاً امتداد EasyTimeline. هذا الامتداد قيد التطوير حاليًا لويكيميديا. انظر Extension:Chart/Project لمزيد من التفاصيل حول عملية التطوير.

This extension supports the following chart types:

  • Line chart
  • Area chart
  • Bar chart
  • Pie chart

Installation

The Chart extension requires having the JsonConfig extension installed, as well as downloading the Chart Renderer JavaScript (actually TypeScript) library.

See the README.md file in the repository for the full setup instructions.

How to use

All the charts in this example can be rendered from the same data source: Data:Chart_Example_Data.tab, a fictional dataset. Sample contents for these pages can be found in the sample directory.

To render a chart, you must define a chart definition to associate with the data source you want to render. A chart definition is a relatively simple JSON file. In the chart definition, specify the following:

  • licensethe license the chart is available under
  • versionthe chart schema version being used (currently the only version is 1)
  • typethe type of chart being rendered; currently supported are: line, area, bar, pie
  • sourcewhere to obtain the data for the chart (currently, only Tabular Data sets can be used as source data)
  • xAxis -> titlewhat to label the x-axis with
  • xAxis -> formatnone or auto (default, auto has compact notation like 2K for 2000 and thousands separators)
  • yAxis -> titlewhat to label the y-axis with
  • yAxis -> formatsee above
  • mediawikiCategorieslist of MediaWiki categories to track this chart
{
    "license": "CC0-1.0",
    "version": 1,
    "source": "Chart Example Data.tab",
    "type": "line",
    "title": {
        "en": "Example Chart Title"
    },
    "xAxis": {
        "title": {
        	"en": "Example X Axis Title"
        },
        "format": "none"
    },
    "yAxis": {
        "title": {
            "en": "Example Y Axis Title"
        },
        "format": "none"
    },
    "mediawikiCategories": [
        {
            "name": "Example category",
            "sort": "Its sortkey"
        }
    ]
}

Once a chart is defined, you can render it easily using the #chart parser function. In this case, the chart data is defined in Data:Chart_Example_Data.tab, and the chart itself is defined in Data:Example.Line.chart:

{{#chart:Example.Line.chart}}

Customization

Customization of charts is currently limited. The hope is that, after testing, discussion and evaluation, solutions for customization can be found that do not compromise accessibility, device-specific rendering, or security.

Sizing

Currently, charts occupy the entire container width where you place them.

The eventual goal is to ensure that charts can be rendered legibly no matter what device they are read on; see T376845 for more details.

Theming

Currently, charts are restricted to a single default color palette. This palette has been carefully designed with accessibility in mind. The thinking behind these color choices can be explored in T369863.

Some charts do require specific color themes, for example, to represent data relating to political parties. It remains an open question of how best to support this type of customization without compromising the ability of readers with accessibility needs (e.g., color blindness) to use them.

Internationalization

Charts can only be embedded in the wiki's content language; so, for example, the "uselang" query string (e.g. ?uselang=es) will not impact the chart.

The chart format supports defining text like title and labels in different languages, so that the same chart can be used in wikis of different languages. See this example of a chart with support for multiple languages being displayed in a Spanish-language wiki.

Known issues

Types of chart

For all charts, data is expected to be arranged in columns, with the first column representing the x-axis and the following columns representing series on the y-axis.

Line

%supportDate٠١٠٢٠٣٠٤٠٥٠٩‏/٩‏/١٩٩٣١٦‏/١٠‏/١٩٩٣ElvesEntsOrcsHobbitsTrollsExample Line Chart

Raw data


Bar

%supportDate٠١٠٢٠٣٠٤٠٥٠٩‏/٩‏/١٩٩٣١٦‏/١٠‏/١٩٩٣ElvesEntsOrcsHobbitsTrollsExample Bar Chart

Raw data


Area

%supportDate٠٢٠٤٠٦٠٨٠١٠٠٩‏/٩‏/١٩٩٣١٩‏/١٠‏/١٩٩٣ElvesEntsOrcsHobbitsTrollsExample Area Chart

Raw data


Pie

Pie charts are a special chart type, and data sources may require modification to be rendered appropriately.

When reading data, any non-number columns (e.g., the x-axis) will be discarded, and the sum of all rows will be represented on the chart.

For example, where multiple rows depict values for A, B, and C on numerous dates, e.g., January 1st and January 2nd, the pie chart segment for A will represent the sum of all A's row values across those dates.

ElvesEntsOrcsHobbitsTrollsElvesEntsOrcsHobbitsTrollsExample Pie Chart

Raw data

Finding existing charts

Charts that can be used in articles live on Wikimedia Commons and can be tracked using MediaWiki categories.

This query can be used as a proxy to find charts that others have made and contribute translations.

The set of wiki pages that use charts on any particular wiki can be found in the category whose name is defined at MediaWiki:chart-render-category وMediaWiki:Chart-error-category (Category:Pages using the Chart extension وCategory:Pages using the Chart extension with rendering errors on this wiki). Please make sure to connect your wiki categories to d:Q131382738 and d:Q131406605 to make the interwiki search easier.

Migrating from the Graph extension

Please see Category:Pages with disabled graphs for charts that need to be migrated to the Charts extension.

Technical documentation

Given the problems with ملحق: الرسوم البيانية, all the decisions regarding the new extension have been carefully considered, with the hope of building trust and confidence in its replacement.

So far, the technical decisions are documented in the code repository in the doc/adr folder.

Category:Extensions used on Wikimedia/ar#Chart/ar
Category:All extensions/ar Category:Extensions in Wikimedia version control/ar Category:Extensions used on Wikimedia/ar Category:GPL licensed extensions/ar Category:Pages using the Chart extension Category:ParserFirstCallInit extensions/ar Category:Stable extensions/ar Category:Tag extensions/ar