-
-
Notifications
You must be signed in to change notification settings - Fork 740
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Data placeholders on UsersChart and FlagsChart components
- Loading branch information
Showing
6 changed files
with
188 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
frontend/src/component/executiveDashboard/LineChart/LineChart.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,45 @@ | ||
import { lazy } from 'react'; | ||
import { type ScriptableContext } from 'chart.js'; | ||
import { Typography } from '@mui/material'; | ||
|
||
export const LineChart = lazy(() => import('./LineChartComponent')); | ||
|
||
export const fillGradient = | ||
(a: string, b: string) => (context: ScriptableContext<'line'>) => { | ||
const chart = context.chart; | ||
const { ctx, chartArea } = chart; | ||
if (!chartArea) { | ||
return; | ||
} | ||
const gradient = ctx.createLinearGradient( | ||
0, | ||
chartArea.bottom, | ||
0, | ||
chartArea.top, | ||
); | ||
gradient.addColorStop(0, a); | ||
gradient.addColorStop(1, b); | ||
return gradient; | ||
}; | ||
|
||
export const fillGradientPrimary = fillGradient( | ||
'rgba(129, 122, 254, 0)', | ||
'rgba(129, 122, 254, 0.12)', | ||
); | ||
|
||
export const NotEnoughData = () => ( | ||
<> | ||
<Typography | ||
variant='body1' | ||
component='h4' | ||
sx={(theme) => ({ | ||
paddingBottom: theme.spacing(1), | ||
})} | ||
> | ||
Not enough data | ||
</Typography> | ||
<Typography variant='body2'> | ||
Two or more weeks of data are needed to show a chart. | ||
</Typography> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters