Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(deck.gl Multiple Layer Chart): Add Contour and Heatmap Layer as options #25923

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ export { default as PathChartPlugin } from './layers/Path';
export { default as PolygonChartPlugin } from './layers/Polygon';
export { default as ScatterChartPlugin } from './layers/Scatter';
export { default as ScreengridChartPlugin } from './layers/Screengrid';
export { default as ContourChartPlugin } from './layers/Contour';
export { default as HeatmapChartPlugin } from './layers/Heatmap';
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,16 @@ function setTooltipContent(formData: QueryFormData) {
<div className="deckgl-tooltip">
<TooltipRow
label={t('Start (Longitude, Latitude): ')}
value={`${o.object.sourcePosition[0]}, ${o.object.sourcePosition[1]}`}
value={`${o.object?.sourcePosition?.[0]}, ${o.object?.sourcePosition?.[1]}`}
/>
<TooltipRow
label={t('End (Longitude, Latitude): ')}
value={`${o.object.targetPosition[0]}, ${o.object.targetPosition[1]}`}
value={`${o.object?.targetPosition?.[0]}, ${o.object?.targetPosition?.[1]}`}
/>
{formData.dimension && (
<TooltipRow
label={`${formData.dimension}: `}
value={`${o.object.cat_color}`}
label={`${formData?.dimension}: `}
value={`${o.object?.cat_color}`}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,13 +93,13 @@ const recurseGeoJson = (

function setTooltipContent(o: JsonObject) {
return (
o.object.extraProps && (
o.object?.extraProps && (
<div className="deckgl-tooltip">
{Object.keys(o.object.extraProps).map((prop, index) => (
<TooltipRow
key={`prop-${index}`}
label={`${prop}: `}
value={`${o.object.extraProps[prop]}`}
value={`${o.object.extraProps?.[prop]}`}
/>
))}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function setTooltipContent(o: JsonObject) {
<div className="deckgl-tooltip">
<TooltipRow
label={t('Centroid (Longitude and Latitude): ')}
value={`(${o.coordinate[0]}, ${o.coordinate[1]})`}
value={`(${o?.coordinate[0]}, ${o?.coordinate[1]})`}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { Point } from '../../types';

function setTooltipContent(o: JsonObject) {
return (
o.object.extraProps && (
o.object?.extraProps && (
<div className="deckgl-tooltip">
{Object.keys(o.object.extraProps).map((prop, index) => (
<TooltipRow
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,27 @@ function getElevation(

function setTooltipContent(formData: PolygonFormData) {
return (o: JsonObject) => {
const metricLabel = formData.metric.label || formData.metric;
const metricLabel = formData?.metric?.label || formData?.metric;

return (
<div className="deckgl-tooltip">
{o.object.name && (
{o.object?.name && (
<TooltipRow
// eslint-disable-next-line prefer-template
label={t('name') + ': '}
value={`${o.object.name}`}
/>
)}
{o.object[formData.line_column] && (
{o.object?.[formData?.line_column] && (
<TooltipRow
label={`${formData.line_column}: `}
value={`${o.object[formData.line_column]}`}
/>
)}
{formData.metric && (
{formData?.metric && (
<TooltipRow
label={`${metricLabel}: `}
value={`${o.object[metricLabel]}`}
value={`${o.object?.[metricLabel]}`}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,17 @@ function setTooltipContent(
<TooltipRow
// eslint-disable-next-line prefer-template
label={t('Longitude and Latitude') + ': '}
value={`${o.object.position[0]}, ${o.object.position[1]}`}
value={`${o.object?.position?.[0]}, ${o.object?.position?.[1]}`}
/>
{o.object.cat_color && (
{o.object?.cat_color && (
<TooltipRow
// eslint-disable-next-line prefer-template
label={t('Category') + ': '}
value={`${o.object.cat_color}`}
value={`${o.object?.cat_color}`}
/>
)}
{o.object.metric && (
<TooltipRow label={`${label}: `} value={`${o.object.metric}`} />
{o.object?.metric && (
<TooltipRow label={`${label}: `} value={`${o.object?.metric}`} />
)}
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ function setTooltipContent(o: JsonObject) {
<TooltipRow
// eslint-disable-next-line prefer-template
label={t('Longitude and Latitude') + ': '}
value={`${o.coordinate[0]}, ${o.coordinate[1]}`}
value={`${o?.coordinate?.[0]}, ${o?.coordinate?.[1]}`}
/>
<TooltipRow
// eslint-disable-next-line prefer-template
label={t('Weight') + ': '}
value={`${o.object.cellWeight}`}
value={`${o.object?.cellWeight}`}
/>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { getLayer as deck_scatter } from './Scatter/Scatter';
import { getLayer as deck_geojson } from './Geojson/Geojson';
import { getLayer as deck_arc } from './Arc/Arc';
import { getLayer as deck_polygon } from './Polygon/Polygon';
import { getLayer as deck_heatmap } from './Heatmap/Heatmap';
import { getLayer as deck_contour } from './Contour/Contour';

const layerGenerators = {
deck_grid,
Expand All @@ -35,6 +37,8 @@ const layerGenerators = {
deck_geojson,
deck_arc,
deck_polygon,
deck_heatmap,
deck_contour,
};

export default layerGenerators;
Loading