Skip to content
Snippets Groups Projects
Commit 2ae79593 authored by ali asaria's avatar ali asaria
Browse files

improve look of charts

parent f4d39bac
No related branches found
No related tags found
No related merge requests found
...@@ -2,10 +2,10 @@ import React, { useState } from 'react'; ...@@ -2,10 +2,10 @@ import React, { useState } from 'react';
import { ResponsiveLine } from '@nivo/line'; import { ResponsiveLine } from '@nivo/line';
import { ResponsiveBar } from '@nivo/bar'; import { ResponsiveBar } from '@nivo/bar';
import { ResponsiveRadar } from '@nivo/radar'; import { ResponsiveRadar } from '@nivo/radar';
import { Select, Option } from '@mui/joy'; import { Select, Option, FormControl } from '@mui/joy';
const Chart = ({ metrics }) => { const Chart = ({ metrics }) => {
const [chartType, setChartType] = useState('line'); const [chartType, setChartType] = useState('bar');
const handleChartTypeChange = (event, newValue) => { const handleChartTypeChange = (event, newValue) => {
setChartType(newValue); setChartType(newValue);
...@@ -40,13 +40,15 @@ const Chart = ({ metrics }) => { ...@@ -40,13 +40,15 @@ const Chart = ({ metrics }) => {
})); }));
return ( return (
<div> <>
<Select value={chartType} onChange={handleChartTypeChange}> <FormControl sx={{ width: 200 }}>
<Option value="line">Line</Option> <Select value={chartType} onChange={handleChartTypeChange}>
<Option value="bar">Bar</Option> <Option value="bar">Bar</Option>
<Option value="radar">Radar</Option> <Option value="line">Line</Option>
</Select> <Option value="radar">Radar</Option>
<div style={{ height: 400 }}> </Select>
</FormControl>
<div style={{ height: 400, width: '100%' }}>
{chartType === 'line' && ( {chartType === 'line' && (
<ResponsiveLine <ResponsiveLine
data={lineData} data={lineData}
...@@ -104,6 +106,8 @@ const Chart = ({ metrics }) => { ...@@ -104,6 +106,8 @@ const Chart = ({ metrics }) => {
legendPosition: 'middle', legendPosition: 'middle',
legendOffset: -40, legendOffset: -40,
}} }}
colors={{ scheme: 'nivo' }}
colorBy="indexValue"
/> />
)} )}
{chartType === 'radar' && ( {chartType === 'radar' && (
...@@ -123,10 +127,13 @@ const Chart = ({ metrics }) => { ...@@ -123,10 +127,13 @@ const Chart = ({ metrics }) => {
blendMode="multiply" blendMode="multiply"
animate={true} animate={true}
motionConfig="wobbly" motionConfig="wobbly"
enableDotLabel={true}
dotLabel="value"
dotLabelYOffset={-12}
/> />
)} )}
</div> </div>
</div> </>
); );
}; };
......
...@@ -27,6 +27,8 @@ export default function ViewPlotModal({ open, onClose, jobId, score }) { ...@@ -27,6 +27,8 @@ export default function ViewPlotModal({ open, onClose, jobId, score }) {
display: 'flex', display: 'flex',
flexDirection: 'column', flexDirection: 'column',
alignItems: 'center', alignItems: 'center',
width: '100%',
height: '100%',
}} }}
> >
<Typography level="h4" mb={2}> <Typography level="h4" mb={2}>
...@@ -35,6 +37,7 @@ export default function ViewPlotModal({ open, onClose, jobId, score }) { ...@@ -35,6 +37,7 @@ export default function ViewPlotModal({ open, onClose, jobId, score }) {
<Box <Box
sx={{ sx={{
width: '100%', width: '100%',
height: '100%',
maxWidth: '800px', maxWidth: '800px',
maxHeight: '80vh', maxHeight: '80vh',
overflowY: 'auto', overflowY: 'auto',
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment