Guarantee data passed to react-native-chart-kit is not NaN
Related to #206.
This commit is contained in:
parent
4c065a027b
commit
89b62d69aa
|
@ -19,6 +19,8 @@ export default function AppLineChart({ labels, data }: ChartProps) {
|
|||
color: () => colors.primary,
|
||||
};
|
||||
|
||||
const validData = useMemo(() => data.map(d => isNaN(d) ? 0 : d), [data])
|
||||
|
||||
const pruned = useMemo(() => {
|
||||
if (labels.length < 3) return labels;
|
||||
const newPruned = [labels[0]];
|
||||
|
@ -39,7 +41,7 @@ export default function AppLineChart({ labels, data }: ChartProps) {
|
|||
labels: pruned,
|
||||
datasets: [
|
||||
{
|
||||
data,
|
||||
data: validData,
|
||||
},
|
||||
],
|
||||
}}
|
||||
|
|
|
@ -23,7 +23,7 @@ export default function AppPieChart({ options }: { options: Option[] }) {
|
|||
|
||||
const data = options.map((option, index) => ({
|
||||
name: option.label,
|
||||
value: option.value,
|
||||
value: isNaN(option.value) ? 0 : option.value,
|
||||
color: pieChartColors[index],
|
||||
legendFontColor: colors.onSurface,
|
||||
legendFontSize: 15,
|
||||
|
|
|
@ -85,8 +85,8 @@ android {
|
|||
applicationId "com.massive"
|
||||
minSdkVersion rootProject.ext.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.targetSdkVersion
|
||||
versionCode 36230
|
||||
versionName "2.15"
|
||||
versionCode 36231
|
||||
versionName "2.16"
|
||||
}
|
||||
signingConfigs {
|
||||
release {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "massive",
|
||||
"version": "2.15",
|
||||
"version": "2.16",
|
||||
"private": true,
|
||||
"license": "GPL-3.0-only",
|
||||
"scripts": {
|
||||
|
|
Loading…
Reference in New Issue