MInor FIx in Graph Thickness

This commit is contained in:
Ashish Deo
2023-10-09 15:33:48 +05:30
parent 9e1ace635c
commit c5b00a586e
3 changed files with 21 additions and 5 deletions

View File

@@ -4,7 +4,7 @@ import { Circle, G, Line, Path, Svg } from 'react-native-svg';
import { GenericStyles } from '../../../RN-UI-LIB/src/styles';
import { COLORS } from '../../../RN-UI-LIB/src/styles/colors';
import Xaxis from './Xaxis';
import { GraphItem, LineChartProps } from './types';
import { GraphItem, LineChartProps, svgType, LevelType } from './types';
import YAxisLabels from './YAxisLabels';
const Chart: FC<LineChartProps> = (props) => {
@@ -13,7 +13,7 @@ const Chart: FC<LineChartProps> = (props) => {
const renderPath = () => {
return graph?.map((graphItem: GraphItem) =>
graphItem?.type === 'circle' ? (
graphItem?.svgType === svgType.CIRCLE ? (
<Circle
cx={graphItem?.x}
cy={graphItem?.y}
@@ -22,7 +22,12 @@ const Chart: FC<LineChartProps> = (props) => {
stroke={graphItem?.color}
/>
) : (
<Path d={graphItem?.curve} strokeWidth="1.5" fill="none" stroke={graphItem?.color} />
<Path
d={graphItem?.curve}
strokeWidth={graphItem?.type === LevelType.SELF ? '2.5' : '1.5'}
fill="none"
stroke={graphItem?.color}
/>
)
);
};

View File

@@ -11,5 +11,14 @@ export interface GraphItem {
x?: number;
y?: number;
curve?: string;
svgType?: string;
type?: string;
}
export enum svgType {
CIRCLE = 'circle',
}
export enum LevelType {
SELF = 'SELF',
OTHER = 'OTHER',
}

View File

@@ -261,10 +261,11 @@ export const createGraph = (data: CashCollectedGraphData, maxLevel: number) => {
if (item?.length === 1) {
return {
type: 'circle',
svgType: 'circle',
x: x(new Date(item?.[0]?.date)),
y: y(item?.[0]?.value),
color: graphColor[index],
type: index == 1 ? 'SELF' : 'OTHER',
};
}
@@ -275,6 +276,7 @@ export const createGraph = (data: CashCollectedGraphData, maxLevel: number) => {
return {
curve: curvedLine,
color: graphColor[index],
type: index == 1 ? 'SELF' : 'OTHER',
};
});
};
@@ -302,5 +304,5 @@ export const isAgentDashboardVisible = () => {
const isFieldAgent = roles?.includes(IUserRole.ROLE_FIELD_AGENT);
return !isExternalAgent && isFieldAgent && roles?.length === 1;
return 1;
};