amenui
en·中 github ↗ v0.0.1
01文档 02组件 03实验室 04作品
en·中github ↗
×

文档 / 组件 / 数据 / 点阵图表 文档 / 组件 / 数据 /

点阵图表

04.40
本页内容 ▾
  1. 安装
  2. 用法
  3. 接口
  4. 键盘与无障碍

一条曲线画成一片点:每一列从轴往上填到曲线,点的大小和亮度说它有多少在曲线下面(面积就是曲线下的面积);一段范围用强调色;指针扫过时一条竖线和那里的值;轴上的控制点可以拖,曲线跟着重算。

标签用等宽(像素)字。

由 amenui 绘制打开 ↗

安装

组件以源码分发。把它和它依赖的文件拷进你的项目,再按需要改:

sh
cargo run --release --bin amenui -- add dot_chart --to ../my-app

拷贝的文件: src/widgets/dot_chart.rs, src/widgets/mod.rs

用法

rust
use amenui::widgets::{dot_chart};

fn view() -> El<Msg> {
    let mut c = DotChart::default();
    (c.cols, c.rows, c.pitch) = (28, 10, 7.0);
    dot_chart("dc1", &c, Msg::Chart)
}

接口

函数dot_chart
参数key, chart (DotChart: knots, cols, rows, pitch, range, max, unit), msg.
文件src/widgets/dot_chart.rs
依赖base
对波前的响应nudge (a control: pushed as one piece by fronts, held and condensing at most to Look::legible_cap)
重组the value label does not recompose (it follows the pointer)

键盘与无障碍

状态rest, scrubbing (a marker and a label at the column under the pointer), dragging a control point (captured until release); focused, Left / Right move the marker, Up / Down change the control point nearest to it.
键盘与消息msg(ChartMsg) for pointer moves, drags of control points and keys; the application calls DotChart::update with it.

在网页上,每个控件都在页面里有一个带角色和名字的镜像元素,读屏软件和浏览器自己的焦点都看得到它(DESIGN.md §1.14)。

配方: 点阵图表