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

[FEAT][EXPLO][SC-46279] Table - Geo field #245

Merged
Show file tree
Hide file tree
Changes from 7 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 @@ -154,7 +154,7 @@ const meta: ComponentMeta<typeof PoiMap> = {

export default meta;

const Template: ComponentStory<typeof PoiMap> = (args) => (
const Template: ComponentStory<typeof PoiMap> = args => (
<div
style={{
width: '50%',
Expand Down
2 changes: 1 addition & 1 deletion packages/visualizations-react/stories/Poi/sources.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

import { PoiMapData } from '@opendatasoft/visualizations';

const sources : PoiMapData["sources"] = {
const sources : Required<PoiMapData>["value"]["sources"] = {
cities : {
type: 'geojson',
data: {
Expand Down
9 changes: 9 additions & 0 deletions packages/visualizations-react/stories/Table/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export default [
wordCount: 1200,
readingTime: 5.5,
url: 'https://example.com/lorem-ipsum',
geopoint: [2.357573,48.837904],
},
{
title: 'pellentesque nec blog post',
Expand All @@ -19,6 +20,7 @@ export default [
wordCount: 800,
readingTime: 3.8,
url: 'https://example.com/pellentesque-nec',
geopoint: [2.357573,48.837904],
},
{
title: 'fusce sit amet blog post',
Expand All @@ -30,6 +32,7 @@ export default [
wordCount: 1500,
readingTime: 7.2,
url: 'https://example.com/fusce-sit-amet',
geopoint: [2.357573,48.837904],
},
{
title: 'vestibulum nec blog post',
Expand All @@ -40,6 +43,7 @@ export default [
wordCount: 1000,
readingTime: 4.5,
url: 'https://example.com/vestibulum-nec',
geopoint: [2.357573,48.837904],
},
{
title: 'Cras At Blog Post',
Expand All @@ -51,6 +55,7 @@ export default [
wordCount: 1300,
readingTime: 6.0,
url: 'https://example.com/cras-at',
geopoint: [2.357573,48.837904],
},
{
title: 'Quisque A Blog Post',
Expand All @@ -62,6 +67,7 @@ export default [
wordCount: 900,
readingTime: 4.0,
url: 'https://example.com/quisque-a',
geopoint: [2.357573,48.837904],
},
{
title: 'Ut Vitae Blog Post',
Expand All @@ -73,6 +79,7 @@ export default [
wordCount: 1100,
readingTime: 5.0,
url: 'https://example.com/ut-vitae',
geopoint: [2.357573,48.837904],
},
{
title: 'Integer Id Blog Post',
Expand All @@ -84,6 +91,7 @@ export default [
wordCount: 950,
readingTime: 4.2,
url: 'https://example.com/integer-id',
geopoint: [2.357573,48.837904],
},
{
title: 'Undefined row',
Expand All @@ -94,6 +102,7 @@ export default [
wordCount: undefined,
readingTime: null,
url: undefined,
geopoint: undefined,
},
{
title: 'Empty row',
Expand Down
37 changes: 37 additions & 0 deletions packages/visualizations-react/stories/Table/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,43 @@ export const columns: Column[] = [
display: () => 'link',
},
},
{
title: 'Geo point',
key: 'geopoint',
dataFormat: 'geo',
options: {
mapOptions: {
style: 'https://demotiles.maplibre.org/style.json',
interactive: false,
},
display: (v: unknown) => `longitude: ${(v as number[])[0]}, latitude: ${(v as number[])[1]}`,
sources: (coordinates: unknown) => ({
'table-stories' : {
type: 'geojson',
data: {
type: 'FeatureCollection',
features: [
{
id: 1,
type: 'Feature',
geometry: {
type: 'Point',
coordinates,
},
},
],
}
},
}),
layers: () => ([{
id:'table-stories-layer',
source: 'table-stories',
type: 'circle',
color: 'black',
borderColor: 'white',
}])
},
},
];

const options: TableOptions = {
Expand Down
77 changes: 0 additions & 77 deletions packages/visualizations/src/components/MapPoi/Map.svelte

This file was deleted.

Loading
Loading