adding optional parameters to the Single set area chart to allow for clamping the graph so that large numbers do cause it to zoom etremely far out
This commit is contained in:
parent
0556fe2d8b
commit
f7b5a59c98
2 changed files with 8 additions and 3 deletions
|
|
@ -38,10 +38,12 @@ interface Props {
|
|||
multiGraphZoom?: (domain: number[] | string[]) => void;
|
||||
colourAboveZero?: ColourData
|
||||
colourBelowZero?: ColourData
|
||||
minY?: string | number
|
||||
maxY?: string | number
|
||||
}
|
||||
|
||||
export default function SingleSetAreaChart(props: Props) {
|
||||
const { data, maxRef, minRef, newXDomain, multiGraphZoom, yAxisLabel, colourAboveZero, colourBelowZero, tooltipLabel, tooltipUnit } = props;
|
||||
const { data, maxRef, minRef, newXDomain, multiGraphZoom, yAxisLabel, colourAboveZero, colourBelowZero, tooltipLabel, tooltipUnit, minY, maxY } = props;
|
||||
const [xDomain, setXDomain] = useState<string[] | number[]>(["dataMin", "dataMax"]);
|
||||
const [refLeft, setRefLeft] = useState<number | undefined>();
|
||||
const [refRight, setRefRight] = useState<number | undefined>();
|
||||
|
|
@ -152,7 +154,8 @@ export default function SingleSetAreaChart(props: Props) {
|
|||
/>
|
||||
<YAxis
|
||||
type="number"
|
||||
domain={["auto", "auto"]}
|
||||
allowDataOverflow
|
||||
domain={[minY ?? "auto", maxY ?? "auto"]}
|
||||
label={{
|
||||
value: yAxisLabel,
|
||||
position: "insideLeft",
|
||||
|
|
|
|||
|
|
@ -211,6 +211,8 @@ export default function GateDeltaTempGraph(props: Props){
|
|||
/>
|
||||
<SingleSetAreaChart
|
||||
data={data}
|
||||
minY={-40} //-40C is the same as -40F
|
||||
maxY={(user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? 104 : 40)}
|
||||
tooltipLabel="Delta Temp"
|
||||
tooltipUnit={user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? " °F" : " °C"}
|
||||
yAxisLabel={"Delta T" + (user.tempUnit() === pond.TemperatureUnit.TEMPERATURE_UNIT_FAHRENHEIT ? " °F" : " °C")}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue