index.tsx 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import {t} from 'sentry/locale';
  2. import type {TagCollection} from 'sentry/types/group';
  3. import type {Organization} from 'sentry/types/organization';
  4. import type {QueryFieldValue} from 'sentry/utils/discover/fields';
  5. import type {WidgetType} from 'sentry/views/dashboards/types';
  6. import {DisplayType} from 'sentry/views/dashboards/types';
  7. import type {DataSet} from '../../utils';
  8. import {BuildStep} from '../buildStep';
  9. import {YAxisSelector} from './yAxisSelector';
  10. interface Props {
  11. aggregates: QueryFieldValue[];
  12. dataSet: DataSet;
  13. displayType: DisplayType;
  14. onYAxisChange: (newFields: QueryFieldValue[]) => void;
  15. organization: Organization;
  16. tags: TagCollection;
  17. widgetType: WidgetType;
  18. queryErrors?: Record<string, any>[];
  19. }
  20. export function YAxisStep({
  21. displayType,
  22. queryErrors,
  23. aggregates,
  24. onYAxisChange,
  25. tags,
  26. widgetType,
  27. }: Props) {
  28. return (
  29. <BuildStep
  30. title={
  31. displayType === DisplayType.BIG_NUMBER
  32. ? t('Choose what to plot')
  33. : t('Choose what to plot in the y-axis')
  34. }
  35. description={
  36. [DisplayType.AREA, DisplayType.BAR, DisplayType.LINE].includes(displayType)
  37. ? t(
  38. "This is the data you'd be visualizing in the display. If the overlay units conflict, the charts will always base it off of the first line."
  39. )
  40. : t("This is the data you'd be visualizing in the display.")
  41. }
  42. >
  43. <YAxisSelector
  44. widgetType={widgetType}
  45. displayType={displayType}
  46. aggregates={aggregates}
  47. onChange={onYAxisChange}
  48. tags={tags}
  49. errors={queryErrors}
  50. />
  51. </BuildStep>
  52. );
  53. }