This sample shows how to create and align sparkline style charts in a Node, using Spot Panel and Panel.alignmentFocusName.

The Spot Panel's main element is a red vertical line, and its other elements are items in an item array. Instead of aligning to these item array items, which are Horizontal Panels, we want to align to the Shape that represents the sparkline, inside of the Panel. To do this we set Panel.alignmentFocusName to "spark", and then set the alignmentFocus in function makeAlignmentFromValues() to the top left point, plus some offset to normalize the y-axis of the sparklines.

The Sparklines exist in a horizontal panel with optional labels at the front, and these sparkline labels also have their alignment computed within the horizontal panel, based on the fractional height of the starting value of the sparkline.

加入 GoJS 交流群
GoJS 交流群 (769862113)