[go: up one dir, main page]

Page MenuHomePhabricator

Define initial chart type and parameters
Closed, ResolvedPublic2 Estimated Story Points

Description

Eventually, we'll want to support many chart types, but for our initial implementation we're starting with just one, and then building the others slightly later. We need to decide which chart type is going to be the first one we build, and define which parameters it takes (at least at first; we can add more parameters later).

  • Define an initial chart type
  • Define the initial parameters for this chart type

Event Timeline

Catrope added a subscriber: CCiufo-WMF.

@CCiufo-WMF will make a short list and a recommendation based on his research into what the old Graph extension and the related templates are used for.

LGoto triaged this task as Medium priority.Jul 1 2024, 5:54 PM
LGoto set the point value for this task to 2.
LGoto moved this task from Backlog to Up Next on the Charts board.

We were able to pull some data about how graph-related templates and modules were used across the Wikipedias in the main namespace (article pages). Templates or Modules that shared the same name were consolidated across projects. Here's the list, filtered to only include those that had usage greater than 50 and presence on more than 2 wikis:

Template / ModuleUses across all wikisNumber of wikis
Graph:Chart1084693
Graph:Street map with marks183653
Graph:Lines4596847
Graph:Map14429
Statistical22906023
Map with marks31812
WikidataChart376211
Graph:Population history31811
Wikidata.table38637210
PageViews graph8010
Graph:Weather monthly history7099
Graph:Lines/core13876
Gráfico9084
SkyMap68823

On the whole, nothing was too surprising. If I'm understanding everything correctly, Module:Graph is used to power most of these in some way. The primary uses were to create some variant of a line, area, bar, or pie chart with one or multiple series OR a map visualization with highlighted areas or markers. Some of the more specific use cases can still be accomplished with templates built on top of the core set of initial chart types. Of course, they could also be added as their own chart type later if the use case is wide enough to be shared across wikis.

I still need to look into the Wikidata templates and I'd really like to know how often Commons tabular data and SPARQL queries were actually used as data sources.

I think it makes sense to start with Line charts, but sketch out the parameters and syntax for related charts (area, bar, pie, etc) at the same time to make sure they don't diverge too much. I'll start working on defining the parameters next. After that, I think we should move on to map-based visualizations, because those are quite different from the typical "charts" and might require a different approach.

Looking at Module:Graph and the eCharts examples, I think we should start with these parameters for the Line chart prototype:

  • Chart title
  • One or more data series with optional series names
  • Optional chart height and width (auto if left blank)
  • Optional x and y axis names
  • Optional x and y axis min and max values (auto if left blank)
  • Show/hide legend (eCharts supports only showing some series in the legend, but let's allow legends with either all series names or no legend at all)
  • Show/hide value labels (eCharts supports setting this option per-series, but let's allow this to be either set for the whole chart or not at all)
  • Stacking yes/no (eCharts supports multiple stack groups per chart, but let's just allow all series to either be part of the same stack, or not stacked at all)

These should all be reusable for other chart types too. At first, let's just use whatever eCharts defaults to for colors and line style. Of course, there's much more customization we could add to these charts but let's keep it simple for the prototype. We also want to avoid making the configuration too eCharts-specific. Some of the details, like the actual param names and how to define a series, depends on T368350 and will evolve during development. We might also need params that specify the x and y axis data types, if that cannot already be determined from the data.

Template:Graph:Chart (eg. on English wikipedia) would be better place to look for users preference of charts parameters.

  • For users it's very important to be able define their own colors.
  • It would be great to have step line graph. It's good replacement for bar chart for large amount of data points. It seems to be very easy to implement in eChart.
  • It would be great if charts would use local Wikipedia language. This was especially annoying for date formatting with Vega.

Significant amount of charts created with module Module:Graph and Template:Graph:Chart were bar charts. Parameters for a start would be same as for line.
Mixed line/bar chart would be great to have but we can leave it to later.
Definition of bar chart and mixed charts seems to be much easier in eChart than in Vega.

Template:Graph:Chart (eg. on English wikipedia) would be better place to look for users preference of charts parameters.

  • For users it's very important to be able define their own colors.
  • It would be great to have step line graph. It's good replacement for bar chart for large amount of data points. It seems to be very easy to implement in eChart.
  • It would be great if charts would use local Wikipedia language. This was especially annoying for date formatting with Vega.

Significant amount of charts created with module Module:Graph and Template:Graph:Chart were bar charts. Parameters for a start would be same as for line.
Mixed line/bar chart would be great to have but we can leave it to later.
Definition of bar chart and mixed charts seems to be much easier in eChart than in Vega.

This is great feedback, thank you. We have been looking at Template:Graph:Chart for reference as well.

To respond to a few specific things:

  • We do intend to support customizing colors in charts since there are situations where color carries semantic meaning that needs to be represented.
  • I haven't looked in detail, but it seems like step line charts are similar enough to line/bar charts that they should be easy enough to add.

Regarding using the local Wikipedia language: is there anything beyond date formats and text labels that you would expect to be formatted? If you could provide some specific examples that would be very helpful!

Regarding using the local Wikipedia language: is there anything beyond date formats and text labels that you would expect to be formatted?

Yes, decimal and thousand separators (digits grouping).

If you could provide some specific examples that would be very helpful!

On English Wikipedia it was rarely requested except in discussion here. I think that on other non-english wikis this issue was raised more frequently but I haven't look for it.

Vega have implementation of locale but it was not accessible via Graph Extension.