Files
fredy/ui/src/views/jobs/insights/Linechart.jsx

39 lines
931 B
React
Raw Normal View History

import React from 'react';
import Placeholder from '../../../components/placeholder/Placeholder';
2025-09-03 09:45:09 +02:00
import { VChart } from '@visactor/react-vchart';
import './Linechart.less';
2025-09-03 09:45:09 +02:00
const commonSpec = {
type: 'line',
xField: 'listings',
yField: 'listingsNumber',
seriesField: 'provider',
legends: { visible: true },
};
2025-09-03 09:45:09 +02:00
const Linechart = function Linechart({ title, series, isLoading = false }) {
return (
<Placeholder ready={!isLoading} rows={6}>
{series == null || series.length === 0 ? (
<div className="linechart__no__data">No Data for selected timeframe :-/</div>
) : (
2025-09-03 09:45:09 +02:00
<VChart
spec={{
...commonSpec,
title: {
visible: true,
text: title,
},
data: { values: series },
}}
option={{ mode: 'desktop-browser' }}
/>
)}
</Placeholder>
);
};
export default Linechart;