Index

mmo-chart

1 symbol · generated 5 Oct 2026

element

mmo-chart

mmo-chart.jhs:1
<mmo-chart type="bar" width="560" height="300" icon="chart-pie" url stacked smooth trend trend-target trend-unit unit configurable></mmo-chart>
Extends
CustomShadowElement
-- bar -- - stacked: {bool} if true, stacked data in one bar -- line -- - smooth: {bool} if true, smooth points line -- pie -- - stacked: {bool} if true, stacked data in one pie -- radar -- -- scatter -- - data: a list of series, each a list of points: `[x, y]`, `[x, y, size]` (a bubble) or `{x, y, size, label}` (ex: [[[1, 2], [3, 4]], [[5, 6, 10]]]); a single series may be given alone ([[1, 2], [3, 4]]) - labels: unused, a point carries its own `label` -- tendency -- - a few periods, the current one first: the first series' current value large, with its change since the period before (shown with `trend`), then one row per other series, then the earlier periods. A rate (`unit: '%'`) is gauged on 0-100 with a mark at the period before, anything else by a sparkline. Its table compares each period to the one before, whatever `trendTarget` says

Index

typethe plot to draw: bar, line, area, pie, radar, scatter, tendency or table
widththe drawing width of the svg, in user units
heightthe drawing height of the svg, in user units
iconthe icon shown next to the title
urlwhere to read the configuration from, instead of setting config
stackedstack the series into one bar (or one ring) instead of drawing them side by side
smoothdraw a line chart through curves rather than straight segments
trendshow the delta badge: normal (a rise is good) or reverse (a rise is bad)
trend-targetwhat the delta compares to: next-data, prev-data, next-set, prev-set
trend-unit% to show the delta as a percentage of what it compares to, rather than a difference (a rate, whose unit is %, always changes by points)
unita suffix for every value (%, €...)
configurableshow the button that opens the chart's configurator (<mmo-chart-config>) in the side panel
config type: the graph type: bar|line|area|pie|table|radar|scatter|tendency - icon: the icon's name to use - title: the title of the graph, as text (markup in it shows as typed) - colors: a list of colors…
type accessorGet the type of the chart
stacked accessorWhether the series are stacked into one shape.
smooth accessorWhether a line is drawn through curves.
trend accessorThe delta mode, normal or reverse.
trendTarget accessorWhat the delta compares against.
trendUnit accessorHow the delta is expressed: % for a percentage, anything else for a difference.
unit accessorThe suffix of every value.
configurable accessorWhether the statistics behind url can be edited, from the toolbar.
url accessorGet the url of the chart
config accessorGet the config of the chart
dataset readonly accessorThe series to draw, always as a list of lists.
labels readonly accessorThe label of each point along the axis.
padding readonly accessorThe room left around the plot for the axis and its labels.
animation readonly accessorThe easing the bars and lines are drawn with.
init()
getColor(index)The colour of one series, falling back to the first when the palette is shorter.
getPoint(point)One point of a scatter series, from [x, y], [x, y, size] or {x, y, size, label}.
getLegend(index)The name of one series, or a generated one.
getLabel(index)The label of one point, or a generated one.
hasTrend()Whether this chart shows a delta badge.
isReverseTrend()Whether a rise is the bad news, which swaps the badge colours.
showTooltip(html, evt)Show the tooltip with the given content, at the pointer.
hideTooltip()Hide the tooltip.
updateTooltip(evt)Move the tooltip so it follows the pointer and stays inside the element.
connectTooltip(element, datasetIndex, dataIndex, onEnter, onExit)Make one drawn shape (a bar, a dot, a slice) show the tooltip while it is pointed at.
update()Redraw everything from the current configuration: the plot, the legend, the table.
getTrend(datasetIndex, dataIndex)The delta of one point against what trend-target names, as a difference or, with trend-unit="%", as a percentage of it.
compareValues(value, other)How much a value moved from another: a difference or, with trend-unit="%", a percentage of the other.
getTrendUnit(diff)What a delta is counted in: points for a rate, % with trend-unit="%", the unit otherwise.
renderTrend(datasetIndex, dataIndex)The delta badge of one point, as html, compared to what trend-target names.
renderValue(datasetIndex, dataIndex)One cell of the table: the value, or the (x, y) of a scatter point.
formatValue(value)A value in full, as the reader's locale writes it, with the chart's unit.
formatNumber(n)Shorten a number for an axis or a badge (12000 becomes 12.0k).
loopTicks(min, max, count) generator
drawAxis(root, yMin, yMax, xMin, xMax)Draw the axis, its ticks and its labels, scaled to the values.
drawLegend()Draw the legend under the plot, one entry per series.
drawLabelsAndLegend()Draw the legend of a chart whose entries are the labels rather than the series (a pie).
animateAttribute(element, attr, from, to, duration, unit, animation)Animate one svg attribute, which is how a plot grows into place when it is drawn.
drawBarChart(root)Draw the bar chart, side by side or stacked.
drawLineChart(root, withArea, smooth)Draw the line chart, optionally filled and optionally smoothed.
drawAreaChart(root)Draw the area chart, which is the line chart with its area filled.
drawPieChart(root)Draw the pie, or the ring when the series are stacked.
drawRadarChart(root)Draw the radar: one axis per label, one polygon per series.
drawScatterChart(root)Draw the scatter: one dot per point, on two numeric axes; a point with a size is a bubble, its area proportional to the size.
drawTendency()Draw the tendency: the current period of the first series as one large figure, with its change since the period before and a gauge; then one row per other series; then the earlier periods of the fi…
getChange(datasetIndex)The change of one series since the period before: its current value against the next one.
getMood(datasetIndex)Whether the change of one series is good news, as a class: good, bad or equal (empty without trend).
formatChange(datasetIndex)The change of one series since the period before, signed and with its unit (+7 pts, -12%, =).
renderGauge(datasetIndex)The gauge of one series: a 0-100 bar with a mark at the period before for a rate, a sparkline otherwise.
toggleTable()Switch between the plot and the table of the same values.
updateSwitch()Make the switch say what it shows next: the table, or the plot back.
download(format)Download the values. CSV and XLSX are built by the server: from the statistics url links to (StatisticController::routeExport), else from the values shown, posted (@see…
toJSON()The values by series, then by label: {series: {label: value}}.
toCSV()The values as the server exports them: one line per series, one column per label, ; separated.
configure()Open the configurator (<mmo-chart-config>) in the side panel: the source of the values, the type and every option, with a preview.
(default)a description, shown in a tooltip next to the title
.tableshow the table instead of the plot, which is what the switch button toggles
.tendencyset while the type is tendency: the figures replace the plot
.loadingset while url is read: the toolbar is hidden
.framelessno border, ground or padding of its own: set by itself inside a grid tile (<mmo-widget>), which already frames it

Attributes13

type

mmo-chart.jhs

the plot to draw: bar, line, area, pie, radar, scatter, tendency or table

type="bar"

width

mmo-chart.jhs

the drawing width of the svg, in user units

width="560"

height

mmo-chart.jhs

the drawing height of the svg, in user units

height="300"

icon

mmo-chart.jhs

the icon shown next to the title

icon="chart-pie"

url

mmo-chart.jhs

where to read the configuration from, instead of setting config

url

stacked

mmo-chart.jhs

stack the series into one bar (or one ring) instead of drawing them side by side

stacked

smooth

mmo-chart.jhs

draw a line chart through curves rather than straight segments

smooth

trend

mmo-chart.jhs

show the delta badge: normal (a rise is good) or reverse (a rise is bad)

trend

trend-target

mmo-chart.jhs

what the delta compares to: next-data, prev-data, next-set, prev-set

trend-target

trend-unit

mmo-chart.jhs

% to show the delta as a percentage of what it compares to, rather than a difference (a rate, whose unit is %, always changes by points)

trend-unit

configurable

mmo-chart.jhs

show the button that opens the chart's configurator (<mmo-chart-config>) in the side panel

configurable

config

mmo-chart.jhs
type: the graph type: bar|line|area|pie|table|radar|scatter|tendency - icon: the icon's name to use - title: the title of the graph, as text (markup in it shows as typed) - colors: a list of colors - padding: {left: int, top: int, right: int, bottom: int} - data: list of values or a list of list of values (ex: [[a1,a2], [b1,b2], [c1,c2]]) - legend: list of title for each set in data (ex: [a,b,c]) - labels: list of labels for each data (ex: [1,2]) - animation: linear|quadIn|quadOut|quadInOut|cubicIn|cubicOut|cubicInOut|quartIn|quartOut|quartInOut|quintIn|quintOut|quintInOut|easeIn|easeOut|easeInOut|backIn|backOut|backInOut|circIn|circOut|circInOut|bounceIn|bounceOut|bounceInOut|elasticIn|elasticOut|elasticInOut - trend: normal|reverse - trendTarget: next-data|prev-data|next-set|prev-set - trendUnit: '' (the delta as a difference) or '%' (the delta as a percentage of what it compares to) - unit: a suffix for every value (`%`, `€`...)

config

Properties14

type

accessormmo-chart.jhs:222

Get the type of the chart

get type() set type(value)
Type
string

stacked

accessormmo-chart.jhs:240

Whether the series are stacked into one shape.

get stacked() set stacked(value)
Type
boolean

smooth

accessormmo-chart.jhs:255

Whether a line is drawn through curves.

get smooth() set smooth(value)
Type
boolean

trend

accessormmo-chart.jhs:269

The delta mode, normal or reverse.

get trend() set trend(value)
Type
?string

trendTarget

accessormmo-chart.jhs:283

What the delta compares against.

get trendTarget() set trendTarget(value)
Type
?string

trendUnit

accessormmo-chart.jhs:297

How the delta is expressed: % for a percentage, anything else for a difference.

get trendUnit() set trendUnit(value)
Type
string

unit

accessormmo-chart.jhs:311

The suffix of every value.

get unit() set unit(value)
Type
string

configurable

accessormmo-chart.jhs:325

Whether the statistics behind url can be edited, from the toolbar.

get configurable() set configurable(value)
Type
boolean

url

accessormmo-chart.jhs:339

Get the url of the chart

get url() set url(value)
Type
string

config

accessormmo-chart.jhs:378

Get the config of the chart

get config() set config(value)
Type
object

dataset

readonlyaccessormmo-chart.jhs:413

The series to draw, always as a list of lists.

get dataset()
Type
Array<Array<number>>

labels

readonlyaccessormmo-chart.jhs:421

The label of each point along the axis.

get labels()
Type
Array<string>

padding

readonlyaccessormmo-chart.jhs:429

The room left around the plot for the axis and its labels.

get padding()
Type
object

animation

readonlyaccessormmo-chart.jhs:437

The easing the bars and lines are drawn with.

get animation()
Type
string

Methods41

getColor(index)

mmo-chart.jhs:446

The colour of one series, falling back to the first when the palette is shorter.

getColor(index)
indexnumber
returnsstring

getPoint(point)

mmo-chart.jhs:455

One point of a scatter series, from [x, y], [x, y, size] or {x, y, size, label}.

getPoint(point)
pointArray | object | MMO.core.Map
returnsx: number, y: number, size: ?number, label: ?string}

