Mafs is a React library. 它可以通过声明式语句构建交互式的数学的可视化应用。
安装
npm install --save mafs
组件
Mafs 该组件呈现可视化的入口,所有其他的可视化组件是它的子节点。它渲染一个空的canvas。它支持width、height、pan、zoom、viewBox、preserveAspectRatio、onClick、ssr属性。
Coordinates 该组件是覆盖在Mafs canvas上的网格线(a grid of lines),用来可视化尺度,可以理解为坐标轴。坐标轴支持配置,支持xAxis、yAxis、subdivisions、lines属性。常见的坐标系是笛卡尔坐标系(Cartesian coordinates), 极坐标系(Polar coordinates)
Points 点,通过location (x,y)绘制在画布上,支持属性x、y、color、opacity、svgCircleProps等属性。
Line 线多个表示形式,分别是线段(Line segment)、两点连线(Line throuth two points)、点和斜率(Point and slope),点和角度(Point and angle),支持point1、point2、point、angle、slope、color、opacity、weight、style、等属性。
Polygons 多边形与折线,支持的属性svgPolygonProps、points、color、weight、fillOpacity、strokeOpacity、strokeStyle等属性
Circle 圆,支持属性center、radius、svgEllipseProps、color、weight、fillOpacity、strokeOpacity、strokeStyle等属性
Ellipses 椭圆,支持属性center、radius、angle、svgEllipseProps、color、weight、fillOpacity、strokeOpacity、strokeStyle等属性
Plots Mafs提供的完整的图形,图形函数主要有:Functions of x and y、 Inequalityies of x and y、Parametric functions、Vector fields
Text 标签
Vectors 向量,有方向和大小的箭头