Review polar plot scaling, make tabbing dependent on config

- remove polar min data
This commit is contained in:
Christoph Kluge
2026-01-16 14:14:41 +01:00
parent b81d9b05ac
commit b912be5978
4 changed files with 57 additions and 36 deletions

View File

@@ -5,7 +5,7 @@
- `polarMetrics [Object]?`: Metric names and scaled peak values for rendering polar plot [Default: [] ] - `polarMetrics [Object]?`: Metric names and scaled peak values for rendering polar plot [Default: [] ]
- `polarData [GraphQL.JobMetricStatWithName]?`: Metric data [Default: null] - `polarData [GraphQL.JobMetricStatWithName]?`: Metric data [Default: null]
- `canvasId String?`: Unique ID for correct parallel chart.js rendering [Default: "polar-default"] - `canvasId String?`: Unique ID for correct parallel chart.js rendering [Default: "polar-default"]
- `height Number?`: Plot height [Default: 365] - `showLegend Bool?`: Legend Display [Default: true]
--> -->
<script> <script>
@@ -38,22 +38,28 @@
polarMetrics = [], polarMetrics = [],
polarData = [], polarData = [],
canvasId = "polar-default", canvasId = "polar-default",
height = 350, size = 375,
showLegend = true,
} = $props(); } = $props();
/* Const Init */ /* Derived */
const options = { const options = $derived({
maintainAspectRatio: true, responsive: true, // Default
maintainAspectRatio: true, // Default
animation: false, animation: false,
scales: { // fix scale scales: { // fix scale
r: { r: {
suggestedMin: 0.0, suggestedMin: 0.0,
suggestedMax: 1.0 suggestedMax: 1.0
} }
},
plugins: {
legend: {
display: showLegend
}
} }
} })
/* Derived */
const labels = $derived(polarMetrics const labels = $derived(polarMetrics
.filter((m) => (m.peak != null)) .filter((m) => (m.peak != null))
.map(pm => pm.name) .map(pm => pm.name)
@@ -77,7 +83,7 @@
{ {
label: 'Avg', label: 'Avg',
data: loadData('avg'), // Node Scope Only data: loadData('avg'), // Node Scope Only
fill: 2, fill: true, // fill: 2 if min active
backgroundColor: 'rgba(255, 210, 0, 0.25)', backgroundColor: 'rgba(255, 210, 0, 0.25)',
borderColor: 'rgb(255, 210, 0)', borderColor: 'rgb(255, 210, 0)',
pointBackgroundColor: 'rgb(255, 210, 0)', pointBackgroundColor: 'rgb(255, 210, 0)',
@@ -85,17 +91,17 @@
pointHoverBackgroundColor: '#fff', pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(255, 210, 0)' pointHoverBorderColor: 'rgb(255, 210, 0)'
}, },
{ // {
label: 'Min', // label: 'Min',
data: loadData('min'), // Node Scope Only // data: loadData('min'), // Node Scope Only
fill: true, // fill: true,
backgroundColor: 'rgba(255, 0, 0, 0.25)', // backgroundColor: 'rgba(255, 0, 0, 0.25)',
borderColor: 'rgb(255, 0, 0)', // borderColor: 'rgb(255, 0, 0)',
pointBackgroundColor: 'rgb(255, 0, 0)', // pointBackgroundColor: 'rgb(255, 0, 0)',
pointBorderColor: '#fff', // pointBorderColor: '#fff',
pointHoverBackgroundColor: '#fff', // pointHoverBackgroundColor: '#fff',
pointHoverBorderColor: 'rgb(255, 0, 0)' // pointHoverBorderColor: 'rgb(255, 0, 0)'
} // }
] ]
}); });
@@ -127,15 +133,14 @@
{ {
type: 'radar', type: 'radar',
data: data, data: data,
options: options, options: options
height: height
} }
); );
}); });
</script> </script>
<!-- <div style="width: 500px;"><canvas id="dimensions"></canvas></div><br/> --> <!-- <div style="width: 500px;"><canvas id="dimensions"></canvas></div><br/> -->
<div class="chart-container"> <div class="chart-container d-flex justify-content-center" style="--container-width: {size}px; --container-height: {size}px">
<canvas id={canvasId}></canvas> <canvas id={canvasId}></canvas>
</div> </div>
@@ -143,5 +148,7 @@
.chart-container { .chart-container {
margin: auto; margin: auto;
position: relative; position: relative;
height: var(--container-height);
width: var(--container-width);
} }
</style> </style>

