Page MenuHomePhabricator

Simplify chart JSON (for MVP)
Closed, ResolvedPublic

Description

When reviewing the Data:Chart.json format with @aude (as part of T375240) we noticed that currently we allow editors to override various rendering behaviours which make it more difficult to render charts consistently across platforms. For example, an editor can control the rotation of X-axis labels in such a way that they overlap the Y axis label.

We think it would be better to remove these fields for now, and revisit them later on.

We'd move the fields from the JSON to the Charts renderer service for now with sensible defaults.

The fields to remove from the schema in addition to width and height would be:

  • Remove interpolate
  • Remove colors
  • Remove x.format
  • Remove x.angle
  • Remove x.grid
  • Remove y.angle
  • Remove linewidth
  • Remove showValues
  • Remove showSymbols
  • Remove innerRadius
  • Remove showLegend - all charts should have legends by default.
  • The only required fields would be
    • "license"
    • "version"
    • "type"
    • "source"

Additional notes

{
	"properties": {
		"interpolate": {
			"$comment": "Taken from vega-lite",
			"enum": [
				"linear",
				"linear-closed",
				"step",
				"step-before",
				"step-after",
				"basis",
				"basis-open",
				"basis-closed",
				"cardinal",
				"cardinal-open",
				"cardinal-closed",
				"bundle",
				"monotone"
			]
		},
		"colors": {
			"items": {
				"$comment": "could regex + enum this",
				"type": "string"
			}
		},
		"x": {
			"properties": {
				"format": {
					"$comment": "Does this need to be localized?",
					"type": "string"
				},
				"angle": {
					"type": "number"
				},
				"grid": {
					"type": "boolean"
				}
			}
		},
		"y": {
			"properties": {
				"angle": {
					"type": "number"
				}
			}
		},
		"linewidth": {
			"type": "number"
		},
		"showValues": {
			"type": "object",
			"properties": {
				"format": {
					"type": "string"
				},
				"fontcolor": {
					"type": "string"
				},
				"fontsize": {
					"type": "number"
				},
				"offset": {
					"type": "number"
				},
				"angle": {
					"type": "number"
				}
			}
		},
		"showSymbols": {
			"type": "boolean"
		},
		"innerRadius": {
			"type": "number"
		}
	}
}

Sign off step

Event Timeline

Jdlrobson renamed this task from Simplify chart JSON (for now) to Simplify chart JSON (for MVP).Oct 7 2024, 9:12 PM
Jdlrobson moved this task from Incoming to Ready for Dev on the Charts (Sprint 8) board.

Change #1079560 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/Chart@master] Remove showLegend chart definition option

https://gerrit.wikimedia.org/r/1079560

Change #1079560 merged by jenkins-bot:

[mediawiki/extensions/Chart@master] Remove showLegend chart definition option

https://gerrit.wikimedia.org/r/1079560

aude moved this task from Ready for Dev to Doing on the Charts (Sprint 8) board.

Change #1080380 had a related patch set uploaded (by Aude; author: Aude):

[mediawiki/extensions/Chart@master] Simplify chart definition json for MVP

https://gerrit.wikimedia.org/r/1080380

Change #1080380 merged by jenkins-bot:

[mediawiki/extensions/Chart@master] Simplify chart definition json for MVP

https://gerrit.wikimedia.org/r/1080380

Jdlrobson moved this task from Code Review to Ready for Signoff on the Charts (Sprint 8) board.
Jdlrobson updated the task description. (Show Details)