mmo-chart2
1 symbol · generated 30 Sep 2026
mmo-chart2
mmo-chart2.jhs:1- Extends
- CustomShadowElement
Index
| type | the plot to draw: bar, line, area, pie, radar or table | |
| width | the drawing width of the svg, in user units | |
| height | the drawing height of the svg, in user units | |
| icon | the icon shown next to the title | |
| url | where to read the configuration from, instead of setting config | |
| stacked | stack the series into one bar (or one ring) instead of drawing them side by side | |
| smooth | draw a line chart through curves rather than straight segments | |
| trend | show the delta badge: normal (a rise is good) or reverse (a rise is bad) | |
| trend-target | what the delta compares to: next-data, prev-data, next-set, prev-set | |
| config | type: the graph type: bar|line|area|pie|table|radar - icon: the icon's name to use - title: the title of the graph - colors: a list of colors - padding: {left: int, top: int, right: int, bottom: in… | |
| type accessor | Get the type of the chart | |
| stacked accessor | Whether the series are stacked into one shape. | |
| smooth accessor | Whether a line is drawn through curves. | |
| trend accessor | The delta mode, normal or reverse. | |
| trendTarget accessor | What the delta compares against. | |
| url accessor | Get the url of the chart | |
| config accessor | Get the config of the chart | |
| dataset readonly accessor | The series to draw, always as a list of lists. | |
| labels readonly accessor | The label of each point along the axis. | |
| padding readonly accessor | The room left around the plot for the axis and its labels. | |
| animation readonly accessor | The 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. | |
| 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. | |
| renderTrend(datasetIndex, dataIndex) | The delta badge of one point, as html, compared to what trend-target names. | |
| formatNumber(n) | Shorten a number for an axis or a badge (12000 becomes 12.0k). | |
| loopTicks(min, max, count) generator | ||
| drawAxis(root, yMin, yMax) | 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. | |
| (default) | a caption under the plot | |
| .table | show the table instead of the plot, which is what the switch button toggles |
Attributes10
type
mmo-chart2.jhsthe plot to draw: bar, line, area, pie, radar or table
type="bar"
width
mmo-chart2.jhsthe drawing width of the svg, in user units
width="560"
height
mmo-chart2.jhsthe drawing height of the svg, in user units
height="300"
icon
mmo-chart2.jhsthe icon shown next to the title
icon="chart-pie"
url
mmo-chart2.jhswhere to read the configuration from, instead of setting config
url
stacked
mmo-chart2.jhsstack the series into one bar (or one ring) instead of drawing them side by side
stacked
smooth
mmo-chart2.jhsdraw a line chart through curves rather than straight segments
smooth
trend
mmo-chart2.jhsshow the delta badge: normal (a rise is good) or reverse (a rise is bad)
trend
trend-target
mmo-chart2.jhswhat the delta compares to: next-data, prev-data, next-set, prev-set
trend-target
config
mmo-chart2.jhsconfig
Properties11
type
accessormmo-chart2.jhs:161Get the type of the chart
- Type
string
stacked
accessormmo-chart2.jhs:179Whether the series are stacked into one shape.
- Type
boolean
smooth
accessormmo-chart2.jhs:193Whether a line is drawn through curves.
- Type
boolean
trend
accessormmo-chart2.jhs:207The delta mode, normal or reverse.
- Type
?string
trendTarget
accessormmo-chart2.jhs:221What the delta compares against.
- Type
?string
url
accessormmo-chart2.jhs:236Get the url of the chart
- Type
string
config
accessormmo-chart2.jhs:271Get the config of the chart
- Type
object
dataset
readonlyaccessormmo-chart2.jhs:301The series to draw, always as a list of lists.
- Type
Array<Array<number>>
labels
readonlyaccessormmo-chart2.jhs:309The label of each point along the axis.
- Type
Array<string>
padding
readonlyaccessormmo-chart2.jhs:317The room left around the plot for the axis and its labels.
- Type
object
animation
readonlyaccessormmo-chart2.jhs:325The easing the bars and lines are drawn with.
- Type
string
Methods23
init()
mmo-chart2.jhs:140getColor(index)
mmo-chart2.jhs:334The colour of one series, falling back to the first when the palette is shorter.
| index | number | |
| returns | string |
getLegend(index)
mmo-chart2.jhs:343The name of one series, or a generated one.
| index = 0 | number | |
| returns | string |
getLabel(index)
mmo-chart2.jhs:352The label of one point, or a generated one.
| index = 0 | number | |
| returns | string |
hasTrend()
mmo-chart2.jhs:360Whether this chart shows a delta badge.
| returns | boolean |
isReverseTrend()
mmo-chart2.jhs:368Whether a rise is the bad news, which swaps the badge colours.
| returns | boolean |
showTooltip(html, evt)
mmo-chart2.jhs:381Show the tooltip with the given content, at the pointer.
| html | string | |
| evt | MouseEvent | |
| returns | void |
hideTooltip()
mmo-chart2.jhs:392Hide the tooltip.
| returns | void |
updateTooltip(evt)
mmo-chart2.jhs:402Move the tooltip so it follows the pointer and stays inside the element.
| evt | MouseEvent | |
| returns | void |
connectTooltip(element, datasetIndex, dataIndex, onEnter, onExit)
mmo-chart2.jhs:427Make one drawn shape (a bar, a dot, a slice) show the tooltip while it is pointed at.
| element | SVGElement | |
| datasetIndex | number | |
| dataIndex | number | |
| onEnter | ?function | - extra work when the pointer arrives |
| onExit | ?function | - extra work when it leaves |
| returns | void |
update()
mmo-chart2.jhs:445Redraw everything from the current configuration: the plot, the legend, the table.
| returns | void |
renderTrend(datasetIndex, dataIndex)
mmo-chart2.jhs:473The delta badge of one point, as html, compared to what trend-target names.
| datasetIndex | number | |
| dataIndex | number | |
| returns | string |
formatNumber(n)
mmo-chart2.jhs:510Shorten a number for an axis or a badge (12000 becomes 12.0k).
| n | number | |
| returns | string |
loopTicks(min, max, count)
generatormmo-chart2.jhs:516| min | ||
| max | ||
| count = 5 |
drawAxis(root, yMin, yMax)
mmo-chart2.jhs:534Draw the axis, its ticks and its labels, scaled to the values.
| root | SVGElement | |
| yMin | number | |
| yMax | number | |
| returns | void |
drawLegend()
mmo-chart2.jhs:569Draw the legend under the plot, one entry per series.
| returns | void |
drawLabelsAndLegend()
mmo-chart2.jhs:588Draw the legend of a chart whose entries are the labels rather than the series (a pie).
| returns | void |
animateAttribute(element, attr, from, to, duration, unit, animation)
mmo-chart2.jhs:627Animate one svg attribute, which is how a plot grows into place when it is drawn.
| element | SVGElement | |
| attr | string | |
| from | number | |
| to | number | |
| duration = 800 | number | - in milliseconds |
| unit = null | ?string | |
| animation = null | ?string | - the easing, defaulting to the chart's own |
| returns | void |
drawBarChart(root)
mmo-chart2.jhs:646Draw the bar chart, side by side or stacked.
| root | SVGElement | |
| returns | void |
drawLineChart(root, withArea, smooth)
mmo-chart2.jhs:746Draw the line chart, optionally filled and optionally smoothed.
| root | SVGElement | |
| withArea = false | boolean | |
| smooth = null | ?boolean | |
| returns | void |
drawAreaChart(root)
mmo-chart2.jhs:833Draw the area chart, which is the line chart with its area filled.
| root | SVGElement | |
| returns | void |
drawPieChart(root)
mmo-chart2.jhs:846Draw the pie, or the ring when the series are stacked.
| root | SVGElement | |
| returns | void |
drawRadarChart(root)
mmo-chart2.jhs:986Draw the radar: one axis per label, one polygon per series.
| root | SVGElement | |
| returns | void |
Slots1
(default)
mmo-chart2.jhsa caption under the plot
<slot>
CSS hooks1
.table
mmo-chart2.jhsshow the table instead of the plot, which is what the switch button toggles
.table