MapBox.stories.tsx 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing,
  13. * software distributed under the License is distributed on an
  14. * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  15. * KIND, either express or implied. See the License for the
  16. * specific language governing permissions and limitations
  17. * under the License.
  18. */
  19. /* eslint-disable no-magic-numbers */
  20. import { SuperChart, useTheme } from '@superset-ui/core';
  21. import MapBoxChartPlugin from '@superset-ui/legacy-plugin-chart-map-box';
  22. import { generateData } from './data';
  23. new MapBoxChartPlugin().configure({ key: 'map-box' }).register();
  24. export default {
  25. title: 'Legacy Chart Plugins/legacy-plugin-chart-map-box',
  26. };
  27. export const Basic = () => {
  28. const theme = useTheme();
  29. return (
  30. <SuperChart
  31. chartType="map-box"
  32. width={400}
  33. height={400}
  34. queriesData={[{ data: generateData(theme) }]}
  35. formData={{
  36. allColumnsX: 'LON',
  37. allColumnsY: 'LAT',
  38. clusteringRadius: '60',
  39. globalOpacity: 1,
  40. mapboxColor: 'rgb(244, 176, 42)',
  41. mapboxLabel: [],
  42. mapboxStyle: 'mapbox://styles/mapbox/light-v9',
  43. pandasAggfunc: 'sum',
  44. pointRadius: 'Auto',
  45. pointRadiusUnit: 'Pixels',
  46. renderWhileDragging: true,
  47. viewportLatitude: 37.78711146014447,
  48. viewportLongitude: -122.37633433151713,
  49. viewportZoom: 10.026425338292782,
  50. }}
  51. />
  52. );
  53. };