useEnergyOverview
This hook is used to transform the data from the useMeasurements hook into an object that can be used to display the relevant information within the EnergyOverview compound component.
Basic Usage
import {
useMeasurementFilters,
useMeasurements,
} from "@krakentech/blueprint-utils/client";
import { useEnergyOverview } from "@krakentech/coral-molecules";
const measurementFilters = useMeasurementFilters();
const electricityMeasurements = useMeasurements({
variables: {
accountNumber,
dateLocale,
propertyId,
utilityType: FuelType.Electricity,
measurementFilters,
},
});
const electricityData = useEnergyOverview({
measurementsData: electricityMeasurements,
currency: "GBP",
locale: "en-GB",
});Please see the EnergyOverview component for a full example of how to use this object within the compound component.
Full API
Arguments
| Name | Description | type | Default value | Required |
|---|---|---|---|---|
measurementsData | The initial data provided by the consumer from the useMeasurements hook | UseMeasurementsData | undefined | true |
currency | The local 3-digit currency code | CurrencyCodes | GBP | false |
locale | The local code for your region | LocaleCodes | en-GB | false |
includeTax | Whether to include tax in the calculations | boolean | true | false |
Return
| Name | Description | type |
|---|---|---|
[const].data | The data object from the useMeasurements hook | object |
[const].chartData | An object used to create the charts and tables | object |
[const].legendEntries | The legendEntries object from useMeasurements, used to create the legend in the charts | object |
[const].lineChartData | The lineChartData object from useMeasurements, used to create the line chart on cost day view | object |
[const].marketSupplyPointId | A unique identifier for the supply point | string |
[const].measurementUnit | The unit which energy is measured e.g. โkWhโ | string |
[const].dateLocale | A locale object representing the date format | object |
[const].locale | The locale e.g. โen-GBโ | string |
[const].currency | The currency e.g. โGBPโ | string |
[const].totalConsumption | The total consumption value in cost or measurement unit | number |
[const].totalStandingCharge | The total standing charge value in cost | number |
[const].measurementWithMultipleStatisticsEntries | Used to help create the charts and tables | any |
[const].costOfUsageCurrency | The costOfUsageCurrency object from useMeasurements | string |
Last updated on