getLegend(index)

mmo-chart.jhs:466

The name of one series, or a generated one.

getLegend(index = 0)
index = 0number
returnsstring

getLabel(index)

mmo-chart.jhs:475

The label of one point, or a generated one.

getLabel(index = 0)
index = 0number
returnsstring

hasTrend()

mmo-chart.jhs:483

Whether this chart shows a delta badge.

hasTrend()
returnsboolean

isReverseTrend()

mmo-chart.jhs:491

Whether a rise is the bad news, which swaps the badge colours.

isReverseTrend()
returnsboolean

showTooltip(html, evt)

mmo-chart.jhs:504

Show the tooltip with the given content, at the pointer.

showTooltip(html, evt)
htmlstring
evtMouseEvent
returnsvoid

updateTooltip(evt)

mmo-chart.jhs:525

Move the tooltip so it follows the pointer and stays inside the element.

updateTooltip(evt)
evtMouseEvent
returnsvoid

connectTooltip(element, datasetIndex, dataIndex, onEnter, onExit)

mmo-chart.jhs:550

Make one drawn shape (a bar, a dot, a slice) show the tooltip while it is pointed at.

connectTooltip(element, datasetIndex, dataIndex, onEnter, onExit)
elementSVGElement
datasetIndexnumber
dataIndexnumber
onEnter?function- extra work when the pointer arrives
onExit?function- extra work when it leaves
returnsvoid

