차트 chartTitle properties 추가(빈칸이 아니면 차트제목 영역나오도록 추가)
This commit is contained in:
@@ -12,9 +12,12 @@ import {
|
||||
} from "./lib/chart";
|
||||
import { Bar, BarChart, CartesianGrid, XAxis } from "recharts";
|
||||
|
||||
export default function Chart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; }) {
|
||||
export default function Chart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; chartTitle: string}) {
|
||||
return (
|
||||
<Card>
|
||||
{props.chartTitle && props.chartTitle !== "" && props.chartTitle !== "undefined" ? (
|
||||
<div style={{ textAlign: "left", fontSize: "13px", fontWeight: "bold", marginTop:"13px", marginBottom: "10px" }}>
|
||||
</div>): null}
|
||||
<CardContent>
|
||||
<ChartContainer config={props.chartConfig}>
|
||||
<BarChart accessibilityLayer data={props.chartData}>
|
||||
|
||||
@@ -15,9 +15,12 @@ import {
|
||||
import type { CSSProperties } from "react";
|
||||
|
||||
// eslint-disable-next-line react-refresh/only-export-components
|
||||
export default (props: { chartConfig: ChartConfig; chartData: never[] | undefined; }) =>{
|
||||
export default (props: { chartConfig: ChartConfig; chartData: never[] | undefined; chartTitle:string}) =>{
|
||||
return (
|
||||
<Card className="flex flex-col">
|
||||
{props.chartTitle && props.chartTitle !== "" && props.chartTitle !== "undefined" ? (
|
||||
<div style={{ textAlign: "left", fontSize: "13px", fontWeight: "bold", marginTop:"13px", marginBottom: "10px" }}>
|
||||
</div>): null}
|
||||
<CardContent className="flex-1 pb-0">
|
||||
<ChartContainer
|
||||
config={props.chartConfig}
|
||||
|
||||
@@ -75,10 +75,13 @@ const CustomLegend = (props: any) => {
|
||||
);
|
||||
};
|
||||
|
||||
export default function LineBarchart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; }) {
|
||||
export default function LineBarchart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; chartTitle:string }) {
|
||||
return (
|
||||
<Card>
|
||||
<CardContent>
|
||||
{props.chartTitle && props.chartTitle !== "" && props.chartTitle !== "undefined" ? (
|
||||
<div style={{ textAlign: "left", fontSize: "13px", fontWeight: "bold", marginTop:"13px", marginBottom: "10px" }}>
|
||||
</div>): null}
|
||||
<ChartContainer config={props.chartConfig}>
|
||||
<ComposedChart data={props.chartData}>
|
||||
<CartesianGrid strokeDasharray="3 3" />
|
||||
|
||||
@@ -12,9 +12,12 @@ import {
|
||||
} from "./lib/chart";
|
||||
import { CartesianGrid, Line, LineChart, XAxis } from "recharts";
|
||||
|
||||
export default function Linechart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; }) {
|
||||
export default function Linechart(props: { chartConfig: ChartConfig; chartData: any[] | undefined; chartTitle:string}) {
|
||||
return (
|
||||
<Card>
|
||||
{props.chartTitle && props.chartTitle !== "" && props.chartTitle !== "undefined" ? (
|
||||
<div style={{ textAlign: "left", fontSize: "13px", fontWeight: "bold", marginTop:"13px", marginBottom: "10px" }}>
|
||||
</div>): null}
|
||||
<CardContent>
|
||||
<ChartContainer config={props.chartConfig}>
|
||||
<LineChart
|
||||
|
||||
@@ -18,32 +18,32 @@ const CHART_FORM = {
|
||||
LINEBAR : 'linebar'
|
||||
};
|
||||
|
||||
function MainChart(props: { chartForm: string; chartConfig: any; chartData: any; }) {
|
||||
function MainChart(props: { chartForm: string; chartConfig: any; chartData: any; chartTitle:string; }) {
|
||||
if( props.chartForm == CHART_FORM.BAR ){
|
||||
return (
|
||||
<div>
|
||||
<BarChart chartConfig={props.chartConfig} chartStyle={styles.divHeight} chartData={props.chartData}>
|
||||
<BarChart chartConfig={props.chartConfig} chartData={props.chartData} chartTitle={props.chartTitle}>
|
||||
</BarChart>
|
||||
</div>
|
||||
);
|
||||
} else if( props.chartForm == CHART_FORM.LINE ){
|
||||
return (
|
||||
<div>
|
||||
<LineChart chartConfig={props.chartConfig} chartData={props.chartData}>
|
||||
<LineChart chartConfig={props.chartConfig} chartData={props.chartData} chartTitle={props.chartTitle}>
|
||||
</LineChart>
|
||||
</div>
|
||||
);
|
||||
} else if( props.chartForm == CHART_FORM.DN ){
|
||||
return (
|
||||
<div>
|
||||
<DoughnutChart chartConfig={props.chartConfig} chartData={props.chartData}>
|
||||
<DoughnutChart chartConfig={props.chartConfig} chartData={props.chartData} chartTitle={props.chartTitle}>
|
||||
</DoughnutChart>
|
||||
</div>
|
||||
);
|
||||
} else if (props.chartForm == CHART_FORM.LINEBAR){
|
||||
return (
|
||||
<div className='w-100'>
|
||||
<LineBarchart chartConfig={props.chartConfig} chartData={props.chartData}>
|
||||
<LineBarchart chartConfig={props.chartConfig} chartData={props.chartData} chartTitle={props.chartTitle}>
|
||||
</LineBarchart>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user