View File

@@ -29,19 +29,30 @@
const showPolarTab = !!getContext("cc-config")[`jobView_showPolarPlot`]; const showPolarTab = !!getContext("cc-config")[`jobView_showPolarPlot`];
</script> </script>
<Card class="overflow-auto" style="width: {width}; height: {height}"> <Card style="width: {width}; height: {height}">
<TabContent> {#if showFootprintTab && !showPolarTab}
{#if showFootprintTab} <JobFootprintBars {job} />
<TabPane tabId="foot" tab="Footprint" active={showFootprintTab}> {:else if !showFootprintTab && showPolarTab}
<JobFootprintPolar {job}/>
{:else if showFootprintTab && showPolarTab}
<TabContent>
<TabPane tabId="foot" tab="Footprint" active>
<!-- Bars CardBody Here--> <!-- Bars CardBody Here-->
<JobFootprintBars {job} /> <JobFootprintBars {job} />
</TabPane> </TabPane>
{/if} <TabPane tabId="polar" tab="Polar">
{#if showPolarTab}
<TabPane tabId="polar" tab="Polar" active={showPolarTab && !showFootprintTab}>
<!-- Polar Plot CardBody Here --> <!-- Polar Plot CardBody Here -->
<JobFootprintPolar {job} /> <JobFootprintPolar {job} showLegend={false}/>
</TabPane> </TabPane>
{/if} </TabContent>
</TabContent> {:else}
<Card color="info" class="m-2">
<CardHeader class="mb-0">
<b>Config</b>
</CardHeader>
<CardBody>
<p class="mb-1">Footprint and PolarPlot Display Disabled.</p>
</CardBody>
</Card>
{/if}
</Card> </Card>

View File

@@ -127,7 +127,7 @@
} }
</script> </script>
<CardBody> <CardBody class="overflow-auto">
{#if jobFootprintData.length === 0} {#if jobFootprintData.length === 0}
<div class="text-center">No footprint data for job available.</div> <div class="text-center">No footprint data for job available.</div>
{:else} {:else}

View File

@@ -3,6 +3,7 @@
Properties: Properties:
- `job Object`: The GQL job object - `job Object`: The GQL job object
- `showLegend Bool?`: Polar Legend Display
--> -->
<script> <script>
@@ -22,7 +23,8 @@
/* Svelte 5 Props */ /* Svelte 5 Props */
let { let {
job job,
showLegend
} = $props(); } = $props();
/* Const Init */ /* Const Init */
@@ -47,8 +49,8 @@
jobStats(id: $dbid, metrics: $selectedMetrics) { jobStats(id: $dbid, metrics: $selectedMetrics) {
name name
data { data {
min
avg avg
## min
max max
} }
} }
@@ -63,7 +65,7 @@
})); }));
</script> </script>
<CardBody> <CardBody class="py-0 overflow-hidden">
{#if $polarData.fetching} {#if $polarData.fetching}
<Spinner /> <Spinner />
{:else if $polarData.error} {:else if $polarData.error}
@@ -71,6 +73,7 @@
{:else} {:else}
<Polar <Polar
{polarMetrics} {polarMetrics}
{showLegend}
polarData={$polarData.data.jobStats} polarData={$polarData.data.jobStats}
/> />
{/if} {/if}