nativescript - 当一个值为总值的 100% 时,PieSeries 仅显示细线而不是完整的切片颜色
问题描述
我遇到了 RadPieChart 和 PieSeries 的奇怪行为。
当一个值代表总数的 100% 时,PieSeries 仅显示一条细线。
编辑:这里是 Playground 演示的链接,如果您想在您的设备上试用它 - https://play.nativescript.org/?template=play-ng&id=ZxmuR5&v=2
或者如果你想在你的设备上测试它,你可以使用我的 github 项目的这个链接:https ://github.com/VukMNE/PieSeriesMalfunction
如果我的描述不清楚,下面是图片来说明我面临的问题。第一张图片显示了 PieSeries 的常规行为,第二张图片显示了有问题的行为。
Bellow 是在我的应用程序中正常工作的普通饼图示例。有两个切片,它们都充满了颜色。
但是如果一个值等于总量,而不是显示一个充满颜色的切片,它只显示一条细线。
两个图表的代码是相同的。这些图表是动态的,它们根据用户的参数显示不同的数据。但是,下面是两个图表的代码。
<RadPieChart *ngIf="!noDataFound" tkExampleTitle tkToggleNavButton minHeight="200" allowAnimation="true" row="0">
<PieSeries tkPieSeries
seriesName="collectPie"
selectionMode="None"
expandRadius="0.4"
outerRadiusFactor="0.7"
valueProperty="amountCollected"
legendLabel="nameForLabel"
showLabels="true"
showPercentage="false"
[items]="pieSourceCollected">
<PointLabelStyle tkPieLabelStyle margin="15" textFormat="%.2f €"></PointLabelStyle>
</PieSeries>
<Palette tkPiePalette seriesName="collectPie">
<PaletteEntry tkPiePaletteEntry fillColor="#1B998B" strokeColor="#1B998B"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#97C8EB" strokeColor="#97C8EB"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#001F54" strokeColor="#001F54"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#2B193D" strokeColor="#2B193D"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#484D6D" strokeColor="#484D6D"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#2C365E" strokeColor="#2C365E"></PaletteEntry>
</Palette>
<RadLegendView tkPieLegend position="Top" width="100%"></RadLegendView>
</RadPieChart>
第二张图表的代码:
<RadPieChart *ngIf="!noDataFound" tkExampleTitle tkToggleNavButton minHeight="200" allowAnimation="true" row="0">
<PieSeries tkPieSeries
seriesName="collectPie"
selectionMode="None"
expandRadius="0.4"
outerRadiusFactor="0.7"
valueProperty="amountSpent"
legendLabel="nameForLabel"
showLabels="true"
showPercentage="false"
[items]="pieSourceSpent">
<PointLabelStyle tkPieLabelStyle margin="15" textFormat="%.2f €"></PointLabelStyle>
</PieSeries>
<Palette tkPiePalette seriesName="collectPie">
<PaletteEntry tkPiePaletteEntry fillColor="#1B998B" strokeColor="#1B998B"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#97C8EB" strokeColor="#97C8EB"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#001F54" strokeColor="#001F54"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#2B193D" strokeColor="#2B193D"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#484D6D" strokeColor="#484D6D"></PaletteEntry>
<PaletteEntry tkPiePaletteEntry fillColor="#2C365E" strokeColor="#2C365E"></PaletteEntry>
</Palette>
<RadLegendView tkPieLegend position="Top" width="100%"></RadLegendView>
</RadPieChart>
我什至尝试通过删除等于零的值来过滤图表的数据源,但错误仍然存在。它应该显示一个完整的馅饼,而不是这条细线,不是吗?
解决方案
推荐阅读
- python - 部署 Python 脚本 PyInstaller 和 Flask
- python - pip:卸载一个 disutils 安装的包
- ruby-on-rails - 如何查询 PostgreSQL jsonb 数组
- smartsheet-api - 智能工作表 API - 替换工作表?
- javascript - 如何修复 codacy 警报“通用对象注入接收器”
- rx-java2 - RxJava2 | 使用 .andThen() 链接嵌套的 Completables
- java - 使用 XSL javax.xml.transform.TransformerException 创建 PDF 时出错:org.xml.sax.SAXException
- angularjs - 当对象分配了多个 json 对象时无法过滤
- ios - 为什么没有任何东西发送到我的表格视图?
- linux - 在 Linux 上运行 DialogFlow 查询