update()

mmo-chart.jhs:568

Redraw everything from the current configuration: the plot, the legend, the table.

update()
returnsvoid

getTrend(datasetIndex, dataIndex)

mmo-chart.jhs:601

The delta of one point against what trend-target names, as a difference or, with trend-unit="%", as a percentage of it.

getTrend(datasetIndex, dataIndex)
datasetIndexnumber
dataIndexnumber
returns?numbernull when there is nothing to compare to

compareValues(value, other)

mmo-chart.jhs:622

How much a value moved from another: a difference or, with trend-unit="%", a percentage of the other.

compareValues(value, other)A rate (a `%` unit) always moves by points: a percentage of a percentage reads as points, wrongly.
value*
other*
returns?numbernull when either is missing or not a number (NA)

getTrendUnit(diff)

mmo-chart.jhs:635

What a delta is counted in: points for a rate, % with trend-unit="%", the unit otherwise.

getTrendUnit(diff = null)
diff = null?number- the delta, for the plural of a point
returnsstring

renderTrend(datasetIndex, dataIndex)

mmo-chart.jhs:646

The delta badge of one point, as html, compared to what trend-target names.

renderTrend(datasetIndex, dataIndex)
datasetIndexnumber
dataIndexnumber
returnsstring

renderValue(datasetIndex, dataIndex)

