一条曲线画成一片点:每一列从轴往上填到曲线,点的大小和亮度说它有多少在曲线下面(面积就是曲线下的面积);一段范围用强调色;指针扫过时一条竖线和那里的值;轴上的控制点可以拖,曲线跟着重算。
标签用等宽(像素)字。
安装
组件以源码分发。把它和它依赖的文件拷进你的项目,再按需要改:
cargo run --release --bin amenui -- add dot_chart --to ../my-app拷贝的文件: src/widgets/dot_chart.rs, src/widgets/mod.rs
用法
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)。
配方: 点阵图表