
##HarmonyOS Next实战##HarmonyOS SDK应用服务##教育##
DataPanel数据面板组件,用于将多个数据占比情况使用占比图进行展示。
知识点:
接口
DataPanel(options: DataPanelOptions)options:数据面板组件参数。
DataPanelOptions对象属性
组件属性
ColorStop:颜色断点类型,用于描述渐进色颜色断点。
ColorStop属性:
color:颜色值。
offset:渐变色断点(0~1之间的比例值,若数据值小于0则置为0,若数据值大于1则置为1)。说明:若传入字符串类型且内容为数字,则转换为对应的数值。例如'10vp'转换为10,'10%'转换为0.1。
DataPanelConfiguration对象属性
实战:DataPanelPage
@Entry
@Component
struct DataPanelPage {
@State value: number = 30
build() {
Column({ space: 10 }) {
Text('DataPanel占比图实战')
Row() {
Stack() {
// 单段环形数据面板
DataPanel({ values: [this.value], max: 100, type: DataPanelType.Circle }).width(168).height(168)
Text(this.value + '%').fontSize(25).fontColor('#182431')
}
.width('100%')
.margin({ right: 44 })
}
.width('100%')
.margin({ bottom: 59 })
}
.width('100%')
.height('100%')
.margin({ top: 5 })
}
}原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。