mmo-chart.jhs:664

One cell of the table: the value, or the (x, y) of a scatter point.

renderValue(datasetIndex, dataIndex)
datasetIndexnumber
dataIndexnumber
returnsstring

formatValue(value)

mmo-chart.jhs:677

A value in full, as the reader's locale writes it, with the chart's unit.

formatValue(value)
value*
returnsstring

formatNumber(n)

mmo-chart.jhs:687

Shorten a number for an axis or a badge (12000 becomes 12.0k).

formatNumber(n)
nnumber
returnsstring

loopTicks(min, max, count)

generatormmo-chart.jhs:693
*loopTicks(min, max, count = 5)
min
max
count = 5

drawAxis(root, yMin, yMax, xMin, xMax)

mmo-chart.jhs:714

Draw the axis, its ticks and its labels, scaled to the values.

drawAxis(root, yMin, yMax, xMin = null, xMax = null)The x axis shows the labels, or numeric ticks when it has a range of its own (a scatter).
rootSVGElement
yMinnumber
yMaxnumber
xMin = null?number
xMax = null?number
returnsvoid

drawLegend()

mmo-chart.jhs:760

Draw the legend under the plot, one entry per series.

drawLegend()
returnsvoid

drawLabelsAndLegend()

mmo-chart.jhs:779

Draw the legend of a chart whose entries are the labels rather than the series (a pie).

drawLabelsAndLegend()
returnsvoid

animateAttribute(element, attr, from, to, duration, unit, animation)

mmo-chart.jhs:818

Animate one svg attribute, which is how a plot grows into place when it is drawn.

animateAttribute(element, attr, from, to, duration = 800, unit = null, animation = null)
elementSVGElement
attrstring
fromnumber
tonumber
duration = 800number- in milliseconds
unit = null?string
animation = null?string- the easing, defaulting to the chart's own
returnsvoid

drawBarChart(root)

mmo-chart.jhs:837

Draw the bar chart, side by side or stacked.

drawBarChart(root)
rootSVGElement
returnsvoid

