Rename Chart -> AppLineChart

Chart is too generic since several types of charts exist
in the react-native-chart-kit.
This commit is contained in:
Brandon Presley 2024-02-09 12:56:43 +13:00
parent 9c3d6772a9
commit 4c065a027b
4 changed files with 8 additions and 8 deletions

View File

@ -9,7 +9,7 @@ interface ChartProps {
data: number[];
}
export default function Chart({ labels, data }: ChartProps) {
export default function AppLineChart({ labels, data }: ChartProps) {
const { width } = useWindowDimensions();
const { colors } = useTheme();

View File

@ -3,7 +3,7 @@ import { useCallback, useState } from "react";
import { ActivityIndicator, ScrollView, View } from "react-native";
import { IconButton, Text } from "react-native-paper";
import AppPieChart from "./AppPieChart";
import Chart from "./Chart";
import AppLineChart from "./AppLineChart";
import ConfirmDialog from "./ConfirmDialog";
import { MARGIN, PADDING } from "./constants";
import { AppDataSource } from "./data-source";
@ -180,7 +180,7 @@ export default function InsightsPage() {
{loadingHours ? (
<ActivityIndicator />
) : (
<Chart
<AppLineChart
data={hourCounts.map((hc) => hc.count)}
labels={hourCounts.map((hc) => hourLabel(hc.hour))}
/>

View File

@ -7,7 +7,7 @@ import { IconButton, List } from "react-native-paper";
import Share from "react-native-share";
import { captureScreen } from "react-native-view-shot";
import { StackParams } from "./AppStack";
import Chart from "./Chart";
import AppLineChart from "./AppLineChart";
import Select from "./Select";
import StackHeader from "./StackHeader";
import { PADDING } from "./constants";
@ -98,7 +98,7 @@ export default function ViewGraph() {
if (weights.length === 0) return <List.Item title="No data yet." />;
return (
<Chart
<AppLineChart
data={weights.map((set) => set.weight)}
labels={weights.map((set) =>
format(new Date(set.created), "yyyy-MM-d")
@ -112,7 +112,7 @@ export default function ViewGraph() {
if (volumes.length === 0) return <List.Item title="No data yet." />;
return (
<Chart
<AppLineChart
data={volumes.map((volume) => volume.value)}
labels={volumes.map((volume) =>
format(new Date(volume.created), "yyyy-MM-d")

View File

@ -5,7 +5,7 @@ import { FileSystem } from "react-native-file-access";
import { IconButton, List } from "react-native-paper";
import Share from "react-native-share";
import { captureScreen } from "react-native-view-shot";
import Chart from "./Chart";
import AppLineChart from "./AppLineChart";
import { PADDING } from "./constants";
import { weightRepo } from "./db";
import { Periods } from "./periods";
@ -48,7 +48,7 @@ export default function ViewWeightGraph() {
}
return (
<Chart
<AppLineChart
data={weights.map((set) => set.value)}
labels={weights.map((weight) =>
format(new Date(weight.created), "yyyy-MM-d")