mmo-chart-config
1 symbol · generated 5 Oct 2026
mmo-chart-config
mmo-chart-config.jhs:1Configure a <mmo-chart>: where its values come from, which plot draws them, and everything shown around them -- with a live preview, and the code that builds the same chart.
- Extends
- CustomShadowElement
Index
| TYPES static | the plots, in the order they are offered | |
| SOURCES static | where the values come from | |
| ANIMATIONS static | the easings MMO.core.transitions knows | |
| PALETTES static | the palettes the server knows (\MMO\core\classes\aDataController::COLORS) | |
| DEFAULTS static | what <mmo-chart> uses when its configuration says nothing | |
| ATTRIBUTES static | the attributes of a chart this element writes, by option | |
| ViewDefault static readonly accessor | ||
| chart accessor | The chart this element was read from, if any. | |
| constructor() | ||
| init() | ||
| read(chart) | Take everything a chart shows: its source, its type and its options. | |
| readStatistics(url) | Take the statistics an address counts, if it is the server's statistics route. | |
| applyTo(chart) | Give a chart what is configured here. | |
| IsPoints(data) static | Whether a list of series holds points ([x, y], {x, y}) rather than values. | |
| Point(point) static | One point as the grid edits it. | |
| getShape() | What the data looks like, whatever its source: what the type and the options are checked against. | |
| whyNotType(type, shape) | Why a plot cannot draw this data. | |
| refresh() | Work out what the current type and source allow, turn off what they do not, and redraw the preview. | |
| disableTargets() | Turn off the comparisons the data cannot make (refresh). | |
| changed() | Something was edited: refresh once the burst of events it fires is over. | |
| describe() | Everything configured, as a chart takes it: its attributes, and either its configuration (typed values) or the address it reads them from. | |
| getStatisticsUrl() | The server's statistics route, with every setting in its query. | |
| getDatasets() | The series of the statistics that count something: named, and filtered. | |
| IsEmptyFilter(filter) static | Whether a filter keeps everything: no condition, or an empty group. | |
| selectSource(source) | Pick the source of the values. | |
| whyNotSource(source) | Why a source cannot be picked here. | |
| selectType(type) | Pick the plot. | |
| setMeasure(measure) | Count the entities, or sum one of their fields. | |
| setFrom(value) | The date the current period is counted from. | |
| loadCollections() | Read what the server can count, once. | |
| selectRepository(repository) | ||
| selectCollection(collection) | Count another collection: its fields are not the last one's, so the filters and fields start over. | |
| getEntityClass() | The schema of the collection counted, which the fields and the filters are picked from. | |
| addDataset() | Add a series to the statistics. | |
| renderDatasets() | Draw the series of the statistics: a name and a filter each. | |
| fillControls() | Fill the controls the template cannot bind: the lists of the server, the paths, the filters, the grids. | |
| connect(selector, property, entity) | Bind one <mmo-path> or <mmo-filter> to a property of this element, on the collection's schema. | |
| renderStrips() | Draw the strips of sources and types once: their state follows the data (updateStrips). | |
| updateStrips(shape) | Mark the source and the type picked, and turn off, with their reason, those that cannot be. | |
| renderNotes() | List what was turned off or changed, and why. | |
| renderValues() | Draw the grid of values: one row per series, one column per label. | |
| renderPoints() | Draw the points, one block per series. | |
| getColorCount() | How many colours the chart uses: one per label for a pie, one per series otherwise. | |
| getColors(count) | The colours of the first count series (or labels), the palette repeated when it is shorter. | |
| renderColors() | Draw one swatch per series (per label for a pie). | |
| resetColors() | Back to the chart's own palette. | |
| schedulePreview() | Redraw the preview once the edits pause: a chart read from the server is read again each time. | |
| updatePreview() | Give the preview what is configured. | |
| getCode() | The markup (and the script) that builds the same chart. | |
| ToCode(value, indent) static | A value as javascript, the way a person writes it: a series, a point or a list of labels on one line. | |
| renderCode() | Show the code of what is configured. | |
| copyCode() | Copy the code to the clipboard. | |
| .narrow | set by itself when the element is too narrow to show the preview beside the form |
Constants6
TYPES
staticmmo-chart-config.jhs:265the plots, in the order they are offered
SOURCES
staticmmo-chart-config.jhs:277where the values come from
ANIMATIONS
staticmmo-chart-config.jhs:285the easings MMO.core.transitions knows
PALETTES
staticmmo-chart-config.jhs:290the palettes the server knows (\MMO\core\classes\aDataController::COLORS)
DEFAULTS
staticmmo-chart-config.jhs:294what <mmo-chart> uses when its configuration says nothing
ATTRIBUTES
staticmmo-chart-config.jhs:301the attributes of a chart this element writes, by option
Properties2
ViewDefault
staticreadonlyaccessormmo-chart-config.jhs:304chart
accessormmo-chart-config.jhs:385The chart this element was read from, if any.
- Type
?HTMLElement
Methods44
constructor()
mmo-chart-config.jhs:314init()
mmo-chart-config.jhs:355read(chart)
mmo-chart-config.jhs:399Take everything a chart shows: its source, its type and its options.
| chart | HTMLElement | - a <mmo-chart> |
| returns | void |
readStatistics(url)
mmo-chart-config.jhs:457Take the statistics an address counts, if it is the server's statistics route.
| url | string | |
| returns | boolean | false when it is another address |
applyTo(chart)
mmo-chart-config.jhs:495Give a chart what is configured here. A chart read from an address keeps its options as attributes, which is what the next read of the address takes them from (and what a dashboard saves).
| chart | HTMLElement | - a <mmo-chart> |
| returns | void |
IsPoints(data)
staticmmo-chart-config.jhs:526Whether a list of series holds points ([x, y], {x, y}) rather than values.
| data | Array | |
| returns | boolean |
Point(point)
staticmmo-chart-config.jhs:540One point as the grid edits it.
| point | Array | object | |
| returns | x: ?number, y: ?number, size: ?number, label: string | } |
getShape()
mmo-chart-config.jhs:552What the data looks like, whatever its source: what the type and the options are checked against.
| returns | known: boolean, points: boolean, labels: number, series: number, negative: boolean, rate: boolean | } |
whyNotType(type, shape)
mmo-chart-config.jhs:589Why a plot cannot draw this data.
| type | string | |
| shape | object | - getShape |
| returns | ?string | null when it can |
refresh()
mmo-chart-config.jhs:618Work out what the current type and source allow, turn off what they do not, and redraw the preview.
| returns | void |
disableTargets()
mmo-chart-config.jhs:735Turn off the comparisons the data cannot make (refresh).
| returns | void |
changed()
mmo-chart-config.jhs:743Something was edited: refresh once the burst of events it fires is over.
| returns | void |
describe()
mmo-chart-config.jhs:761Everything configured, as a chart takes it: its attributes, and either its configuration (typed values) or the address it reads them from. An option the type does not read, or the source cannot keep, is left out.
| returns | attributes: object, config: ?object, url: ?string | } |
getStatisticsUrl()
mmo-chart-config.jhs:823The server's statistics route, with every setting in its query.
| returns | ?string | null until a collection is picked |
getDatasets()
mmo-chart-config.jhs:852The series of the statistics that count something: named, and filtered.
| returns | Array<{name: string, filter: object | >} |
IsEmptyFilter(filter)
staticmmo-chart-config.jhs:867Whether a filter keeps everything: no condition, or an empty group.
| filter | ?object | |
| returns | boolean |
selectSource(source)
mmo-chart-config.jhs:882Pick the source of the values.
| source | string | - values, points, statistics or url |
| returns | void |
whyNotSource(source)
mmo-chart-config.jhs:901Why a source cannot be picked here.
| source | string | |
| returns | ?string |
selectType(type)
mmo-chart-config.jhs:911Pick the plot.
| type | string | |
| returns | void |
setMeasure(measure)
mmo-chart-config.jhs:922Count the entities, or sum one of their fields.
| measure | string | - count or sum |
| returns | void |
setFrom(value)
mmo-chart-config.jhs:931The date the current period is counted from.
| value | string | - Y-m-d, empty for today |
| returns | void |
loadCollections()
mmo-chart-config.jhs:942Read what the server can count, once.
| returns | Promise<object> |
selectRepository(repository)
mmo-chart-config.jhs:967| repository | string | |
| returns | void |
selectCollection(collection)
mmo-chart-config.jhs:977Count another collection: its fields are not the last one's, so the filters and fields start over.
| collection | string | |
| returns | void |
getEntityClass()
mmo-chart-config.jhs:993The schema of the collection counted, which the fields and the filters are picked from.
| returns | ?string | the entity's class |
addDataset()
mmo-chart-config.jhs:1001Add a series to the statistics.
| returns | void |
renderDatasets()
mmo-chart-config.jhs:1013Draw the series of the statistics: a name and a filter each.
| returns | void |
fillControls()
mmo-chart-config.jhs:1045Fill the controls the template cannot bind: the lists of the server, the paths, the filters, the grids.
| returns | void |
connect(selector, property, entity)
mmo-chart-config.jhs:1093Bind one <mmo-path> or <mmo-filter> to a property of this element, on the collection's schema.
| selector | string | |
| property | string | |
| entity | ?string | - the class of the collection's entities |
| returns | void |
renderStrips()
mmo-chart-config.jhs:1117Draw the strips of sources and types once: their state follows the data (updateStrips).
| returns | void |
updateStrips(shape)
mmo-chart-config.jhs:1137Mark the source and the type picked, and turn off, with their reason, those that cannot be.
| shape | object | - getShape |
| returns | void |
renderNotes()
mmo-chart-config.jhs:1158List what was turned off or changed, and why.
| returns | void |
renderValues()
mmo-chart-config.jhs:1177Draw the grid of values: one row per series, one column per label. Every cell writes to values as it is typed; adding or removing a row or a column redraws it.
| returns | void |
renderPoints()
mmo-chart-config.jhs:1237Draw the points, one block per series.
| returns | void |
getColorCount()
mmo-chart-config.jhs:1285How many colours the chart uses: one per label for a pie, one per series otherwise.
| returns | number |
getColors(count)
mmo-chart-config.jhs:1295The colours of the first count series (or labels), the palette repeated when it is shorter.
| count | number | |
| returns | Array<string> |
renderColors()
mmo-chart-config.jhs:1304Draw one swatch per series (per label for a pie).
| returns | void |
resetColors()
mmo-chart-config.jhs:1337Back to the chart's own palette.
| returns | void |
schedulePreview()
mmo-chart-config.jhs:1349Redraw the preview once the edits pause: a chart read from the server is read again each time.
| returns | void |
updatePreview()
mmo-chart-config.jhs:1359Give the preview what is configured. A chart that read an address is replaced rather than given values, so an answer still on its way cannot overwrite them.
| returns | void |
getCode()
mmo-chart-config.jhs:1397The markup (and the script) that builds the same chart.
| returns | string |
ToCode(value, indent)
staticmmo-chart-config.jhs:1442A value as javascript, the way a person writes it: a series, a point or a list of labels on one line.
| value | * | |
| indent = '' | string | - the indentation of the line the value starts on |
| returns | string |
renderCode()
mmo-chart-config.jhs:1478Show the code of what is configured.
| returns | void |
copyCode()
mmo-chart-config.jhs:1487Copy the code to the clipboard.
| returns | Promise |
CSS hooks1
.narrow
mmo-chart-config.jhsset by itself when the element is too narrow to show the preview beside the form
.narrow