RMGui 0.15.0
C11 retained-mode UI library: layout kernel, style schema, widget painters, fonts, software framebuffer
Loading...
Searching...
No Matches
chart_spark.h File Reference

chart_spark.h — the sparkline: a whole-series plot with no axes, no hit test and no view; the painter fits the window to the data. More...

#include <stddef.h>
#include <stdint.h>
#include "fb.h"
#include "geom.h"
#include "style.h"
#include "chart_series.h"
#include "draw_target.h"
#include "ui_context.h"

Data Structures

struct  rmgui_chart_spark_view_t
 An auto-fitted sparkline borrowing a live series. More...

Functions

void rmgui_chart_spark_paint (rmgui_fb_t *fb, rmgui_rect_t rect, rmgui_rect_t clip, const rmgui_style_resolved_t *rs, const rmgui_chart_series_t *series, int series_index, int filled)
 Paints the whole series across rect with rs->series[series_index] at 1 px: filled != 0 fills under the line first (the RMGUI_CHART_PLOT_AREA contract of chart_plot.h), filled == 0 paints the line only.
void rmgui_chart_spark_paint_to (rmgui_target_t *, rmgui_rect_t, rmgui_rect_t, const rmgui_style_resolved_t *, const rmgui_chart_series_t *, int, int)
 Explicit destination sparkline with the CPU automatic view fit.
int rmgui_chart_spark_draw (const rmgui_ui_t *ui, const rmgui_chart_spark_view_t *spark, rmgui_rect_t rect)
 Draw the sparkline.

Detailed Description

chart_spark.h — the sparkline: a whole-series plot with no axes, no hit test and no view; the painter fits the window to the data.

Function Documentation

◆ rmgui_chart_spark_paint()

void rmgui_chart_spark_paint ( rmgui_fb_t * fb,
rmgui_rect_t rect,
rmgui_rect_t clip,
const rmgui_style_resolved_t * rs,
const rmgui_chart_series_t * series,
int series_index,
int filled )

Paints the whole series across rect with rs->series[series_index] at 1 px: filled != 0 fills under the line first (the RMGUI_CHART_PLOT_AREA contract of chart_plot.h), filled == 0 paints the line only.

The mapping is the suite rule with the view fitted to the data: t0/t1 are the first and last sample's t, v0/v1 the series min and max, so the polyline spans the full rect. NULL fb, rs or series, an empty rect, series_index outside 0..5, or a series with fewer than two distinct timestamps or two distinct values (nothing to fit) paints nothing.

◆ rmgui_chart_spark_paint_to()

void rmgui_chart_spark_paint_to ( rmgui_target_t * ,
rmgui_rect_t ,
rmgui_rect_t ,
const rmgui_style_resolved_t * ,
const rmgui_chart_series_t * ,
int ,
int  )

Explicit destination sparkline with the CPU automatic view fit.

RECORD emits bounded plot commands without allocation; failures latch.

◆ rmgui_chart_spark_draw()

int rmgui_chart_spark_draw ( const rmgui_ui_t * ui,
const rmgui_chart_spark_view_t * spark,
rmgui_rect_t rect )

Draw the sparkline.

Returns 0 or -1 for invalid arguments or style; paint errors are reported by the target.