WebSite X5Help Center

 
Josef D.
Josef D.
User

How to display the chart python code?  en

Autor: Josef D.
Visitado 100, Followers 1, Compartido 0  

I need to display active charts ( the code is in python). What is the way to display it? Converting it to html is not good. Is there any possibility?

Thank you

Code

importReactfrom'react';import{Card,CardContent,CardHeader,CardTitle}from"@/components/ui/card";import{LineChart,Line,XAxis,YAxis,CartesianGrid,Tooltip,ResponsiveContainer}from'recharts';constInflationChart=()=>{const data =[{ month:'2024-01', rate:3.1},{ month:'2023-12', rate:3.4},{ month:'2023-11', rate:3.1},{ month:'2023-10', rate:3.2},{ month:'2023-09', rate:3.7},{ month:'2023-08', rate:3.7},{ month:'2023-07', rate:3.2},{ month:'2023-06', rate:3.0},{ month:'2023-05', rate:4.0},{ month:'2023-04', rate:4.9},{ month:'2023-03', rate:5.0},{ month:'2023-02', rate:6.0}];return(<CardclassName="w-full max-w-4xl"><CardHeader><CardTitle>Míra inflace USD (v %)</CardTitle></CardHeader><CardContent><divclassName="h-80 w-full"><ResponsiveContainerwidth="100%"height="100%"><LineChartdata={data}margin={{ top:5, right:30, left:20, bottom:5}}><CartesianGridstrokeDasharray="3 3"/><XAxisdataKey="month"tickFormatter={(value)=>{const date =newDate(value);return date.toLocaleDateString('cs-CZ',{ month:'short', year:'2-digit'});}}/><YAxisdomain={[0,'auto']}/><Tooltipformatter={(value)=>[`${value}%`,'Inflace']}labelFormatter={(label)=>{const date =newDate(label);return date.toLocaleDateString('cs-CZ',{ month:'long', year:'numeric'});}}/><Linetype="monotone"dataKey="rate"stroke="#2563eb"strokeWidth={2}dot={{ fill:'#2563eb'}}/></LineChart></ResponsiveContainer></div></CardContent></Card>);};exportdefaultInflationChart;

Publicado en
1 RESPUESTAS