testData.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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 { ChartDataResponseResult, VizType } from '@superset-ui/core';
  20. import { GenericDataType } from '@apache-superset/core/api/core';
  21. import {
  22. TableChartFormData,
  23. TableChartProps,
  24. } from '@superset-ui/plugin-chart-table';
  25. // @ts-ignore
  26. // eslint-disable-next-line import/extensions
  27. import birthNamesJson from './birthNames.json';
  28. export const birthNames = birthNamesJson as unknown as TableChartProps;
  29. export const basicFormData: TableChartFormData = {
  30. datasource: '1__table',
  31. viz_type: VizType.Table,
  32. align_pn: false,
  33. color_pn: false,
  34. include_search: true,
  35. metrics: ['sum__num', 'MAX(ds)'],
  36. order_desc: true,
  37. page_length: 0,
  38. percent_metrics: null,
  39. show_cell_bars: true,
  40. table_filter: false,
  41. table_timestamp_format: 'smart_date',
  42. };
  43. export const basicData: Partial<ChartDataResponseResult> = {
  44. colnames: ['name', 'sum__num', 'MAX(ds)', 'Abc.com'],
  45. coltypes: [
  46. GenericDataType.String,
  47. GenericDataType.Numeric,
  48. GenericDataType.Temporal,
  49. GenericDataType.String,
  50. ],
  51. data: [
  52. {
  53. name: 'Michael',
  54. sum__num: 2467063,
  55. 'MAX(ds)': '2008-01-01T00:00:00',
  56. 'Abc.com': 110,
  57. },
  58. {
  59. name: 'Christopher',
  60. sum__num: 1725265,
  61. 'MAX(ds)': '2008-01-01T00:00:00',
  62. 'Abc.com': 119,
  63. },
  64. {
  65. name: 'David',
  66. sum__num: 1570516,
  67. 'MAX(ds)': '2008-01-01T00:00:00',
  68. 'Abc.com': 120,
  69. },
  70. {
  71. name: 'James',
  72. sum__num: 1506025,
  73. 'MAX(ds)': '2008-01-01T00:00:00',
  74. 'Abc.com': 120,
  75. },
  76. {
  77. name: 'John',
  78. sum__num: 1426074,
  79. 'MAX(ds)': '2008-01-01T00:00:00',
  80. 'Abc.com': 120,
  81. },
  82. {
  83. name: 'Matthew',
  84. sum__num: 1355803,
  85. 'MAX(ds)': '2008-01-01T00:00:00',
  86. 'Abc.com': 120,
  87. },
  88. {
  89. name: 'Robert',
  90. sum__num: 1314800,
  91. 'MAX(ds)': '2008-01-01T00:00:00',
  92. 'Abc.com': 120,
  93. },
  94. {
  95. name: 'Daniel',
  96. sum__num: 1159354,
  97. 'MAX(ds)': '2008-01-01T00:00:00',
  98. 'Abc.com': 120,
  99. },
  100. {
  101. name: 'Joseph',
  102. sum__num: 1114098,
  103. 'MAX(ds)': '2008-01-01T00:00:00',
  104. 'Abc.com': 120,
  105. },
  106. {
  107. name: 'William',
  108. sum__num: 1113701,
  109. 'MAX(ds)': '2008-01-01T00:00:00',
  110. 'Abc.com': 120,
  111. },
  112. ],
  113. };