You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
A way to size indicator panes from the host (fullscreen one pane) #8
The use case. A host action — a toolbar button, a double-tap on a pane's legend — that makes one indicator pane take (nearly) all of the chart's height, keeping the candles as a squashed strip above it, and restores the layout afterwards. The "maximize this indicator" affordance every desktop terminal has.
What stands in the way today. Pane heights live in _paneHeights, seeded at BaseDimension.secondaryPaneHeight (100) and only ever changed by a drag when resizablePanes is on. There is no parameter or controller method to set them from the host. mBaseHeight only sizes the candle area, so a host can squash the candles but cannot grow a pane — with the panes fixed at 100 each, the leftover height always flows back into the candles. The volume pane is fixed the same way.
What I'd suggest. A paneHeights parameter on KChartWidget:
dart
/// Heights for the indicator panes, overriding the standard height and
/// anything dragged, until the panes themselves change. Null — the
/// default — leaves the heights to the chart.
final List? paneHeights;
wired into _effectivePaneHeights:
dart
List get _effectivePaneHeights {
final count = _resolved.panes.length;
final override = widget.paneHeights;
if (override != null) {
return List.generate(
count,
(i) => i < override.length && override[i] > 0
? override[i]
: BaseDimension.secondaryPaneHeight,
);
}
// …existing logic untouched…
}
A KChartController.setPaneHeight(index, height) would work for us just as well if that fits the controller's remit better.
Happy to send a PR with tests whichever shape you prefer — the parameter above is ~10 lines and leaves every default path unchanged
Thanks for the detailed explanation and the proposed approach.
I agree that exposing programmatic control over pane heights is a useful addition for this use case. I’ll include this in the next update, while keeping the existing behavior and defaults unchanged.
Thanks again for the detailed write-up — this is implemented and will ship in 3.1.0, coming soon. I'd love your feedback once 3.1.0 is out.
Here is what you'll get, using your "maximize this indicator" case as the starting point.
1. Maximize / restore from the controller (the toolbar-button / double-tap case)
final chart =KChartController(); // pass it as KChartWidget(controller: chart)
chart.maximizePane(1); // pane 1 takes all the height it can; candles keep a strip above it
chart.restorePanes(); // back to how it was
chart.toggleMaximizePane(1); // one button for both
chart.maximizeVolume(); // the volume pane works the same way
A maximized pane follows the chart's size and moves with its indicator if you reorder.
2. Sizing from the host — the paneHeights parameter you proposed, plus volumeHeight, since the volume pane was fixed the same way:
KChartWidget(
candles,
ChartColors(),
indicators: indicators,
paneHeights: maximized ? [60, 500] :null, // null = the chart's own layout, as before
volumeHeight:80,
onPaneHeightsChanged: (heights) =>setState(() => saved = heights),
);
Heights from code aren't held to minPaneHeight / maxPaneHeight, so a pane can be taller than a user could drag it; one that would squeeze the candles out of the box is cut back. While a list is given you own the heights (like a controlled field): a drag is reported through onPaneHeightsChanged and the pane moves when you pass the list back. KChartController.setPaneHeight(index, height) and resetPaneHeights() are there too, as you suggested as an alternative. Defaults are unchanged when you pass nothing.
3. Two extras you didn't ask for
PaneSizeMode.ratios — size by proportion instead of pixels, e.g. paneRatios: [3, 1, 2] is candles 3, volume 1, one pane 2, and it holds as the chart is resized.
PaneSizeMode.custom — the user lays the chart out themselves: chart.editPanes() shows a line between each two parts to drag, between a minimum and maximum height, and the layout is reported through onPaneRatiosChanged so you can save it.
Dragged heights also now follow their pane when you reorder indicators (before, they stayed at their position).
Screenshots attached: the standard layout, RSI maximized, OBV maximized, [3, 1, 2, 2] ratios, and the custom edit mode before and after dragging a line.
Docs: doc/panes.md. The PR is #10 if you want to follow along or try it from the branch before the release.
Activity
CtrlAltDevelop commentedon Oct 5, 2026
Thanks for the detailed explanation and the proposed approach.
I agree that exposing programmatic control over pane heights is a useful addition for this use case. I’ll include this in the next update, while keeping the existing behavior and defaults unchanged.
Thanks again for the suggestion!
feat: size indicator panes from the host, and maximize one
CtrlAltDevelop commentedon Oct 6, 2026
Thanks again for the detailed write-up — this is implemented and will ship in 3.1.0, coming soon. I'd love your feedback once 3.1.0 is out.
Here is what you'll get, using your "maximize this indicator" case as the starting point.
1. Maximize / restore from the controller (the toolbar-button / double-tap case)
A maximized pane follows the chart's size and moves with its indicator if you reorder.
2. Sizing from the host — the
paneHeightsparameter you proposed, plusvolumeHeight, since the volume pane was fixed the same way:Heights from code aren't held to
minPaneHeight/maxPaneHeight, so a pane can be taller than a user could drag it; one that would squeeze the candles out of the box is cut back. While a list is given you own the heights (like a controlled field): a drag is reported throughonPaneHeightsChangedand the pane moves when you pass the list back.KChartController.setPaneHeight(index, height)andresetPaneHeights()are there too, as you suggested as an alternative. Defaults are unchanged when you pass nothing.3. Two extras you didn't ask for
PaneSizeMode.ratios— size by proportion instead of pixels, e.g.paneRatios: [3, 1, 2]is candles 3, volume 1, one pane 2, and it holds as the chart is resized.PaneSizeMode.custom— the user lays the chart out themselves:chart.editPanes()shows a line between each two parts to drag, between a minimum and maximum height, and the layout is reported throughonPaneRatiosChangedso you can save it.Dragged heights also now follow their pane when you reorder indicators (before, they stayed at their position).
Screenshots attached: the standard layout, RSI maximized, OBV maximized,
[3, 1, 2, 2]ratios, and the custom edit mode before and after dragging a line.Docs:
doc/panes.md. The PR is #10 if you want to follow along or try it from the branch before the release.