Vixen
02b45cc4
csharp
public sealed class FlameChartView

A flame chart: one bar per scope, nesting downwards, time across.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

Elements rather than drawing, and that is forced rather than chosen. A bar has a name on it, and text belongs to an element in this framework — there is no way to draw a string from OnDraw. TimelineRuler reaches the same conclusion for its tick labels, and this is the same pattern one level up: absolutely-positioned children out of a pool, parked rather than removed when the chart needs fewer.

⚠ Bars narrower than MinimumBarWidth are dropped, subtree and all. A capture of two hundred frames holds tens of thousands of scopes and almost all of them are sub-pixel — realising an element per scope would build a subtree the style engine cannot walk in a frame, to draw bars nobody can see or click. Dropping a bar drops what is inside it too, because a child is never wider than its parent. Zooming in brings them back, which is what zooming in is for.

⚠ Clicking a bar zooms to it rather than only selecting it. That is what a flame chart does everywhere it exists, and without it the whole control is unusable at any capture longer than a frame: the interesting scope is four pixels wide and there is no other way to reach it.

⚠ Laid out from LayoutFinished rather than from the setter. Every bar's position is a fraction of this control's width, and during a tick the width is whatever it was last frame — so a chart realised on assignment lands at the previous size and jumps on the next frame. ConsoleView follows its tail from the same hook for the same reason.

Fields and properties (10)

  • public const float RowHeight

    How tall one row of the chart is, in device-independent pixels.

  • public const float MinimumBarWidth

    How narrow a bar may be before it is not worth an element.

  • public const int MaximumBars

    How many bars the chart will realise, whatever the zoom asks for.

  • public const int HueCount

    How many colours a scope name is hashed into.

  • protected override string TagName

    The element name this type answers to when a caller does not choose one.

  • protected override bool AcceptsFocus

    Whether the focus can rest on this kind of control at all.

  • public FlameNode? Selected

    Which bar is selected, or .

  • public int Rows

    How many rows deep the chart currently is.

  • public int BarCount

    How many bars are on screen.

  • public bool IsZoomed

    Whether the chart is showing less than the whole capture.

Events (1)

  • public Action<FlameChartView, FlameNode>? Chosen

    Raised when a bar is chosen, so a panel can show the scope's numbers.

Methods (7)

  • public void Show(IReadOnlyList<FlameNode> scopes)

    Points the chart at a set of root scopes.

  • public void Reset()

    Puts the whole of what it was given back on screen.

  • public void ZoomTo(FlameNode node)

    Narrows the window to one scope.

  • public void Realise()

    Rebuilds the bars for the current window and width.

  • protected override void OnCreated()

    Builds whatever this element is made of, once, as it joins a document.

  • protected override void OnRemoved()

    Called once, as the element leaves the document.

  • public static int HueOf(string name)

    Which colour class a scope name draws in.

Used by (3)

  • FlameChartViewTestsVixen.Editor.Profiler.Tests
  • GpuTimelineViewVixen.Editor.Profiler
  • ProfilerViewVixen.Editor.Profiler