2021-01-21 16:09:23 +01:00
|
|
|
import React from 'react';
|
|
|
|
|
|
|
|
|
|
import Placeholder from '../../../components/placeholder/Placeholder';
|
2025-09-03 09:45:09 +02:00
|
|
|
import { VChart } from '@visactor/react-vchart';
|
2021-01-21 16:09:23 +01:00
|
|
|
|
|
|
|
|
import './Linechart.less';
|
|
|
|
|
|
2025-09-03 09:45:09 +02:00
|
|
|
const commonSpec = {
|
|
|
|
|
type: 'line',
|
|
|
|
|
xField: 'listings',
|
|
|
|
|
yField: 'listingsNumber',
|
|
|
|
|
seriesField: 'provider',
|
|
|
|
|
legends: { visible: true },
|
2021-01-21 16:09:23 +01:00
|
|
|
};
|
|
|
|
|
|
2025-09-03 09:45:09 +02:00
|
|
|
const Linechart = function Linechart({ title, series, isLoading = false }) {
|
2021-01-21 16:09:23 +01:00
|
|
|
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' }}
|
|
|
|
|
/>
|
2021-01-21 16:09:23 +01:00
|
|
|
)}
|
|
|
|
|
</Placeholder>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default Linechart;
|