Skip to content
ModernUI A DaneTrades developer library

Charts

Chart controls render compact dashboard visuals. They are display controls and do not emit app-level events by default.

Controls And Helpers

Control/helper Use it for Emits events
MuiSparkline Compact trend line. None by default
MuiLineChart X/Y line chart. None by default
MuiBarChart Bar chart. None by default
MuiDonutChart Donut or pie style composition chart. None by default
MuiHalfGaugeChart Half-gauge dashboard chart. None by default
Mui::SparklineGrid Configure sparkline grid. None
Mui::BarChartGrid Configure bar chart grid. None
Mui::LineChartGrid Configure line chart grid. None

Chart controls are display-only: they do not emit app-level bus events. Segment/bar hover tooltips (PointHoverTooltip(true)) are internal UI feedback, not MUI_EVENT_* payloads.

Refresh data by calling SetData / SetXY and letting the control invalidate; no NotifyChanged() pattern.


MuiSparkline

Purpose

Compact single-series trend line with optional area fill, card chrome, title/legend, and optional plot grid.

Source: Controls/Charts/Sparkline.mqh.

Create It

UI build fragment
double vals[]={1,3,2,5,4};
MuiSparkline *sp=Mui::Sparkline(parent,vals,300.0,140.0);
Mui::SparklinePlain(parent,vals,240.0,70.0);

MuiCreate::Sparkline, Mui::SparklineGrid(sp, true) for grid styling.

Events

None by default.

Common Setters

Setter Purpose
SetData(values[]) Y values (auto range unless Range set).
LineColor / FillColor Stroke and optional fill under line.
ThicknessPx, ShowLastDot, SmoothLine, SmoothStepsPerSegment Line styling.
Range(min, max), Pad(...) Plot bounds and inset.
Title, Legend, InCard / ShowCard, CardPad, CardRadius Card chrome.
LegendPosition, NoLegend, LegendAtBottom, NoTitle Legend placement.
ShowGrid, GridColor, GridDivisions Plot grid (or Mui::SparklineGrid).

Notes

  • Values array is copied on SetData; you can reuse or free the source array after the call.

Related


MuiLineChart

Purpose

Cartesian line chart from parallel xs[] and ys[] arrays with optional axes, grid, card chrome, and hover tooltips.

Source: Controls/Charts/LineChart.mqh.

Create It

UI build fragment
double xs[]={0,1,2,3}, ys[]={10,12,9,14};
MuiLineChart *lc=Mui::LineChart(parent,xs,ys,290.0,140.0);
Mui::LineChartPlain(parent,xs,ys);

Events

None by default.

Common Setters

Setter Purpose
SetXY(xs[], ys[]) Replace series (arrays copied).
LineColor, FillColor, AxisColor, ThicknessPx Colours and stroke.
ShowAxes, Pad, YMarginFrac, tick/title padding helpers Axis layout.
Title, Legend, card/legend placement (same family as sparkline).
SmoothLine, ShowGrid, GridColor, GridDivisions Plot styling (Mui::LineChartGrid).
PointHoverTooltip(true) Segment/point hover tooltip (not a bus event).

Related


MuiBarChart

Purpose

Vertical bar chart for signed or unsigned values with optional positive/negative colours, axes, grid, and card chrome.

Source: Controls/Charts/BarChart.mqh.

Create It

UI build fragment
double vals[]={3,-1,5,2};
MuiBarChart *bc=Mui::BarChart(parent,vals,300.0,140.0);
Mui::BarChartPlain(parent,vals);

Events

None by default.

Common Setters

Setter Purpose
SetData(values[]) Bar heights.
PosColor, NegColor, AxisColor, BarGapPx Bar and axis colours.
Range, Pad, ShowAxes Plot scale.
ShowGrid, GridColor, GridDivisions Grid (Mui::BarChartGrid).
Title, Legend(pos, neg), card/legend helpers Chrome and dual legend labels.
PointHoverTooltip(true) Bar hover tooltip.

Related


MuiDonutChart

Purpose

Full-circle donut or pie chart with segment colours, optional center total, and side/bottom legend.

Source: Controls/Charts/DonutChart.mqh.

Create It

UI build fragment
double vals[]={40,30,20,10};
uint cols[]={0xFF3B82F6,0xFF22C55E,0xFFF59E0B,0xFFEF4444};
MuiDonutChart *d=Mui::Donut(parent,vals,cols,300.0,260.0,true);
Mui::DonutPlain(parent,vals,cols,120.0,true);
Mui::DonutEx(..., holeFrac, holeBg);

Events

None by default.

Common Setters

Setter Purpose
SetData(values[], colors[]) Segment values and colours.
SetLegendLabels(labels[]) Legend text per segment.
Donut(on), Hole(frac), HoleBg, StartAngleDeg Ring vs pie and hole styling.
InCard, Title, CardPad, CardRadius Card chrome.
ShowCenterTotal, CenterSubtitle, HoleSummary Center label block.
LegendPosition, NoLegend, LegendAtBottom/Left/Right Legend layout.
PointHoverTooltip(true) Segment hover tooltip.

Notes

  • Use non-negative values; zero slices are skipped when painting.

Related


MuiHalfGaugeChart

Purpose

Semi-circular (upper half) gauge for dashboard composition — same data model as donut charts but painted on a 180° sweep with optional center label.

Source: Controls/Charts/HalfGaugeChart.mqh.

Create It

UI build fragment
MuiHalfGaugeChart *hg=Mui::HalfGauge(parent,vals,cols,280.0,220.0,true);
Mui::HalfGaugePlain(parent,vals,cols);
Mui::HalfGaugeEx(..., holeFrac, gapRad, holeBg);

Events

None by default.

Common Setters

Setter Purpose
SetData(values[], colors[]) Segment values and colours.
SetLegendLabels(labels[]) Legend labels.
Donut, Hole, HoleBg, gap/center/legend APIs Mirror MuiDonutChart where applicable.
ShowCenterLabel, CenterLabel, CenterSubtitle, HoleSummary Hollow centre text.
PointHoverTooltip(true) Segment hit tooltip (upper semicircle only).

Notes

  • Values should be non-negative; tooltip hit-testing matches the painted upper arc only.

Related


Chart Grid Helpers

Purpose

Factory shortcuts to enable plot grids on Cartesian charts (Sparkline, BarChart, LineChart only — not donut/half-gauge).

Source: Factory/Factory.mqhMui::SparklineGrid, Mui::BarChartGrid, Mui::LineChartGrid.

Usage

UI build fragment
Mui::LineChartGrid(lc,true,0,4,4);

Each helper calls ShowGrid, GridDivisions(divH, divV), and optional GridColor when gridArgb != 0.

Events

None.

Related


Related Pages