PivotTable.stories.tsx 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. import { SuperChart, VizType } from '@superset-ui/core';
  20. import { PivotTableChartPlugin } from '@superset-ui/plugin-chart-pivot-table';
  21. import { basicFormData, basicData } from './testData';
  22. import { withResizableChartDemo } from '../../../shared/components/ResizableChartDemo';
  23. export default {
  24. title: 'Chart Plugins/plugin-chart-pivot-table',
  25. decorators: [withResizableChartDemo],
  26. };
  27. new PivotTableChartPlugin().configure({ key: VizType.PivotTable }).register();
  28. export const Basic = ({ width, height }: { width: number; height: number }) => (
  29. <SuperChart
  30. chartType={VizType.PivotTable}
  31. datasource={{
  32. columnFormats: {},
  33. }}
  34. width={width}
  35. height={height}
  36. queriesData={[basicData]}
  37. formData={basicFormData}
  38. />
  39. );
  40. Basic.parameters = {
  41. initialSize: {
  42. width: 680,
  43. height: 420,
  44. },
  45. };
  46. export const MaximumAggregation = ({
  47. width,
  48. height,
  49. }: {
  50. width: number;
  51. height: number;
  52. }) => (
  53. <SuperChart
  54. chartType={VizType.PivotTable}
  55. datasource={{
  56. columnFormats: {},
  57. }}
  58. width={width}
  59. height={height}
  60. queriesData={[basicData]}
  61. formData={{ ...basicFormData, aggregateFunction: 'Maximum' }}
  62. />
  63. );
  64. MaximumAggregation.parameters = {
  65. initialSize: {
  66. width: 680,
  67. height: 420,
  68. },
  69. };