drawLineChart(root, withArea, smooth)

mmo-chart.jhs:937

Draw the line chart, optionally filled and optionally smoothed.

drawLineChart(root, withArea = false, smooth = null)
rootSVGElement
withArea = falseboolean
smooth = null?boolean
returnsvoid

drawAreaChart(root)

mmo-chart.jhs:1024

Draw the area chart, which is the line chart with its area filled.

drawAreaChart(root)
rootSVGElement
returnsvoid

drawPieChart(root)

mmo-chart.jhs:1037

Draw the pie, or the ring when the series are stacked.

drawPieChart(root)
rootSVGElement
returnsvoid

drawRadarChart(root)

mmo-chart.jhs:1177

Draw the radar: one axis per label, one polygon per series.

drawRadarChart(root)
rootSVGElement
returnsvoid

drawScatterChart(root)

mmo-chart.jhs:1268

Draw the scatter: one dot per point, on two numeric axes; a point with a size is a bubble, its area proportional to the size.

drawScatterChart(root)
rootSVGElement
returnsvoid

drawTendency()

mmo-chart.jhs:1342

Draw the tendency: the current period of the first series as one large figure, with its change since the period before and a gauge; then one row per other series; then the earlier periods of the first one.

drawTendency()A rate (a `%` unit) is gauged on 0-100 with a mark where it was; any other value by a sparkline.
returnsvoid

getChange(datasetIndex)

mmo-chart.jhs:1393

The change of one series since the period before: its current value against the next one.

getChange(datasetIndex)
datasetIndexnumber
returns?numbernull when there is no trend to show, or nothing to compare to

getMood(datasetIndex)

mmo-chart.jhs:1402

Whether the change of one series is good news, as a class: good, bad or equal (empty without trend).

getMood(datasetIndex)
datasetIndexnumber
returnsstring

formatChange(datasetIndex)

mmo-chart.jhs:1414

The change of one series since the period before, signed and with its unit (+7 pts, -12%, =).

formatChange(datasetIndex)
datasetIndexnumber
returnsstringempty when there is none

renderGauge(datasetIndex)

mmo-chart.jhs:1426

The gauge of one series: a 0-100 bar with a mark at the period before for a rate, a sparkline otherwise.

renderGauge(datasetIndex)
datasetIndexnumber
returnsElement

toggleTable()

mmo-chart.jhs:1457

Switch between the plot and the table of the same values.

toggleTable()
returnsbooleanwhether the table is shown

updateSwitch()

mmo-chart.jhs:1467

Make the switch say what it shows next: the table, or the plot back.

updateSwitch()
returnsvoid

download(format)

mmo-chart.jhs:1485

Download the values. CSV and XLSX are built by the server: from the statistics url links to (StatisticController::routeExport), else from the values shown, posted (StatisticController::routeExportData). JSON, and CSV when the application has no such route, are built here.

download(format)
formatstring- csv, xlsx or json
returnsPromise

toJSON()

mmo-chart.jhs:1510

The values by series, then by label: {series: {label: value}}.

toJSON()
returnsobject

toCSV()

mmo-chart.jhs:1524

The values as the server exports them: one line per series, one column per label, ; separated.

toCSV()
returnsstring

configure()

mmo-chart.jhs:1544

Open the configurator (<mmo-chart-config>) in the side panel: the source of the values, the type and every option, with a preview. Applied, they replace this chart's; a chart reading url keeps them as attributes, which is what a dashboard saves.

configure()
returnsPromise<boolean>whether they were applied

Slots1

(default)

mmo-chart.jhs

a description, shown in a tooltip next to the title

<slot>

CSS hooks4

.table

mmo-chart.jhs

show the table instead of the plot, which is what the switch button toggles

.table

.tendency

mmo-chart.jhs

set while the type is tendency: the figures replace the plot

.tendency

.loading

mmo-chart.jhs

set while url is read: the toolbar is hidden

.loading

.frameless

mmo-chart.jhs

no border, ground or padding of its own: set by itself inside a grid tile (<mmo-widget>), which already frames it

.frameless