Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion web/src/pages/ProfileEdit/ExtendedPhase.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,7 @@ export function ExtendedPhase({ phase, index, onChange, onRemove, pressureAvaila
<div className='form-control'>
<label htmlFor={`phase-${index}-flow`} className='mb-2 block text-sm font-medium'>
{mode === 'flow' ? 'Target' : 'Maximum'} Flow {mode === 'pressure' && '(0 = Ignore)'}
{mode === 'flow' && '(-1 = Keep current flow)'}
</label>
<div className='input-group'>
<label htmlFor={`phase-${index}-flow`} className='input w-full'>
Expand All @@ -284,7 +285,7 @@ export function ExtendedPhase({ phase, index, onChange, onRemove, pressureAvaila
onFieldChange('pump', { ...phase.pump, flow: parseFloat(e.target.value) })
}
aria-label='Flow rate in grams per second'
min={mode === 'flow' ? '0.1' : '0'}
min={mode === 'flow' ? '-1' : '0'}
/>
<span aria-label='grams per second'>g/s</span>
</label>
Expand Down
68 changes: 39 additions & 29 deletions web/src/pages/ShotHistory/HistoryChart.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function getChartData(data) {
const minX = Math.min(...timeValues);
const maxX = Math.max(...timeValues);
const padding = maxTemp - minTemp > 10 ? 2 : 5;

// Check if weight data has any non-zero values
const hasWeight = v.some(point => point.y > 0);
const hasWeightFlow = vf.some(point => point.y > 0);
Expand Down Expand Up @@ -93,20 +93,28 @@ function getChartData(data) {
data: tf,
},
// Only include weight datasets if they have non-zero values
...(hasWeight ? [{
label: 'Weight',
borderColor: '#8B5CF6',
pointStyle: false,
yAxisID: 'y2',
data: v,
}] : []),
...(hasWeightFlow ? [{
label: 'Weight Flow',
borderColor: '#4b2e8dff',
pointStyle: false,
yAxisID: 'y1',
data: vf,
}] : []),
...(hasWeight
? [
{
label: 'Weight',
borderColor: '#8B5CF6',
pointStyle: false,
yAxisID: 'y2',
data: v,
},
]
: []),
...(hasWeightFlow
? [
{
label: 'Weight Flow',
borderColor: '#4b2e8dff',
pointStyle: false,
yAxisID: 'y1',
data: vf,
},
]
: []),
],
},
options: {
Expand Down Expand Up @@ -179,21 +187,23 @@ function getChartData(data) {
},
grid: { drawOnChartArea: false },
},
...(hasWeight ? {
y2: {
type: 'linear',
min: 0,
position: 'right',
offset: true,
ticks: {
callback: value => `${value.toFixed()} g`,
font: {
size: window.innerWidth < 640 ? 10 : 12,
...(hasWeight
? {
y2: {
type: 'linear',
min: 0,
position: 'right',
offset: true,
ticks: {
callback: value => `${value.toFixed()} g`,
font: {
size: window.innerWidth < 640 ? 10 : 12,
},
},
grid: { drawOnChartArea: false },
},
},
grid: { drawOnChartArea: false },
},
} : {}),
}
: {}),
},
},
};
Expand Down