11import type { Meta , StoryObj } from '@storybook/react' ;
22import BubbleLayer from './BubbleLayer' ;
3- import { code } from './code' ;
43
54const meta : Meta < typeof BubbleLayer > = {
65 title : 'Data Visualization/Bubble Layer' ,
76 component : BubbleLayer ,
87 parameters : {
98 layout : 'centered' ,
109 storySource : {
11- source : code ,
10+ source : `import { AzureMap, AzureMapsProvider, AzureMapDataSourceProvider, AzureMapLayerProvider } from 'react-azure-maps';
11+ import atlas, { BubbleLayerOptions } from 'azure-maps-control';
12+
13+ // Generate random points to build the data source for the BubbleLayer.
14+ const collection = generateRandomPoints();
15+
16+ const BubbleLayer = () => {
17+ <AzureMapsProvider>
18+ <div className="defaultMap">
19+ <AzureMap options={your_options}>
20+
21+ <AzureMapDataSourceProvider
22+ id="BubbleLayer DataSourceProvider"
23+ collection={collection}>
24+ <AzureMapLayerProvider
25+ type="BubbleLayer"
26+ options={{
27+ radius: 10,
28+ color: 'DodgerBlue',
29+ opacity: 1,
30+ strokeColor: 'DarkBlue',
31+ strokeWidth: 2,
32+ strokeOpacity: 1,
33+ blur: 0,
34+ }}
35+ />
36+ </AzureMapDataSourceProvider>
37+
38+ </AzureMap>
39+ </div>
40+ </AzureMapsProvider>
41+ );
42+ };
43+
44+ function generateRandomPoints() {
45+ var layerData = [];
46+
47+ for (var i = 0; i < 50; i++) {
48+ layerData.push(
49+ new atlas.data.Feature(new atlas.data.Point([Math.random() * 360 - 180, Math.random() * 170 - 85]), {
50+ title: 'Pin_' + i,
51+ }),
52+ );
53+ }
54+
55+ return layerData;
56+ }
57+
58+ ` ,
1259 } ,
1360 } ,
1461 args : {
@@ -31,7 +78,4 @@ export default meta;
3178
3279type Story = StoryObj < typeof BubbleLayer > ;
3380
34- export const Example : Story = {
35- name : 'Example' ,
36- args : { } ,
37- } ;
81+ export const Example : Story = { } ;
0 commit comments