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

make sure legend shows up

parent 08305a08
No related branches found
No related tags found
No related merge requests found
...@@ -92,8 +92,15 @@ const Chart = ({ metrics, compareChart }) => { ...@@ -92,8 +92,15 @@ const Chart = ({ metrics, compareChart }) => {
}; };
return ( return (
<> <Box sx={{ border: '1px solid #e0e0e0', borderRadius: 8, p: 2 }}>
<Box sx={{ display: 'flex', gap: 2, mb: 2, alignItems: 'center' }}> <Box
sx={{
display: 'flex',
gap: 2,
mb: 2,
alignItems: 'center',
}}
>
<FormControl sx={{ width: 200 }}> <FormControl sx={{ width: 200 }}>
<Select value={chartType} onChange={handleChartTypeChange}> <Select value={chartType} onChange={handleChartTypeChange}>
<Option value="bar">Bar</Option> <Option value="bar">Bar</Option>
...@@ -117,7 +124,7 @@ const Chart = ({ metrics, compareChart }) => { ...@@ -117,7 +124,7 @@ const Chart = ({ metrics, compareChart }) => {
{chartType === 'line' && ( {chartType === 'line' && (
<ResponsiveLine <ResponsiveLine
data={getChartData()} data={getChartData()}
margin={{ top: 50, right: 110, bottom: 50, left: 60 }} margin={{ top: 50, right: 200, bottom: 80, left: 60 }}
xScale={{ type: 'point' }} xScale={{ type: 'point' }}
yScale={{ yScale={{
type: 'linear', type: 'linear',
...@@ -150,7 +157,7 @@ const Chart = ({ metrics, compareChart }) => { ...@@ -150,7 +157,7 @@ const Chart = ({ metrics, compareChart }) => {
pointBorderColor={{ from: 'serieColor' }} pointBorderColor={{ from: 'serieColor' }}
legends={[ legends={[
{ {
anchor: 'bottom-right', anchor: 'top-right',
direction: 'column', direction: 'column',
justify: false, justify: false,
translateX: 100, translateX: 100,
...@@ -223,12 +230,12 @@ const Chart = ({ metrics, compareChart }) => { ...@@ -223,12 +230,12 @@ const Chart = ({ metrics, compareChart }) => {
dotLabel="value" dotLabel="value"
dotLabelYOffset={-12} dotLabelYOffset={-12}
legends={ legends={
normalizedData.seriesKeys.length > 1 normalizedData.seriesKeys.length > 0
? [ ? [
{ {
anchor: 'right', anchor: 'top-right',
direction: 'column', direction: 'column',
translateX: 50, translateX: -200,
translateY: 0, translateY: 0,
itemWidth: 120, itemWidth: 120,
itemHeight: 20, itemHeight: 20,
...@@ -250,7 +257,7 @@ const Chart = ({ metrics, compareChart }) => { ...@@ -250,7 +257,7 @@ const Chart = ({ metrics, compareChart }) => {
/> />
)} )}
</div> </div>
</> </Box>
); );
}; };
......
...@@ -35,9 +35,6 @@ export default function ViewPlotModal({ ...@@ -35,9 +35,6 @@ export default function ViewPlotModal({
height: '100%', height: '100%',
}} }}
> >
<Typography level="h4" mb={2}>
Chart
</Typography>
<Box <Box
sx={{ sx={{
width: '100%', width: '100%',
...@@ -48,6 +45,9 @@ export default function ViewPlotModal({ ...@@ -48,6 +45,9 @@ export default function ViewPlotModal({
borderRadius: '8px', borderRadius: '8px',
boxShadow: 1, boxShadow: 1,
p: 2, p: 2,
display: 'flex',
flexDirection: 'column',
justifyContent: 'center',
}} }}
> >
<Chart metrics={parseJSON(data)} compareChart={compareChart} /> <Chart metrics={parseJSON(data)} compareChart={compareChart} />
......
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