Geomap: configure size and color with different fields (#36825)

This commit is contained in:
Ryan McKinley
2021-07-19 10:16:42 -07:00
committed by GitHub
parent 48941da02e
commit 85a14a0503
11 changed files with 559 additions and 115 deletions

View File

@@ -64,7 +64,7 @@ function getBooleanScaleCalculator(field: Field, theme: GrafanaTheme2): ScaleCal
};
}
function getMinMaxAndDelta(field: Field): NumericRange {
export function getMinMaxAndDelta(field: Field): NumericRange {
if (field.type !== FieldType.number) {
return { min: 0, max: 100, delta: 100 };
}

View File

@@ -66,11 +66,15 @@ export function useFieldDisplayNames(data: DataFrame[], filter?: (field: Field)
*/
export function useSelectOptions(
displayNames: FrameFieldsDisplayNames,
currentName?: string
currentName?: string,
firstItem?: SelectableValue<string>
): Array<SelectableValue<string>> {
return useMemo(() => {
let found = false;
const options: Array<SelectableValue<string>> = [];
if (firstItem) {
options.push(firstItem);
}
for (const name of displayNames.display) {
if (!found && name === currentName) {
found = true;