Skip to content
Snippets Groups Projects
Commit eac3333c authored by deep1401's avatar deep1401
Browse files

Change plotting approach for Radarchart to avoid plotting multiple Radarcharts on top of each other

parent 9776af4c
No related branches found
No related tags found
No related merge requests found
...@@ -159,65 +159,60 @@ const Chart = ({ metrics, compareChart }) => { ...@@ -159,65 +159,60 @@ const Chart = ({ metrics, compareChart }) => {
/> />
)} )}
{chartType === 'radar' && compareChart && ( {chartType === 'radar' && compareChart && (
<div style={{ position: 'relative', height: '100%', width: '100%' }}> <ResponsiveRadar
{Array.from(new Set(metrics.map(m => `${m.evaluator}-${m.job_id}`))).map((series, index) => { data={(() => {
// Filter radar data for this specific evaluator-job combination // Group metrics by type
const seriesRadarData = metrics const metricsGroupedByType = {};
.filter(m => `${m.evaluator}-${m.job_id}` === series) metrics.forEach(metric => {
.map(metric => ({ const { type, evaluator, job_id, score } = metric;
metric: metric.type, const seriesKey = `${evaluator}-${job_id}`;
score: metric.score
})); if (!metricsGroupedByType[type]) {
metricsGroupedByType[type] = { metric: type };
}
return ( metricsGroupedByType[type][seriesKey] = score;
<div key={series} style={{ position: 'absolute', top: 0, left: 0, right: 0, bottom: 0 }}> });
<ResponsiveRadar return Object.values(metricsGroupedByType);
data={seriesRadarData} })()}
keys={['score']} keys={Array.from(new Set(metrics.map(m => `${m.evaluator}-${m.job_id}`)))}
indexBy="metric" indexBy="metric"
margin={{ top: 70, right: 80, bottom: 40, left: 80 }} margin={{ top: 70, right: 170, bottom: 40, left: 80 }}
gridShape="circular" borderColor={{ from: 'color' }}
gridLabelOffset={36} gridShape="circular"
dotSize={10} gridLabelOffset={36}
dotColor={{ from: 'color' }} dotSize={10}
dotBorderWidth={2} dotColor={{ theme: 'background' }}
dotBorderColor={{ from: 'color' }} dotBorderWidth={2}
colors={[`hsl(${index * 30 + 60}, 70%, 50%)`]} // Different color for each series colors={{ scheme: 'nivo' }}
fillOpacity={0.2} fillOpacity={0.25}
blendMode="normal" blendMode="multiply"
animate={true} animate={true}
motionConfig="wobbly" motionConfig="wobbly"
enableDotLabel={true} enableDotLabel={true}
dotLabel="value" dotLabel="value"
dotLabelYOffset={-12} dotLabelYOffset={-12}
legends={[ legends={[
{ {
anchor: 'top-right', anchor: 'right',
direction: 'column', direction: 'column',
translateX: 0, translateX: 50,
translateY: -40, translateY: 0,
itemWidth: 80, itemWidth: 120,
itemHeight: 20, itemHeight: 20,
itemTextColor: '#999', itemTextColor: '#999',
symbolSize: 12, symbolSize: 12,
symbolShape: 'circle', symbolShape: 'circle',
effects: [ effects: [
{ {
on: 'hover', on: 'hover',
style: { style: {
itemTextColor: '#000' itemTextColor: '#000'
} }
} }
], ]
data: [{ id: series, label: series, color: `hsl(${index * 30 + 60}, 70%, 50%)` }] }
} ]}
]} />
/>
</div>
);
})}
</div>
)} )}
{chartType === 'radar' && !compareChart && ( {chartType === 'radar' && !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