Chart
A line or bar graph for the HUD or the world: a few series (a name and a color each) of numbers, the last Keep of each, drawn in its Size with value lines and their numbers, a legend and labels along the bottom. A script feeds it (Add a point, Set a whole series, Clear), or with no code a series names an output of the Track entity (“Cards: #4C9AFF = Cards Today”) and the chart takes a point of it every SampleEvery seconds of game time: a factory’s throughput over three days, a stock price, a population. Its range fits the points unless Max says.
Draws itself (its entity draws at Order 100 unless it has a Sprite, whose order counts).
In a network game, it also sends values of its own besides its properties.
Properties
Section titled “Properties”Each is listed as its key in the scene file and the MCP tools, then its kind of value, its default and what it does.
kind: one of Line, Bars = “Line”. Draws a line through the points, or a bar for each. (Field: one of its values.)series: lines of text: an array of strings, or one string with line breaks = [“Value: #4C9AFF”]. The series, one per row: a name, its color, and optionally an output of the Track entity it samples, e.g. “Cards: #4C9AFF” (fed by a script) or “Cards: #4C9AFF = Cards Today” (sampled with no code). A series a script adds by name that isn’t here takes the next color of the Palette. (Series, one per row: a name, a colon and a hex color, and optionally “=” and an output of the Track entity it samples, e.g. “Cards: #4C9AFF” (fed by a script) or “Cards: #4C9AFF = Cards Today”. The Inspector lists them a row each, the color picked and the output offered from what the Track entity gives.) (Field: its own editor: Chart Series.)keep: a whole number = 60. How many points each series keeps: adding one past this drops the oldest, so the chart scrolls. (Field: a number.)
Sampling
Section titled “Sampling”track: text = null. The entity whose outputs the series sample, e.g. “Factory”, or “*” for whichever has them. Empty is this entity, or the nearest one it’s inside with the output. (Names an entity.) (Field: an entity’s name.)sampleEvery: a number = 1. For a series with an output: how many seconds of game time between points (it takes one as the game starts too), so a sped-up game fills it faster and a paused one not at all. 0 takes none, leaving it to scripts. (Field: a number.)
min: a number = 0. The value at the bottom of the chart; a point below it stretches the chart down while Max is 0. (Field: a number.)max: a number = 0. The value at the top of the chart, points past it cut off there. 0 fits the highest point, rounded up to a round number (1, 1.2, 1.5, 2, 2.5, 3, 4, 5, 6 or 8 times a power of ten). (Field: a number.)format: text = null. How the numbers on the value lines are written, a .NET number format (“0”, “0.0”, “#,0”, “0%”). Empty writes them short: 950, 1.2k, 15k, 2.5M. (How a number is written: “0” whole numbers, “0.0” one decimal, “0.00” two decimals, “0.##” up to two decimals, “000” three digits at least, “#,0” thousands with commas, “0%” a percent (0.5 is 50%). The Inspector offers these and shows a number written that way.) (Field: its own editor: Number Format.)xLabels: lines of text: an array of strings, or one string with line breaks = []. Words along the bottom, spread evenly from the left end to the right, e.g. “3 days ago”, “2 days ago”, “Yesterday”, “Today”. Empty leaves the bottom bare. (A list, one item per line. The Inspector lists them a row each, to set, add, remove and reorder.) (Field: its own editor: List Rows.)legend: true or false = true. Shows each series’ name in its color along the top. (Field: on or off.)
size: [x, y] = [8,4]. World units before the transform’s scale, centered on the entity: the legend and labels are inside it. (A rectangle’s size, around the entity, in its own units before its scale: with Resize handles the Scene view puts handles on its edges and corners to drag.) (Field: a vector.)background: a color, “#RRGGBB” or “#RRGGBBAA” = “#00000080”. Behind the whole chart. Transparent for none. (Field: a color.)gridColor: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFF26”. The value lines across the chart. (Field: a color.)textColor: a color, “#RRGGBB” or “#RRGGBBAA” = “#FFFFFFD9”. The numbers, the legend’s names and the labels along the bottom. (Field: a color.)textSize: a number = 0.3. The height of a line of its words, in world units before the transform’s scale. (Field: a number.)font: text = null. The font of its words, or empty for the built-in one. (Names a font.) (Field: a name.)lineWidth: a number = 0.08. How thick a series’ line is, in world units before the transform’s scale. (Field: a number.)order: a whole number = 100. Higher draws on top, like Sprite.Order. (Field: a number.)
While the game runs
Section titled “While the game runs”Not saved with the scene; scripts read them, and entity_get shows them as live while the game plays.
bounds: [a number, a number]. The values the chart’s bottom and top stand for now: Min and Max, or fitted to the points.seriesNames: lines of text: an array of strings, or one string with line breaks. The series’ names, the Series rows’ first and then those scripts added.
Scripts use it as Chart: its methods, events and values that aren’t saved with the scene.