# Polyline
折线绘制组件。
## 子组件
无
## 接口
Polyline\(options?: \{width: Lenght, height: Length\}\)
- 参数
- options参数说明
参数名
|
参数类型
|
必填
|
默认值
|
参数描述
|
width
|
Length
|
是
|
-
|
宽度。
|
height
|
Length
|
是
|
-
|
高度。
|
## 属性
参数名称
|
参数类型
|
默认值
|
必填
|
参数描述
|
width
|
Length
|
0
|
否
|
折线所在矩形的宽度。
|
height
|
Length
|
0
|
否
|
折线所在矩形的高度。
|
points
|
Array<Point>
|
-
|
是
|
折线经过坐标点列表。
|
## 示例
```
@Entry
@Component
struct PolylineExample {
build() {
Column({ space: 5 }) {
Flex({ justifyContent: FlexAlign.SpaceAround }) {
// 在 100 * 100 的矩形框中绘制一段折线,起点(0, 0),经过(20,60),到达终点(100, 100)
Polyline({ width: 100, height: 100 }).points([[0, 0], [20, 60], [100, 100]])
// 在 100 * 100 的矩形框中绘制一段折线,起点(0, 0),经过(0,100),到达终点(100, 100)
Polyline().width(100).height(100).points([[0, 0], [0, 100], [100, 100]])
}.width('100%')
}.margin({ top: 5 })
}
}
```
