GitHub user dosubot[bot] added a comment to the discussion: Not work Color(fill
color) the polygons in graphicseck.gl Polygons
<!-- Answer -->
To ensure each polygon is colored correctly based on the `zone_index_color`
property, you need to map the `zone_index_color` property to the `getFillColor`
attribute of the `PolygonLayer`. Here is an example of how you can achieve this:
1. **Ensure the `zone_index_color` property is correctly mapped to the `color`
property:**
```javascript
const yourPolygonData = data.map(d => ({
...d,
color: d.extraProps.zone_index_color
}));
```
2. **Apply the resulting color to the polygons:**
Make sure that the `color` property is used correctly in the layer
configuration. Here is an example of how you might configure the `PolygonLayer`:
```javascript
import { PolygonLayer } from '@deck.gl/layers';
const polygonLayer = new PolygonLayer({
id: 'polygon-layer',
data: yourPolygonData,
getPolygon: d => d.polygon, // Adjust this to match your data structure
getFillColor: d => d.color, // Use the color property from your data
// other layer properties
});
// Add the layer to your DeckGL instance
```
3. **Example of the complete setup:**
```javascript
import { PolygonLayer } from '@deck.gl/layers';
const yourPolygonData = data.map(d => ({
...d,
color: d.extraProps.zone_index_color
}));
const polygonLayer = new PolygonLayer({
id: 'polygon-layer',
data: yourPolygonData,
getPolygon: d => d.polygon, // Adjust this to match your data structure
getFillColor: d => d.color, // Use the color property from your data
// other layer properties
});
// Add the layer to your DeckGL instance
```
By following these steps, you should be able to color the polygons in
`graphicseck.gl` with your own colors based on the `zone_index_color` property
<sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-demo/storybook/stories/plugins/legacy-preset-chart-deckgl/Polygon/payload.js)</sup><sup>[[2]](https://github.com/apache/superset/blob/master/superset-frontend/plugins/legacy-preset-chart-deckgl/src/utils.ts)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
GitHub link:
https://github.com/apache/superset/discussions/32910#discussioncomment-12665542
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]