Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

A way to size indicator panes from the host (fullscreen one pane) #8

Closed

Description

@lidd

What are you trying to do

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

How you are working around it today

No response

What it might look like

Activity

  1. added
    enhancement
    on Sep 30, 2026
  2. CtrlAltDevelop commented on Oct 5, 2026

    @CtrlAltDevelop
    Owner

    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!

  3. added a commit that references this issue on Oct 5, 2026
    ef51d30
  4. CtrlAltDevelop commented on Oct 6, 2026

    @CtrlAltDevelop
    Owner

    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.

    Image Image Image Image Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

enhancement

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions